[firedrake] Matrix multiplication in bilinear form

Anna Kalogirou a.kalogirou at leeds.ac.uk
Fri Nov 13 11:48:12 GMT 2015


Dear Lawrence,

I have the following term in my RHS form (all quantities in there are 
known functions)

Hb*step_b*inner(grad(0.5*dt*g*eta0-phi0),grad(v))*dx

which is similar to the "local" stiffness matrix Ab. I want to replace 
this with something of the following form: 
Mb*Minv*A*(0.5*dt*g*eta0_k-phi0_k)
where eta0_k, phi0_k are the coefficients in the approximations for 
eta0, phi0, respectively.

Is this possible?

Thanks,
Anna.


On 12/11/15 14:28, Lawrence Mitchell wrote:
> Hi Anna,
>
> On 12/11/15 12:38, Anna Kalogirou wrote:
>> Hi Lawrence,
>>
>> In the email below you explained to me how to define a matrix free
>> operator B. Is there a way to inspect the values of the matrix behind
>> this operator?
> Assuming that you are not running in parallel, and you do not have two
> many degrees of freedom in your problem (I guess you want to look at
> the values for a small system), you can do the following:
>
> ctx = B.getPythonContext()
>
> dense_A = ctx.A[:, :]
> Q1_array = ctx.Q1.array_r
> Q2_array = ctx.Q2.array_r
>
> import numpy as np
>
> dense_B = dense_A + np.outer(Q1_array, Q2_array)
>
> print dense_B
>
> Cheers,
>
> Lawrence
>
>
> _______________________________________________
> firedrake mailing list
> firedrake at imperial.ac.uk
> https://mailman.ic.ac.uk/mailman/listinfo/firedrake

-------------- next part --------------
HTML attachment scrubbed and removed


More information about the firedrake mailing list