Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Matrix construction with inverse

More
2 years 11 months ago #3755 by bakerk
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
Time to create page: 0.150 seconds