# 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 – nicoguaro Sep 16 '20 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). – yemino Sep 16 '20 at 17:39

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}$$.
• 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 '20 at 4:23