# FSI problem with SLEPc

**URL:** <https://community.freefem.org/t/fsi-problem-with-slepc/4138>\
**Category:** General Discussion\
**Created:** [November 19, 2025, 4:29pm UTC](https://community.freefem.org/t/fsi-problem-with-slepc/4138 "2025-11-19T16:29:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![quentin](https://avatars.discourse-cdn.com/v4/letter/q/e47c2d/32.png) [@quentin](https://community.freefem.org/u/quentin)\
**Post date:** [November 19, 2025, 4:29pm UTC](https://community.freefem.org/t/fsi-problem-with-slepc/4138/1 "2025-11-19T16:29:30Z")

</div>

@prj  
Thanks to your guidance, I’ve completed the initial version of my code. However, I’m facing some persistent issues with its robustness:  
The script isn’t robust enough, it works with `-n 4` but fails with `-n 6` , and sometimes it produces different results even when run multiple times with the same parameters.

For example, if I run the code with`ff-mpirun -n 4 FSI-SLEPc-MWE.edp -wg` multiple times, it gives:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/9/9f2fd0802196e23611997ecccbfabd338b1695b1.png)  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/6/69aec46c31a4d0bd6b0d01a08a1b98fa0da72b1c.png)  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/e/e173961b2cf902e2662b03cc35e5bd08da8e76ef.png)

Apparently, the first one looks better than the others.

I’ve tried debugging it but haven’t been able to identify the root cause. I’m also uncertain if the solver configuration is optimal. I would be very grateful if you could take a look and help me diagnose the problem.  
Here is my code attached:  
[FSI-SLEPc-MWE.edp](https://community.freefem.org/uploads/short-url/fuRSMBAIREU7ymwxCkSAIbU0W2i.edp) (5.4 KB)

---

<div class="post-metadata">

**Author:** ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)\
**Post date:** [November 19, 2025, 5:43pm UTC](https://community.freefem.org/t/fsi-problem-with-slepc/4138/2 "2025-11-19T17:43:39Z")

</div>

A typical case when such variations in the results occur is when the value of a variable is used before it has been affected any value.

---

<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:** [November 19, 2025, 8:39pm UTC](https://community.freefem.org/t/fsi-problem-with-slepc/4138/3 "2025-11-19T20:39:16Z")

</div>

Your code does not run in debug mode, which makes it difficult to… debug.

```auto
CHECK_KN: (k>=0) && ( (k <n) || !step) in file: ./../femlib/RNM.hpp, line 341
  current line = 159 mpirank 3 / 4
Assertion fail : (0)
	line :53, in file ./../femlib/RNM.hpp
 err code 6 , mpirank 3

```

---

<div class="post-metadata">

**Author:** ![quentin](https://avatars.discourse-cdn.com/v4/letter/q/e47c2d/32.png) [@quentin](https://community.freefem.org/u/quentin)\
**Post date:** [November 21, 2025, 6:50am UTC](https://community.freefem.org/t/fsi-problem-with-slepc/4138/4 "2025-11-21T06:50:30Z")

</div>

Thank you for the helpful error report. I have corrected the identified mistake on line 159.

---

<div class="post-metadata">

**Author:** ![quentin](https://avatars.discourse-cdn.com/v4/letter/q/e47c2d/32.png) [@quentin](https://community.freefem.org/u/quentin)\
**Post date:** [November 21, 2025, 7:01am UTC](https://community.freefem.org/t/fsi-problem-with-slepc/4138/5 "2025-11-21T07:01:15Z")

</div>

By the way, I have a question about [restriction-2d-PETSc.edp](https://github.com/FreeFem/FreeFem-sources/blob/develop/examples/hpddm/restriction-2d-PETSc.edp), the parameter `ThGlCond` in line 35 is not declared beforehand; however, the example compiles and runs without issues, so does `ThGlNoCond`. Is this associated with `macro_ddm.idp`?

---

<div class="post-metadata">

**Author:** ![quentin](https://avatars.discourse-cdn.com/v4/letter/q/e47c2d/32.png) [@quentin](https://community.freefem.org/u/quentin)\
**Post date:** [November 21, 2025, 7:11am UTC](https://community.freefem.org/t/fsi-problem-with-slepc/4138/6 "2025-11-21T07:11:16Z")

</div>

It was a mistake that the matrix is built with wrong `fespace`. Surprisingly, it compiled and ran, but produced incorrect results. Occasionally, it even produced “correct” results. I think there might be some non-deterministic behavior in the solver.

---

<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:** [November 21, 2025, 12:59pm UTC](https://community.freefem.org/t/fsi-problem-with-slepc/4138/7 "2025-11-21T12:59:01Z")

</div>

> [@quentin](#):
>
> I think there might be some non-deterministic behavior in the solver.

Not if the problem is well-posed.
