# Linear solve did not converge due to DIVERGED\_NANORINF iterations

**URL:** https://community.freefem.org/t/linear-solve-did-not-converge-due-to-diverged-nanorinf-iterations/4127
**Category:** General Discussion
**Created:** [November 5, 2025, 4:13pm UTC](https://community.freefem.org/t/linear-solve-did-not-converge-due-to-diverged-nanorinf-iterations/4127 "2025-11-05T16:13:05Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![zxss](https://avatars.discourse-cdn.com/v4/letter/z/bc8723/32.png) [@zxss](https://community.freefem.org/u/zxss)
#### Post date: [November 5, 2025, 4:13pm UTC](https://community.freefem.org/t/linear-solve-did-not-converge-due-to-diverged-nanorinf-iterations/4127/1 "2025-11-05T16:13:05Z")

</div>

Hi,

I am now implementing 2D fluid structure interaction in parallel. I try to simulate a benchmark: oscillating flag. Here is the code

[ParallelOscillatingFlag.edp](https://community.freefem.org/uploads/short-url/hO6bWtlTiqclanGqIGb5V28nvhc.edp) (5.8 KB)

It works well when I use more than 2 processors (ff-mpirn -n 2 or more). However, there exist a problem when I choose only precossor, says

 ![Screenshot from 2025-11-05 16-11-53](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/e/e446ace14a63afda664eaa08c42faa0e48381146.png)

Does anyone have an idea? Here I directly use ‘lu‘ as my conditioner.

---

<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 5, 2025, 7:17pm UTC](https://community.freefem.org/t/linear-solve-did-not-converge-due-to-diverged-nanorinf-iterations/4127/2 "2025-11-05T19:17:17Z")

</div>

Switch from PETSc to MUMPS for doing the factorization and it will work even with a single process.

---

<div class="post-metadata">

### Author: ![zxss](https://avatars.discourse-cdn.com/v4/letter/z/bc8723/32.png) [@zxss](https://community.freefem.org/u/zxss)
#### Post date: [November 5, 2025, 10:09pm UTC](https://community.freefem.org/t/linear-solve-did-not-converge-due-to-diverged-nanorinf-iterations/4127/3 "2025-11-05T22:09:28Z")

</div>

Thanks, professor.

I am not familiar with MUMPS. I have a few questions.

Do you mean replace “load ‘PETSc’ ‘‘ with “load ‘MUMPS’ ‘‘? Can the distributed mesh and Mat (in PETSc) be still remained in MUMPS. Is there a simple example to start with MUMPS?

---

<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 6, 2025, 5:06am UTC](https://community.freefem.org/t/linear-solve-did-not-converge-due-to-diverged-nanorinf-iterations/4127/4 "2025-11-06T05:06:42Z")

</div>

No, you just need to set the proper `sparams`, it’s in many examples from `examples/hpddm`.

---

<div class="post-metadata">

### Author: ![zxss](https://avatars.discourse-cdn.com/v4/letter/z/bc8723/32.png) [@zxss](https://community.freefem.org/u/zxss)
#### Post date: [November 9, 2025, 12:55pm UTC](https://community.freefem.org/t/linear-solve-did-not-converge-due-to-diverged-nanorinf-iterations/4127/5 "2025-11-09T12:55:04Z")

</div>

Many thanks! It does work even with one processor when I set

> sparams = “-ksp\_type preonly -pc\_type lu -pc\_factor\_mat\_solver\_type mumps”
