Eigenvalue problem (Navier-Stokes Inf-Sup condition)

Hello to the community,

I am trying to compute the inf-sup condition of the Navier-Stokes equations.
For this I need to define the operator Tp given a pressure p as the solution to the following, call this equation [1],

inner(v, Tp) * dx + inner(grad(v), grad(Tp)) * dx = inner(p, div(v)) * dx

Given an arbitrary pressure p I can solve this easily with,

from fenics import *

# Define mesh and function spaces
mesh = UnitSquareMesh(16, 16)
V = VectorFunctionSpace(mesh, 'Lagrange', 2)
Q = FunctionSpace(mesh, 'Lagrange', 1)
inflow  = 'near(x[0], 0) && (x[1]>3.5/5 && x[1]<4.5/5)'
outflow = 'near(x[1], 0) && (x[0]>3.5/5 && x[0]<4.5/5)'
walls   = 'near(x[0], 1) || near(x[1], 1) || (near(x[1],0) && (x[0]<=3.5/5 || x[0]>=4.5/5)) || (near(x[0],0) && (x[1]<=3.5/5 || x[1]>=4.5/5))'
stab_bdc = [DirichletBC(V, Constant((0, 0)), walls),
                DirichletBC(V, Constant((0, 0)), inflow),
                DirichletBC(V, Constant((0, 0)), outflow)
                ]

# Define trial and test functions
v = TestFunction(V)
z = TrialFunction(V)
p = Function(Q)#Replace with your pressure of choice

# Tq solution to:
Tp_lhs = inner(v, z) * dx + inner(grad(v), grad(z)) * dx
Tp_rhs = inner(p, div(v)) * dx

# Solve the variational problem
Tp = Function(V)
solve(Tp_lhs == Tp_rhs, Tp,bcs=stab_bdc))

Now I am interested in the inf-sup condition.
To get the Inf-Sup condition I need to find the smallest eigenvalue satisfying the problem:

inner(Tq,Ttheta) * dx + inner(grad(Tq), grad(Ttheta)) * dx = lambda inner(q,theta)

where theta is the eigenvector corresponding to the eigenvalue lambda and q is the Testfunction in Q. Tq and Ttheta are solutions to equation [1] corresponding to q and theta.

I understand there is an eigenproblem solver in fenics, SLEPcEigenSolver, but I do not see how I can use it in this case, especially with the left hand-side I have.

I have a similar example in

(function run_monolithic)

Keep in mind that you don’t need the implementation of

(function run_block)

However, even to run function run_monolithic you would still need to install multiphenics, because (even though it’s hidden by the star import in from multiphenics import *) the SLEPcEigenSolver used there is the one from multiphenics, not from dolfin. The main difference between the two is that the eigensolver from multiphenics accepts a third input argument related to boundary conditions, that is used to throw away degrees of freedom associated with Dirichlet boundary conditions.

There may be tutorials in plain dolfin about this, but I don’t have any around. Installing multiphenics shouldn’t be too hard, as it is pip installable (even though it surely is an overkill just for this task).

Thank you for the answer, I do have two questions however.
How can the inf-sup condition be strictly less than 0, is it not the dual norm of the pressure operator ?
Is there a description of the mathematics behind it? I have seen two inf-sup conditions being used.
In LaTeX notation :

\inf_{q\in P} \sup_{v\in V}\frac{a_p(q,v)}{||v||||q||}

with

a_p(p,v) = int_{\domain} q \nabla \cdot v dx 

which needs to be satisfied to avoid pressure instabilities (Some spaces satisfy this by default).
And

\inf_{w \in W} \sup_{v \in W} \frac{r_s(s,w,v)}{\norm{w} \norm{v}},

with r_s the derivative in the state (i.e. velocity and pressure) of the navier stokes equations,

r_s(s,w,v) = \int_\domain \nabla u^v : \nabla u^w
+ (Re (u^s \cdot \nabla)u^v) \cdot u^{w}
+ (Re (u^v \cdot \nabla)u^s)) \cdot u^{w}
- p^v \nabla \cdot u^{w}  + p^w \nabla \cdot u^v dx

used in some reduced order modelling error bounds.
I think the above references the second one and not the first.
The issue with the first is that there are these Tq and Ttheta terms which are the solutions to some other equation, and I don’t know how to write this in fenics.

How can the inf-sup condition be strictly less than 0

Hopefully, it will not be. Did I write in the tutorial that it is less than zero :O?

\inf_{q\in P} \sup_{v\in V}\frac{a_p(q,v)}{||v||}

That is certainly wrong, there is ||p|| missing at the denominator. Without that, you can let p go to zero and get an arbitrarily small inf-sup constant, regardless of the function spaces v and q live in.

used in some reduced order modelling error bounds.

That is my research field, but it is impractical to discuss this in discourse. Please get in touch with me via email and maybe we can a zoom/teams call.

To get the Inf-Sup condition I need to find the smallest eigenvalue satisfying the problem:
inner(Tq,Ttheta) * dx + inner(grad(Tq), grad(Ttheta)) * dx = lambda inner(q,theta)

Tq is called supremizer, at least in the reduced order modelling community I come from. See for instance doi:10.1002/nme.4772 (disclaimer: I am the author of that publication).
While what you mention is equivalent, that’s not how I would compute it in practice.

No, the assertion was the constant was strictly greater than 0, which I now realize is in fact the best way of checking that it is non-zero.

Yes, I corrected it now.

Agreed, I just wanted to provide some context. Thank you for the offer, I think may contact to you via email soon then if that works with you.

Ah, I wasn’t sure if those formulations were equivalent.