# Navier-Stokes linear stability analysis

**URL:** <https://fenicsproject.discourse.group/t/navier-stokes-linear-stability-analysis/1796>\
**Category:** Linear Algebra\
**Created:** [October 28, 2019, 2:27pm UTC](https://fenicsproject.discourse.group/t/navier-stokes-linear-stability-analysis/1796 "2019-10-28T14:27:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thibaut](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/thibaut/32/558_2.png) [@Thibaut](https://fenicsproject.discourse.group/u/Thibaut)\
**Post date:** [October 28, 2019, 2:27pm UTC](https://fenicsproject.discourse.group/t/navier-stokes-linear-stability-analysis/1796/1 "2019-10-28T14:27:47Z")

</div>

Hi there !

I’m trying to implement a linear stability module in my Navier-Stokes code with no sucess so far. My idea was to take advantage of the “derivative” function to compute the jacobian then solve the eigenvalue problem.

So far I have something like that:

> ```
> wbf = Function(space)
> ubf, pbf = split(wbf)
> v, q = TestFunctions(space)
> 
> Fs = (nu * inner(grad(ubf), grad(v))\
> + dot(dot(grad(ubf), ubf), v)\
> - pbf * div(v)\
> - q * div(ubf)\
> - dot(f, v)) * dx
> 
> ```

I solve this steady problem for a given nu, then I calculate the jacobian applied to the baseflow previously calculated (is the derivative function doing that?):

> ```
> Js = derivative(Fs, wbf)
> Js = assemble(Js)
> 
> ```

Then I have two options, use dolfin.SLEPcEigenSolver or export my matrix and do the calculation later.

1. ~~If I use dolfin.SLEPcEigenSolver how to specify that I want to solve a complex eigenvalue problem, even though the matrix is real?~~ Looks like it’s looking for complex eigenvalues by default.

2. For now I’m exporting the matrix and converting it to a complex one while reading it. Then I solve the eigenvalue problem.

3. ~~In both case, should I impose Dirichlet BC egal to zero everywhere except at the outflow?~~ (answered myself, Yes in order to have a proper weak form obviously) If yes does Js.apply(BC) do the thing?

I don’t have any MWE but if you need one I will implement one quickly.

EDIT : Most of the code is working properly now but my eigenvalues are not what expected. Do anyone has references for Linear Stability Analisys theory in the case of PDE ?

Thank you for your help ! 😃
