Order of convergence for a Navier-Stokes solver

Hi,
I need to prove the correctness of a Navier-Stokes solver, and I am doing something similar like

nx_exp = 2
nx = 2 ** nx_exp # to control the number of cells, UnitSquareMesh(nx, nx)
while nx < 2 ** 8:
                up_sol = solve_on_refined_domain(nx, f)
                (u, p) = up_sol.split(True)
                (u1, u3) = u.split(True)
                Eu1 = errornorm(u_exact1, u1, norm_type='L2')
                Eu3 = errornorm(u_exact3, u3, norm_type='L2')
                nx = 2 * nx

where u_exact1, u_exact3 and p_exact are given as Expression-s. The expression f is calculated via substituting u_exact1, u_exact3 and p_exact into the strong form of the stationary Navier-Stokes system

u \nabla u - \Delta u + \nabla p = f,

and thus we know the forcing term f. Calling solve_on_refined_domain with this specific forcing term we expect to get solutions close to the exact ones, which does happen for the velocities, but not for the pressure. My question is: can u_exact and p_exact be chosen arbitrarily (and then calculate the forcing term accordingly), or are there “better”, more wise choices for them in order to see the convergence of the scheme? I have been playing around with sin(2* pi* x)*cos(2 *pi *z) kind of choices — works for the velocity, not so much for the pressure function.

Thank you so much for any hints!
Nora

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

Hey Nora,
did u find a solution for your problem? I got stuck with the same problem… My velocities converge perfectly but my pressure error is at best bounded. I get this result with lower and higher order Chorin-Projections as well as with a coupled solver.

I also tried the “ansatz” by volkerk without success unfortunately.

Best regards!
Max

Hi Max,
I have checked now and in all of my test cases I eventually used a constant zero pressure function combined with different velocity functions. For those specific cases it works and the solver does find the expected 0 solution function for the pressure, even if the velocities are trigonometric functions for example.
I don’t have the full explanation for the phenomenon, however one idea is I guess that by the nature of Navier-Stokes you control only the gradient of the pressure, and not the pressure itself, so you can not always expect to get great pressure error values.
I know this is not much maybe it helps somewhat. For me it was a step forward to have at least some basic test cases for which everything works, and a 0 pressure model for me was such.
All the best,
Nora