In the Navier-Stokes equations or in computational fluid dynamics in general, pressure is usually prescribed as a Neumann boundary condition. As such, I am confused with the code presented in the Stokes flow tutorial. In Section, 21.3. Complete code, the code for the outflow pressure BC is written as:
# Boundary condition for pressure at outflow
# x0 = 0
zero = Constant(0)
bc2 = DirichletBC(W.sub(1), zero, sub_domains, 2)
Why is pressure being prescribed as a Dirichlet BC here, instead of being implemented as a Neumann BC in the weak/variational formulation?
I believe applying pressure as a Dirichlet condition is slightly different from applying Neumann conditions from a physical point of view. For the natural zero Neumann condition we typically set mu*du/dn - pn = 0.
If we apply Dirichlet conditions we set p = 0 on the boundary, but the Neumann condition will still be applied in the momentum equation if velocity is not prescribed as a Dirichlet on that boundary. Thus if p = 0, then we get du/dn = 0 as well.
Thus, Dirichlet condition on pressure gives us p = 0 and du/dn = 0, while Neumann condition gives us mu*du/dn - pn = 0. These two have a slightly different physical interpretation.