# Forcing pressure values on inlet and outlet

**URL:** https://community.freefem.org/t/forcing-pressure-values-on-inlet-and-outlet/741
**Category:** General Discussion
**Created:** [January 11, 2021, 6:45pm UTC](https://community.freefem.org/t/forcing-pressure-values-on-inlet-and-outlet/741 "2021-01-11T18:45:49Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![LeonardoDipilato](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/leonardodipilato/32/361_2.png) [@LeonardoDipilato](https://community.freefem.org/u/LeonardoDipilato)
#### Post date: [January 11, 2021, 6:45pm UTC](https://community.freefem.org/t/forcing-pressure-values-on-inlet-and-outlet/741/1 "2021-01-11T18:45:49Z")

</div>

I’m trying to solve a problem of a microfluidic flow inside a valve given pressure at the inlet and the outlet.

My governing equation is Re(u\*grad(u))+grad( p )-lapl(u) = 0, where Re is Reynolds number, \* is the dot product, u is the velocity vector, p is the pressure and grad and lapl are gradient and laplacian.

How can I force the value of pressure at the inlet and at the outlet? I want to simulate a constant force applied on the inlet and atmospheric pressure on the outlet.

In my understanding, using on(INLET, p=1) and on(OUTLET, p=0) doesn’t correctly simulate my scenario, does it?

---

<div class="post-metadata">

### Author: ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)
#### Post date: [January 11, 2021, 9:09pm UTC](https://community.freefem.org/t/forcing-pressure-values-on-inlet-and-outlet/741/2 "2021-01-11T21:09:44Z")

</div>

You want to inforce force on the flow not pressure (it is very close to the pressure)

in this case the you can found this kind of Boundary in [https://www.ljll.math.upmc.fr/hecht/ftp/ff++days/2013/2013-FF++-days/Tp/BC-NS.pdf](https://www.ljll.math.upmc.fr/hecht/ftp/ff++days/2013/2013-FF++-days/Tp/BC-NS.pdf)  
and all associated exemples and file in archive  
[https://www.ljll.math.upmc.fr/hecht/ftp/ff++days/2013/2013-FF++-days.zip](https://www.ljll.math.upmc.fr/hecht/ftp/ff++days/2013/2013-FF++-days.zip)

---

<div class="post-metadata">

### Author: ![LeonardoDipilato](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/leonardodipilato/32/361_2.png) [@LeonardoDipilato](https://community.freefem.org/u/LeonardoDipilato)
#### Post date: [January 11, 2021, 10:57pm UTC](https://community.freefem.org/t/forcing-pressure-values-on-inlet-and-outlet/741/3 "2021-01-11T22:57:00Z")

</div>

Thanks for the reply!  
I think the slides went a bit over my head, so I couldn’t really understand much of what is going on in the code.

From some additional research, I found that the weak formulation on [Wikipedia](https://en.wikipedia.org/wiki/Navier%E2%80%93Stokes_equations#Weak_form) has an additional term into the equation which is an integral on the neumann boundary of h\*v, but I don’t know what h actually is (earlier, a scalar h was defined as the hydraulic head, but this one’s a vector, perhaps it’s just the scalar h multiplied by the normal vector?). Do you think this might help?

---

<div class="post-metadata">

### Author: ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)
#### Post date: [January 12, 2021, 9:05am UTC](https://community.freefem.org/t/forcing-pressure-values-on-inlet-and-outlet/741/4 "2021-01-12T09:05:29Z")

</div>

The important slide is 5 to understand the principe and in variationnnal form all Boundary term (BC) is model in green term (see slide 6).

Now in your case you want to add artificial BC and you say it is pressure.  
But in a fluide the pressure p is not a real variable just internal forces such that the fluid is a free divergence (Lagrange multiplier), in your case your say the force in inlet and outlet is given .  
With the following example you can try:  
[Stokes-Pipe-Curve-Math.edp](https://community.freefem.org/uploads/short-url/pp4jMAFECUmsYbAgfB1jCGfDl0A.edp) (1.0 KB)

remark the correct BC. are normale forces and zero tangent component.

---

<div class="post-metadata">

### Author: ![LeonardoDipilato](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/leonardodipilato/32/361_2.png) [@LeonardoDipilato](https://community.freefem.org/u/LeonardoDipilato)
#### Post date: [January 12, 2021, 10:51am UTC](https://community.freefem.org/t/forcing-pressure-values-on-inlet-and-outlet/741/5 "2021-01-12T10:51:23Z")

</div>

I think I understand it now, thanks! I’ll just have to wrap my head around it.

However, there’s one thing I don’t understand in the last example. The laplacian term -lapl(u)\*v was substituted by Grad(u):Grad(v), but wouldn’t you also need a -div(grad(u)\*v) term to do that?  
On the walls, v=0 and thus the term is gone, but you’d need to keep it both at the inlet and at the outlet, right?

Similarly, for the -p\*div(v), wouldn’t you also need a div(pv)?  
Again, 0 on the walls, but not necessarily 0 on the inlet and the outlet.

This is something I’ve seen in examples all around the internet, but that doesn’t really match what I’ve studied.
