Newton Solver fails with "UmfpackInverse not available"

Hi everyone,

I want to use the implemented Newton, but I cant get it to work.
Based on 3.3 Nonlinear problems — NGS-Py 6.2.2305 documentation I run the following minimal example:

import ngsolve as ng
import netgen.occ as oc
shape = oc.Rectangle(1,1).Face()
geom = oc.OCCGeometry(shape, dim=2)
mesh = ng.Mesh(geom.GenerateMesh(maxh=0.3))

V = ng.H1(mesh, order=3, dirichlet=[1,2,3,4])
u,v = V.TnT()
a = ng.BilinearForm(V)
a += (ng.grad(u) * ng.grad(v) + 1/3*u**3*v- 10 * v)*ng.dx

gfu = ng.GridFunction(V)
gfu.Set((ng.x*(1-ng.x))**4*(ng.y*(1-ng.y))**4) # initial guess


NgException                               Traceback (most recent call last)
/home/ngsolve/newton.ipynb Cell 1 line 1
     17 gfu = ng.GridFunction(V)
     18 gfu.Set((ng.x*(1-ng.x))**4*(ng.y*(1-ng.y))**4) # initial guess
---> 19 ng.solvers.Newton(a,gfu,,maxit=100,maxerr=1e-11,inverse="umfpack",dampfactor=1,printing=True)

File ~/.local/lib/python3.10/site-packages/ngsolve/, in Newton(a, u, freedofs, maxit, maxerr, inverse, dirichletvalues, dampfactor, printing, callback)
    134 if dirichletvalues is not None:
    135     solver.SetDirichlet(dirichletvalues)
--> 136 return solver.Solve(maxit=maxit, maxerr=maxerr,
    137                     dampfactor=dampfactor,
    138                     printing=printing,
    139                     callback=callback,
    140                     linesearch=False,
    141                     printenergy=False)

File ~/.local/lib/python3.10/site-packages/ngsolve/, in TimeFunction.<locals>.retfunc(*args, **kwargs)
    160 def retfunc(*args,**kwargs):
    161     with timer:
--> 162         ret = func(*args, **kwargs)
    163     return ret

File ~/.local/lib/python3.10/site-packages/ngsolve/, in NewtonSolver.Solve(self, maxit, maxerr, dampfactor, printing, callback, linesearch, printenergy, print_wrong_direction)
     34 a.AssembleLinearization(u.vec)
     35 a.Apply(u.vec, r)
---> 37 self._UpdateInverse()
     38 if self.rhs is not None:
     39 -= self.rhs.vec

File ~/.local/lib/python3.10/site-packages/ngsolve/, in NewtonSolver._UpdateInverse(self)
     90     self.inv.Update()
     91 else:
---> 92     self.inv = self.a.mat.Inverse(self.freedofs,
     93                                   inverse=self.inverse)

NgException: SparseMatrix::InverseMatrix:  UmfpackInverse not available

There is probably something I overlooked, but I cant find it.
Help would be very appreciated!

how did you install NGSolve? it seems you do not have umfpack installed on your system. try changing “umfpack” in your code to “pardiso”

I just installed via pip.
Can you tell me how I can change this?

inverse="umfpack" to inverse="pardiso" in your last line.

1 Like

There are a wide range of non-linear solvers in PETSc SNES that are accessible via ngsPETSc. You should be able to use Newton with trust region and UMFPACK, PARDISO or MUMPS to compute the inverse of your jacobian.
Here are some examples:

1 Like