# PETSc Example (navier-stokes-2d-SLEPc-complex.edp)

**URL:** https://community.freefem.org/t/petsc-example-navier-stokes-2d-slepc-complex-edp/1021
**Category:** General Discussion
**Created:** [June 9, 2021, 5:13pm UTC](https://community.freefem.org/t/petsc-example-navier-stokes-2d-slepc-complex-edp/1021 "2021-06-09T17:13:51Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![D\_N\_Sarkar](https://avatars.discourse-cdn.com/v4/letter/d/0ea827/32.png) [@D\_N\_Sarkar](https://community.freefem.org/u/D_N_Sarkar)
#### Post date: [June 9, 2021, 5:13pm UTC](https://community.freefem.org/t/petsc-example-navier-stokes-2d-slepc-complex-edp/1021/1 "2021-06-09T17:13:51Z")

</div>

Dear All,

There is an example " navier-stokes-2d-SLEPc-complex.edp" available on ‘[Examples](https://doc.freefem.org/documentation/petsc/examples.html)’.

The code is available here: [FreeFem-sources/navier-stokes-2d-SLEPc-complex.edp at develop · FreeFem/FreeFem-sources · GitHub](https://github.com/FreeFem/FreeFem-sources/blob/develop/examples/hpddm/navier-stokes-2d-SLEPc-complex.edp).

My doubt is: What is the problem being solved? The governing equations and the boundary conditions? Is there any documentation available for this example problem?

Thank you in advance

Yours sincerely,  
D. N. Sarkar

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [June 10, 2021, 5:10am UTC](https://community.freefem.org/t/petsc-example-navier-stokes-2d-slepc-complex-edp/1021/2 "2021-06-10T05:10:46Z")

</div>

It is exactly the same problem as in [Augmented Lagrangian preconditioner for large-scale hydrodynamic stability analysis - ScienceDirect](https://www.sciencedirect.com/science/article/pii/S0045782519301914), but in 2D instead of 3D.

---

<div class="post-metadata">

### Author: ![D\_N\_Sarkar](https://avatars.discourse-cdn.com/v4/letter/d/0ea827/32.png) [@D\_N\_Sarkar](https://community.freefem.org/u/D_N_Sarkar)
#### Post date: [June 10, 2021, 12:08pm UTC](https://community.freefem.org/t/petsc-example-navier-stokes-2d-slepc-complex-edp/1021/3 "2021-06-10T12:08:32Z")

</div>

Dear Sir,

I read the paper you mentioned. For the paper, the 3D code is available here: [GitHub - prj-/moulin2019al: Augmented Lagrangian Preconditioner for Hydrodynamic Stability Analysis](https://github.com/prj-/moulin2019al).

The 2D problem as mentioned in the above paper is as follows:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/1X/f24db9cab03f048bba2f7014667bf2abcfba0962.png)

As you mentioned “[FreeFem-sources/navier-stokes-2d-SLEPc-complex.edp at develop · FreeFem/FreeFem-sources · GitHub](https://github.com/FreeFem/FreeFem-sources/blob/develop/examples/hpddm/navier-stokes-2d-SLEPc-complex.edp)” is the 2D version of the code.  
**Doubt** : Is this code for the 2D problem of the mentioned journal paper?

In the code “[FreeFem-sources/navier-stokes-2d-SLEPc-complex.edp at develop · FreeFem/FreeFem-sources · GitHub](https://github.com/FreeFem/FreeFem-sources/blob/develop/examples/hpddm/navier-stokes-2d-SLEPc-complex.edp)”, boundaries 1, 2, and 3 are mentioned.  
**Doubt** : Which boundary 1, 2 & 3 corresponds to which boundary of the computation domain like inlet, outlet, top & bottom boundary, etc?

Yours sincerely,  
D N Sarkar

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [June 10, 2021, 12:18pm UTC](https://community.freefem.org/t/petsc-example-navier-stokes-2d-slepc-complex-edp/1021/4 "2021-06-10T12:18:12Z")

</div>

> Is this code for the 2D problem of the mentioned journal paper?

What is not clear in my [previous message](https://community.freefem.org/t/petsc-example-navier-stokes-2d-slepc-complex-edp/1021/2), please? I made a small mistake though, the bluff body is not a plate but a sphere in the 2D case example.

> Which boundary 1, 2 & 3 corresponds to which boundary of the computation domain like inlet, outlet, top & bottom boundary, etc?

You can extract each border and plot them to see which is which.

---

<div class="post-metadata">

### Author: ![D\_N\_Sarkar](https://avatars.discourse-cdn.com/v4/letter/d/0ea827/32.png) [@D\_N\_Sarkar](https://community.freefem.org/u/D_N_Sarkar)
#### Post date: [June 10, 2021, 3:19pm UTC](https://community.freefem.org/t/petsc-example-navier-stokes-2d-slepc-complex-edp/1021/5 "2021-06-10T15:19:45Z")

</div>

Ok.

So the base flow code is “[FreeFem-sources/navier-stokes-2d-PETSc.edp at develop · FreeFem/FreeFem-sources · GitHub](https://github.com/FreeFem/FreeFem-sources/blob/develop/examples/hpddm/navier-stokes-2d-PETSc.edp)”?

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [June 10, 2021, 4:03pm UTC](https://community.freefem.org/t/petsc-example-navier-stokes-2d-slepc-complex-edp/1021/6 "2021-06-10T16:03:04Z")

</div>

That is correct. First run that (\*-PETSc.edp), it will generate output files. Then run the eigenanalysis code (\*-SLEPc-complex.edp). Either in 2D (sphere) or 3D (plate).
