Respected sir, i have implemented your idea of Lagrange multiplier to solve first three equations (2.1a), (2.1b), and (2.1c) in the following equations:
Here, is a piece of code sir>>
Blockquote
real theta=1.;
real a=0.1;
real ac=1./a;
// Finite Element Spaces
fespace Vh(Th,P2);
Vh u,w,z,phi,psi,rho;
fespace Vh3(Th,[P2,P2,P2]);
Vh3 [wu,ww,wz];
real uAverage;
varf averagephi(u,w,z,phi,psi,rho)=int2d(Th)(phi/Th.area);
real[int] avphiform=averagephi(0,Vh3);
varf averagepsi(u,w,z,phi,psi,rho)=int2d(Th)(psi/Th.area);
real[int] avpsiform=averagepsi(0,Vh3);
varf averagerho(u,w,z,phi,psi,rho)=int2d(Th)(rho/Th.area);
real[int] avrhoform=averagerho(0,Vh3);
// To solve First three equations (2.1a), (2.1b), and (2.1c) simultaneously
varf pbuwz(u,w,z,phi,psi,rho)=int2d(Th)(u*phi/dt+a*Grad(w)'*Grad(phi)) // Due to (2.1a)
-int2d(Th)(w*psi)+int2d(Th)((ac*(ukold^3-ukold)-stab*ukold)*psi)// Non-linear term for (2.1b)
+int2d(Th)(stab*u*psi)//stabilization
+int2d(Th)(a*Grad(u)'*Grad(psi)) // for (2.1b)
+int2d(Th)(z*psi) // for equaution of z in (2.1c)
-int2d(Th)(u0*v10*dx(phi)+u0*v20*dy(phi)) // advection term in (2.1a)
-int2d(Th)(u0*phi/dt+f(t+dt/2.)*phi)// RHS of first equation in (2.1a)
+int2d(Th)(Grad(z)'*Grad(rho)) // for equation of z in (2.1c)
+int2d(Th)(1.e-8*z*rho) // Due to (2.1c)
-int2d(Th)(u*rho); // Due to (2.1c)
// solve
matrix A=pbuwz(Vh3,Vh3,Vh3);
real[int] rhs=pbuwz(0,0,Vh3);
rhs=-rhs;
matrix B=[[A,avrhoform],[avphiform',-1.],[avpsiform',-1.]];
set(B,solver="UMFPACK");
real[int] rhsB(rhs.n+1);
rhsB=[rhs,0., 0.];
real[int] solB=B^-1*rhsB;
[wu[],ww[],uAverage]=solB;
u=wu;
z=wz;
w=ww;
Blockquote
Here, u0, [v10, v20](initial velocity) are knows due to initial datas.
I have used the continuous setting of the paper>>
DG PPC of CHDS.pdf (2.0 MB)
I have not given nonlinear loop and time loop here sir (ukold comes for nonlinearity) (as i know you know better than me sir).
I have tried to solve as in the paper in continuous setting:
But some errors are coming in matrix A.
Here, is the errors>>
I will be very grateful sir if i get some help on this.
Thanks in advance sir!.