# Imposing pressure variation instead of Dirichlet boundary conditions on Finite Element Method

I always see Finite Element codes solving PDE with Dirichlet or Neumann boundary conditions. But, I have a problem now consisting of a straight cylinder with a circular base (a simple 3D tube), with inflow and outflow given by a pressure variation (for example, $$p_\textrm{inflow}=20$$ at the left circular "cap" and $$p_\textrm{outflow}=0$$ at the right circular "cap", and velocity equal to zero in the boundary that is not inflow nor outflow (so, the flow go in through the inflow circular side and go out through the outflow circular side because of a pressure variation).

I'm solving Navier--Stokes equations for the fluid (I think it is not an important data):

$$u_t-\nu\Delta u+(\nabla u)u+\nabla p=f$$ in a boundary domain $$\Omega$$

$$\nabla\cdot u=0$$ in $$\Omega$$

so my unknowns are the velocity $$u$$ and the pressure $$p$$. The effects of gravity are neglected. For simplicity, we may consider the stationary equation only.

How I must modify the code in order to work with that pressure difference data? My code (and numerical analysis) only accepts Dirichlet and Neumann boundary conditions.

• The equation is important information, that determines what type of boundary conditions you have Sep 16, 2020 at 16:15
• Thanks @nicoguaro, I added explicitly the Navier--Stokes equations. For me is the same consider the Stokes equations (maybe is easier to explain because is linear). Sep 16, 2020 at 17:39

I have a paper on this which, as long as your boundary is flat and you don't expecct it to pass vortexes, should do you well: https://doi.org/10.1002/fld.1427.

The gist of it is that as long as the boundary is flat and you enforce no tangential flow, the normal traction is equal to the pressure in an incompressible flow. This is an OK BC for Poiseuille-like flows, but not a general BC where anything might flow out since you have to enforce no tangential flow at the boundary. I didn't save the reference, but there have been some developments in this area that solve this problem in the last few years.

In the Navier-Stokes equations, you can't prescribe the pressure on the boundary (or part of it). That's just not a physical thing, nor mathematically correct. The only thing you can prescribe is the traction, i.e., the normal component of the stress, which is given by $$\mathbf t = (-\nu \nabla \mathbf u + pI) \mathbf n.$$ For example, you could prescribe that the traction should be $$\mathbf t|_{\Gamma_\text{in}} = 20$$ and a corresponding value on the outflow part $$\Gamma_\text{out}$$.

Boundary conditions are tricky. If you want to learn more about it, you might want to watch lectures 21.5 and following here: https://www.math.colostate.edu/~bangerth/videos.html

• Typically you end up with an $n\cdot \mathbf{T}$ term for the boundary as shown above if you impose that tangential velocity is zero then for a fully developed flow you have a pressure like boundary condition when prescribing the traction. Though this isn't as strong as a Dirichlet condition and you may not actually see the exact pressure values imposed.
– wwfe
Sep 17, 2020 at 4:23
• @wwfe That just isn't right. If you prescribe tangential flow, then you can additionally prescribe the normal component of the traction. But that's not the pressure, it's a combination of the pressure and the shear stress. As a consequence, whatever you prescribe affects the pressure, but it doesn't actually prescribe the pressure. Sep 17, 2020 at 4:32
• that is correct it is a combination of pressure and shear stress, but for fully developed flow the normal component of the shear stress should be zero as well so in practice you can use it to apply a "pressure-like" boundary condition. Here is an example of Poiseuille flow with no slip on top and bottom, applying the traction BC of value 200 on the left and natural BC on the right, and no tangential velocity on left and right i.imgur.com/PwWSZfG.png
– wwfe
Sep 17, 2020 at 12:49
• Thanks @WolfgangBangerth and @ wwfe, I understood perfectly (a better explanation is impossible). Sep 17, 2020 at 15:04