Hi all,
I'm attempting to compute solutions to the 2D stationary NS equations in a unit square. I prescribe no-slip BC on the top and bottom walls, and periodic BC on the left/right walls. To drive the fluid, I prescribe a pressure drop from the left to right. (p = 1 on the left side, p = 0 on the right). When I plot the computed solution, I get strange results for the computed pressure.
For UnitSquareMesh(16,16), I get pressure values that are O(10^3). Mesh refinement brings the value down; for instance, on UnitSquareMesh(64,64) I get ~O(10^2). But, further mesh refinement (UnitSquareMesh(128,128)) computes pressure to be O(10^5). What is strange to me is that:
(i) I'm in a low Re regime--I have viscosity set to 1 .
(ii) No matter how fine or coarse the mesh, I still get the expected "Poiseuille flow" i.e. a parabolic wavefront.
(iii) With the exact same problem setup, solving the Stokes equation (i.e. dropping the convective term and solving a linear system) always gives me (essentially) the same pressure values, no matter how fine the mesh.
Can anyone help me explain this behavior? Attached below is my code (modulo defining domain subboundaries). Any help is much appreciated.
#Create no-slip BC for velocity and pressure BCs
no_slip = Constant((0.0, 0.0))
p_right = Constant(0.0)
p_left = Constant(1.0)
bc0 = DirichletBC(W.sub(0), noslip, dbc)
bcs = [bc0]
# Define new measures for exterior boundaries
n = FacetNormal(mesh)
ds = Measure("ds")[boundaries]
# set parameter values -- viscosity
nu = 1.0
# Define variational problem
(v, q) = TestFunctions(W)
w = Function(W)
u, p = split(w)
F = nu*inner(grad(u), grad(v))*dx + div(v)*p*dx + q*div(u)*dx + dot(grad(u)*u, v)*dx \
+ p_left*dot(v,n)*ds(1) + p_right*dot(v,n)*ds(2)
solve(F == 0, w, bcs)
u, p = split(w)
plot(u)
plot(p)
plot(mesh)
interactive()