# Calculating eigenvalues for the Stokes equations in 3D

**URL:** <https://fenicsproject.discourse.group/t/calculating-eigenvalues-for-the-stokes-equations-in-3d/1804>\
**Category:** Uncategorized\
**Created:** [October 29, 2019, 7:36am UTC](https://fenicsproject.discourse.group/t/calculating-eigenvalues-for-the-stokes-equations-in-3d/1804 "2019-10-29T07:36:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex1](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@alex1](https://fenicsproject.discourse.group/u/alex1)\
**Post date:** [October 29, 2019, 7:36am UTC](https://fenicsproject.discourse.group/t/calculating-eigenvalues-for-the-stokes-equations-in-3d/1804/1 "2019-10-29T07:36:04Z")

</div>

Hello!  
In my project I have to calculate eigenvalues for the three dimensional Stokes equations with Dirichlet boundary conditions. I would like to use FEniCS for this purpose, but I’m not quite sure how to do it correctly. I would be grateful if anyone could share a source code for solving this eigenvalue problem.  
Thank you very much!  
Alex

---

<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 29, 2019, 9:37am UTC](https://fenicsproject.discourse.group/t/calculating-eigenvalues-for-the-stokes-equations-in-3d/1804/2 "2019-10-29T09:37:06Z")

</div>

[https://fenicsproject.org/docs/dolfin/latest/python/demos/eigenvalue/demo\_eigenvalue.py.html](https://fenicsproject.org/docs/dolfin/latest/python/demos/eigenvalue/demo_eigenvalue.py.html)

Just need to remplace the weak form !

---

<div class="post-metadata">

**Author:** ![alex1](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@alex1](https://fenicsproject.discourse.group/u/alex1)\
**Post date:** [October 29, 2019, 1:17pm UTC](https://fenicsproject.discourse.group/t/calculating-eigenvalues-for-the-stokes-equations-in-3d/1804/3 "2019-10-29T13:17:43Z")

</div>

Thibaut, thank you! If I understood you correctly, all I need to do is to change the definition of the bilinear form in this example. But how should I add the divergence-free condition necessary to define the Stokes operator?

---

<div class="post-metadata">

**Author:** ![kamensky](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@kamensky](https://fenicsproject.discourse.group/u/kamensky)\
**Post date:** [October 29, 2019, 1:49pm UTC](https://fenicsproject.discourse.group/t/calculating-eigenvalues-for-the-stokes-equations-in-3d/1804/4 "2019-10-29T13:49:48Z")

</div>

There are numerous formulations for Stokes flow, but the following demo

[https://fenicsproject.org/docs/dolfin/latest/python/demos/stokes-iterative/demo\_stokes-iterative.py.html](https://fenicsproject.org/docs/dolfin/latest/python/demos/stokes-iterative/demo_stokes-iterative.py.html)

provides the bilinear form for using Galerkin’s method with an inf-sup stable pressure–velocity pair (e.g., the Taylor–Hood element from the demo).

---

<div class="post-metadata">

**Author:** ![alex1](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@alex1](https://fenicsproject.discourse.group/u/alex1)\
**Post date:** [October 30, 2019, 9:40am UTC](https://fenicsproject.discourse.group/t/calculating-eigenvalues-for-the-stokes-equations-in-3d/1804/5 "2019-10-30T09:40:55Z")

</div>

David, thank you very much for your help!
