Now I need to solve a system of equations using FreeFEM, and I’m not sure if the format of the equations I’ve defined is correct. In fact, I only know how to define and solve individual equations using FreeFEM, so I tried to mimic the format used for a single equation and ended up with an obviously incorrect result.
find \left(\mathbf{u}_{h}, \gamma_{h}, d_{h}\right) \in V_{h} \times R_{h} \times R_{h}.
R_h is the Lagrange elements with degree k ≥ 1 and V_h is the Raviart-Thomas elements with degree k.
Here is my code, and I’m not sure how to correctly define and solve a system of equations in FreeFEM. Can it only be solved through a matrix-based approach?
func f1=(2*pi*pi)*sin(pi*x)*sin(pi*y);
func f2=(2*pi*pi)*sin(pi*x)*sin(pi*y);
func re1=sin(pi*x)*sin(pi*y);
func re2=sin(pi*x)*sin(pi*y);
macro grad(u) [dx(u), dy(u)] //
macro curl(u) [dy(u),-dx(u)]//
macro div (u) [dx(u.x)+dy(u.y)]//
macro rot (u) [dx(u.y)-dy(u.x)]//
macro dot(u,v)[u.x*v.x+u.y*v.y]//
macro Grad(u) [dx(u), dy(u)]//
mesh Th = square(8,8);
fespace Ph(Th,P1); Ph v,w,r,d,real1,real2;
fespace Rh(Th,RT0);Rh [u1,u2],[g1,g2];
problem laplaceMixte([u1,u2,r,d], [g1,g2,v,w]) =
int2d(Th)(
r*v - u1*dy(v)+u2*dx(v)
+ d*w+u1*dx(w)+u2*dy(w)
+ dy(r)*g1-dx(r)*g2-dx(d)*g1-dy(d)*g2
)-int2d(Th)(f1*g1+f2*g2)
+ on(1,2,3,4, u1=0,u2=0);
laplaceMixte;
real1=re1;
real2=re2;
plot([u1,u2],coef=0.1,value=true,wait=1);
plot([real1,real2],coef=0.1,value=true);