# Error while using sparsesolver or UMFPACK

**URL:** <https://community.freefem.org/t/error-while-using-sparsesolver-or-umfpack/421>\
**Category:** General Discussion\
**Created:** [May 20, 2020, 2:20am UTC](https://community.freefem.org/t/error-while-using-sparsesolver-or-umfpack/421 "2020-05-20T02:20:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![saptarshi](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@saptarshi](https://community.freefem.org/u/saptarshi)\
**Post date:** [May 20, 2020, 2:20am UTC](https://community.freefem.org/t/error-while-using-sparsesolver-or-umfpack/421/1 "2020-05-20T02:20:01Z")

</div>

Hello I am trying to solve a system using the Edge element and the variation form involves complex numbers .  
Some lines of the code :  
**fespace Th( meshName , Edge13d )**  
…  
…  
…  
Th \< complex \> [Ex,Ey,Ez] ;  
…  
…  
…  
solve EQ([Ex,Ey,Ez],[Vx,Vy,Vz],solver = UMFPACK)  
= int3d(Team7)(Nu \* Curl(Ex,Ey,Ez)’ \* Curl(Vx,Vy,Vz) )  
+ int3d(Team7)([Jx, Jy, Jz]’ \* [Vx, Vy, Vz])  
- int3d(Team7)([fx,fy,fz]’ \* [Vx,Vy,Vz])  
+ on(19,18,21,23,20,22,Ex =0 ,Ey = 0,Ez =0);//

The output I am getting is :  
Error umpfack umfpack\_zi\_numeric status -1  
dosolver UMFPACK complex/int 1 0  
Error umfpack\_di\_solve status -3

I would like to ask what does this message imply .

---

<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:** [May 20, 2020, 5:41am UTC](https://community.freefem.org/t/error-while-using-sparsesolver-or-umfpack/421/2 "2020-05-20T05:41:05Z")

</div>

You are solving the indefinite Maxwell equation. Your problem is singular, thus UMFPACK fails.

1. are you sure you meant `int3d(Team7)([Jx, Jy, Jz]' * [Vx, Vy, Vz])` and not `int3d(Team7)([Ex, Ey, Ez]' * [Vx, Vy, Vz])`?
2. if yes, use a better direct solver, like MUMPS, using `load "MUMPS"`
3. you can also use [AMS](https://hypre.readthedocs.io/en/latest/solvers-ams.html), it’s only currently interfaced for lowest-order Nédélec FE right now but I can add higher orders as well, cf. [maxwell-3d-PETSc.edp](https://github.com/FreeFem/FreeFem-sources/blob/develop/examples/hpddm/maxwell-3d-PETSc.edp).

---

<div class="post-metadata">

**Author:** ![saptarshi](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@saptarshi](https://community.freefem.org/u/saptarshi)\
**Post date:** [May 21, 2020, 10:08pm UTC](https://community.freefem.org/t/error-while-using-sparsesolver-or-umfpack/421/3 "2020-05-21T22:08:36Z")

</div>

Dear Sir/Madam .

I really adore and appreciate your effort for getting back to me.Thank a ton ! !

1. Yes I was naively wrong with the variation formulation :

The weak form of the time harmonic Electromagnetic wave equation that I want to solve reads:

f \* v dx = (mu^-1).(curl E) \* (curl v) dx + k^2. (E \* v) dx  
f = -i \* omega \* J  
k^2 = (i \* sigma \* omega) - (eps \* omega^2)

I wrote the variation form which reads :

varf vEMwaveEqn([Ex,Ey,Ez],[Vx,Vy,Vz])  
= int3d(Team7)(Nu \* Curl(Ex,Ey,Ez)’ \* Curl(Vx,Vy,Vz) )

- int3d(Team7)([Ex, Ey, Ez]’ \* [Vx, Vy, Vz])

- int3d(Team7)([fx,fy,fz]’ \* [Vx,Vy,Vz])

- on(4,Ex =0 ,Ey = 0,Ez =0);

//…  
matrix EmWaveEqn = vEMwaveEqn(FeEdge,FeEdge,solver = GMRES) ;  
complex[int] RHS = vEMwaveEqn(0,FeEdge) ;

I solved the values of :  
FeEdge [Jx,Jy,Jz]; // Edge elements has 3 components !

[Jx,Jy,Jz] = Grad(u) \* sigma; //\*(region == 1) ;

FE1 k2 ; // FE1 is P2 element

FeEdge[Ex,Ey,Ez] ; // FeEdge Edge13d element .

After using iterative solvers, or direct solvers my job is getting “Killed” after few minutes in the terminal .  
So I am trying to get some possible answers to the problem.

1. `load "MUMPS" I think it is a plugin and I am trying to install along with PETSc and link it to Freefem++`  
`3.` macro def(i)[i, i#y, i#z]// EOM . Can you please clarify the meaning of" **#**"in Freefem++.

I wanted to write you after I ran your code but I am having some issues with the PETSc installation due to 2 times installation of MPI (I will fix it soon !)  
I would be grateful if you could get back to me.

Regards  
Saptarshi Mandal  
Bergische University of Wuppertal  
Germany

---

<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:** [May 22, 2020, 7:51am UTC](https://community.freefem.org/t/error-while-using-sparsesolver-or-umfpack/421/4 "2020-05-22T07:51:57Z")

</div>

Having two MPI installations is your way to disaster, PETSc or no PETSc. I’d suggest you make a clean install so that you can have all the tools FreeFEM and PETSc have to offer, see the instructions [here](https://github.com/FreeFem/FreeFem-sources/tree/develop#freefem). Regarding your question about macro, please read the [documentation](https://doc.freefem.org/examples/developers.html#macro).

---

<div class="post-metadata">

**Author:** ![saptarshi](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@saptarshi](https://community.freefem.org/u/saptarshi)\
**Post date:** [May 30, 2020, 8:40am UTC](https://community.freefem.org/t/error-while-using-sparsesolver-or-umfpack/421/5 "2020-05-30T08:40:59Z")

</div>

Dear Sir  
Thank you for the suggestion to use the MUMPS solver.In my above mentioned problem MUMPS worked where as other

direct solvers did not.I am wondering why.

---

<div class="post-metadata">

**Author:** ![Qianrui](https://avatars.discourse-cdn.com/v4/letter/q/9fc348/32.png) [@Qianrui](https://community.freefem.org/u/Qianrui)\
**Post date:** [November 27, 2021, 1:35pm UTC](https://community.freefem.org/t/error-while-using-sparsesolver-or-umfpack/421/6 "2021-11-27T13:35:14Z")

</div>

Hi, I have the same problem and would like to ask you how to install the direct solver MUMPS and SuperLU on Freefem++. Your reply would be greatly appreciated.
