# Stokes Flow with Pressure Inlet Conditions

**URL:** https://discourse.julialang.org/t/stokes-flow-with-pressure-inlet-conditions/128577
**Category:** Numerics
**Tags:** question
**Created:** [April 30, 2025, 2:39pm UTC](https://discourse.julialang.org/t/stokes-flow-with-pressure-inlet-conditions/128577 "2025-04-30T14:39:19Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![ziolai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ziolai/32/23422_2.png) [@ziolai](https://discourse.julialang.org/u/ziolai)
#### Post date: [April 30, 2025, 2:39pm UTC](https://discourse.julialang.org/t/stokes-flow-with-pressure-inlet-conditions/128577/1 "2025-04-30T14:39:20Z")

</div>

Are there examples of simulating (Navier-)Stokes flow by imposing pressure inlet conditions using VoronoiFVM, WaterLilly, Oceananigans, Trixi or similar?

Thx.

---

<div class="post-metadata">

### Author: ![DanDoe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dandoe/32/52717_2.png) [@DanDoe](https://discourse.julialang.org/u/DanDoe)
#### Post date: [April 30, 2025, 3:39pm UTC](https://discourse.julialang.org/t/stokes-flow-with-pressure-inlet-conditions/128577/2 "2025-04-30T15:39:40Z")

</div>

This sounds like a problem you could solve with Gridap.jl

There are even tutorials on this:

1. [Navier-Stokes](https://gridap.github.io/Tutorials/stable/pages/t008_inc_navier_stokes/)
2. [Stokes](https://gridap.github.io/Tutorials/stable/pages/t009_stokes/)

---

<div class="post-metadata">

### Author: ![ziolai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ziolai/32/23422_2.png) [@ziolai](https://discourse.julialang.org/u/ziolai)
#### Post date: [April 30, 2025, 4:03pm UTC](https://discourse.julialang.org/t/stokes-flow-with-pressure-inlet-conditions/128577/3 "2025-04-30T16:03:24Z")

</div>

I definitely agreed that the use of Gridap.jl is tempting here.

I do have examples similar to the ones you point to up and running.

It is the alternative implementation of the pressure boundary condition that I am wondering about.

Thx.

---

<div class="post-metadata">

### Author: ![Paulo\_Jabardo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paulo_jabardo/32/3196_2.png) [@Paulo\_Jabardo](https://discourse.julialang.org/u/Paulo_Jabardo)
#### Post date: [April 30, 2025, 7:44pm UTC](https://discourse.julialang.org/t/stokes-flow-with-pressure-inlet-conditions/128577/4 "2025-04-30T19:44:20Z")

</div>

This is really tricky mathematically but in engineering practice It is an important condition for internal flows. This kind of BC is nonlinear in nature. Usually the implementation of this BC involves setting the total pressure on the inlet. Guess the static pressure and calculate the velocity. Compute the flow and get a better value for static pressure, compute inlet velocity again (you will need to specify flow direction!) and so on.

Check out this video: [https://www.youtube.com/watch?v=Er2j5Kq17as](https://www.youtube.com/watch?v=Er2j5Kq17as)

In some cases you can simplify the problem. As an example, take the DNS flow in a long pipe where you don’t want to bother with flow development. One possibility I’ve used before, is to set a periodic condition for the inlet and outlet. How do we specify the pressure? Use a body force to represent the mean pressure gradient.

---

<div class="post-metadata">

### Author: ![ziolai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ziolai/32/23422_2.png) [@ziolai](https://discourse.julialang.org/u/ziolai)
#### Post date: [April 30, 2025, 8:19pm UTC](https://discourse.julialang.org/t/stokes-flow-with-pressure-inlet-conditions/128577/5 "2025-04-30T20:19:39Z")

</div>

Precisely what I am looking for. Many thanks!

Any implementation in Julia?

---

<div class="post-metadata">

### Author: ![aligurbu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aligurbu/32/18088_2.png) [@aligurbu](https://discourse.julialang.org/u/aligurbu)
#### Post date: [May 1, 2025, 4:44am UTC](https://discourse.julialang.org/t/stokes-flow-with-pressure-inlet-conditions/128577/6 "2025-05-01T04:44:29Z")

</div>

For my dissertation project, I implemented a boundary element method analysis of Stokes flow inside a rigid tube in MATLAB. If you’d like to take a look, the link is [here](https://github.com/aligurbu/StokesFlowInRigidTube.m).  
I will, at some point, port this to Julia, but I cannot predict when that will be; hopefully, it will be soon.

---

<div class="post-metadata">

### Author: ![ziolai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ziolai/32/23422_2.png) [@ziolai](https://discourse.julialang.org/u/ziolai)
#### Post date: [May 1, 2025, 10:03am UTC](https://discourse.julialang.org/t/stokes-flow-with-pressure-inlet-conditions/128577/7 "2025-05-01T10:03:24Z")

</div>

Congrats for your thesis! I have a lot of appreciation for people that make BEM codes work.

The tutorial [Incompressible Navier-Stokes equations via DifferentialEquations.jl · Ferrite.jl](https://ferrite-fem.github.io/Ferrite.jl/stable/tutorials/ns_vs_diffeq/) employs BlockArrays to store the finite element pressure-velocity coupled matrix. I imagine that this format allows to form Schur complements and approximations thereof. First experiments with Schur complement preconditioning might therefore be easy to set up.
