Hi,

I’m having some trouble constructing a matrix to invert for my time stepping scheme. My scheme is like:

(M_1 + M_2 * (M_1 + dt* M_3)^(-1) * M_4 ) u_{n+1} = M_1 * f( u_{n}, u_{n-1} )

where M_i are my FEM matrices (SparseMatrixDouble), dt is the time step and f is a function of u_{n}, and u_{n-1} which we know. The problem that I am having is building the matrix on the LHS which I will then need to invert.

So far I have the matrices all defined using

m=BilinearForm(V)

m+=SymbolicBFI(u*v)

m.Assemble()

(with variations for their exact forms). And I can build (M_1 + dt* M_3)^(-1) with,

mi = m.mat.CreateMatrix()

mi.AsVector().data = m1.mat.AsVector() + dt*m3.mat.AsVector()

invmi=mi.Inverse(freedofs=V.FreeDofs(),inverse=“pardiso”)

This is where I am not sure how to proceed in defining (M_1 + M_2 * (M_1 + dt* M_3)^(-1) * M_4 )

Any help on how to do this would be great!

Thanks,

Katie