Order of convergence for a Navier-Stokes solver

If you use Dirichlet boundary conditions and see convergence in the velocity but not the pressure, you can try adjusting the mean of the discrete pressure solution to the mean of the exact pressure, e.g.:

vol_mesh = assemble(Constant(1.0)*dx(mesh))
p_exact_mean = assemble(p_exact*dx(mesh))/vol_mesh
p_h_mean = assemble(p_h*dx)/vol_mesh
p_h.vector()[:] += p_exact_mean - p_h_mean
1 Like