# The saddle point system of the mixed finite element

hello there,

I’m trying to get the underlying linear system of the mixed finite formulation of the poisson problem. The one of the form

is there a way to do so in freefem.

Yes, there is a way to do so in FreeFEM.

1 Like

Can you please provide a refernce or an example?

I have seen this example in the documentation, but I’d like to get access to the submatrices M and B I have tried the following

``````// Mesh
mesh Th = square(10, 10);
func PkV = RT0;
func PkP = P0;
func Pk = [PkV, PkP];

fespace Wh(Th, Pk);           // local finite element space

varf vMixedLaplace([u1, u2, p], [v1, v2, q]) = int2d(Th)(u1 * v1 + u2 * v2 + p*(dx(v1) + dy(v2)) + (dx(u1) + dy(u2))*q)
+ on(4, u1 = 1.0, u2 = 1.0);
matrix A;
A = vMixedLaplace(Wh, Wh, tgv = -1);
``````

but the resulting matrix A does not have the form of the saddle point problem.

also, I tried to get the matrices M and B and solve the systen using the Schur complement, but I get wrong answer

``````// Fespace
fespace Vh(Th, RT0);
Vh [u1, u2];
Vh [v1, v2];

fespace Ph(Th, P0);
Ph p, q;

varf m([u1, u2], [v1, v2]) = int2d(Th)(u1*v1+u2*v2)+ on(4, u1=1, u2=1);
matrix M=m(Vh,Vh,tgv = -1);

varf b1([p],[v1,v2]) = int2d(Th)(p*dx(v1)+p*dy(v2));
matrix B=b1(Ph,Vh);

varf l1([unused],[v1,v2]) = int1d(Th, 1, 2, 3)(gd*v1*N.x+gd*v2*N.y,tgv = -1);
real[int] r1 = l1(0,Vh);

varf l2(unused, q) = int2d(Th)(-q);
real[int] r2 = l2(0,Ph);
``````

Here is one example solving the system using the Schur complement: FreeFem-sources/examples/hpddm/laplace-RT-2d-PETSc.edp at master · FreeFem/FreeFem-sources · GitHub.