Thank you for taking the time to reply to my questions amidst your busy schedule.I have implemented a finite element method based on feature lines for the example of a cavity.That is a relatively simple and easy code.
I have also made preliminary modifications to the above issues, but its convergence is not good and still diverges.
I feel it is necessary to reiterate my question here
For continuity equations, the weak form is as follows
problem cons(rho,rhot)=
int2d(Th)(rho*rhot/dt)-int2d(Th)((convect([uold,vold],-dt,rhoold)*rhot/dt))+int2d(Th)(rho*dx(uold)*rhot+rho*dy(vold)*rhot)
+int1d(Th,1,2,3,4)(dx(rho)*rhot*N.x+dy(rho)*rhot*N.y);
For the p-equation, I did not handle it in a weak form, but directly calculated it using an expression, as follows
fespace Ph(Th,P1);Ph p;
p=8*rho*sigma/(3-rho)-3*rho^2;
The velocity equation is as follows
problem NSK([u,v],[uu,vv])=
int2d(Th)(rho*(u*uu/dt+v*vv/dt))-int2d(Th)(rho*((convect([uold,vold],-dt,uold)*uu+convect([uold,vold],-dt,vold)*vv)/dt))
+int2d(Th)((1/Re)*(((4/3)*dx(u)-(2/3)*dy(v))*dx(uu)+(dy(u)+dx(v))*dy(uu)+(dx(v)+dy(u))*dx(vv)+((4/3)*dy(v)-(2/3)*dx(u))*dy(vv)))
+int2d(Th)(dx(p)*uu+dy(p)*vv)
+int2d(Th)((1/We)*(dx(rho)*(dxx(rho)+dyy(rho))*uu+dy(rho)*(dxx(rho)+dyy(rho))*vv))
+int2d(Th)((1/We)*(rho*(dxx(rho)+dyy(rho))*dx(uu)+rho*(dxx(rho)+dyy(rho))*dy(vv)))
-int1d(Th,1,2,3,4)((1/We)*(rho*(dxx(rho)+dyy(rho))*uu*N.x+rho*(dxx(rho)+dyy(rho))*vv*N.y))
-int1d(Th,1,2,3,4)((1/Re)*(((4/3)*dx(u)-(2/3)*dy(v))*uu*N.x+(dy(u)+dx(v))*uu*N.y+(dx(v)+dy(u))*vv*N.x+((4/3)*dy(v)-(2/3)*dx(u))*vv*N.y))
+on(1,2,3,4,u=0,v=0);
Especially for the third-order derivative term, I adopted the following weak form
+int2d(Th)((1/We)*(dx(rho)*(dxx(rho)+dyy(rho))*uu+dy(rho)*(dxx(rho)+dyy(rho))*vv))
+int2d(Th)((1/We)*(rho*(dxx(rho)+dyy(rho))*dx(uu)+rho*(dxx(rho)+dyy(rho))*dy(vv)))
-int1d(Th,1,2,3,4)((1/We)*(rho*(dxx(rho)+dyy(rho))*uu*N.x+rho*(dxx(rho)+dyy(rho))*vv*N.y))
The speed always increases until a large number, and I don’t know where my weak form problem lies.Please help me, I will be extremely grateful
vdw1.edp (1.6 KB)