Thank you very much for responding to my questions.
I looked up some references on the pressure projection method. In the second variational problem of updating pressure, the Neumann boundary condition of pressure is required. In practice, this condition is responsible for the errors this method shows close to the boundary of the domain since the real pressure (i.e., the pressure in the exact solution of the Navier-Stokes equations) does not satisfy such boundary conditions. But if the velocity can satisfy u·n=0
boundary condition, the Neumann boundary conditions of the pressure will naturally be obtained.
I see that what you added in the code is on(1,2,3,4,pnp1=pe(t))
Dirichlet boundary condition. Is it correct?
Convergence order in L2 norm of u: 0, 0.158643, 1.05926, 0.962136, 0.74141, 0.496186.
Convergence order in H1 norm of u: 0, 0.153184, 0.967829, 0.871569, 0.691116, 0.541268.
convergence order in L2 norm of p: 0, 1.72902, -1.21749, 0.519209, 0.767257, 0.801716.
Is this the result of me running the code, or is it incorrect and is it caused by the above issue?
In addition, for the convection term, do I have to use convect
? Can’t I define macro UgradV(ux,uy,vx,vy) [ux*dx(vx) + uy*dy(vx), ux*dx(vy) + uy*dy(vy)] //
myself?