Correct way to use PETScOptions for mumps?


I am using NewtonSolver along with mumps as the linear solver like this:

ns = NewtonSolver()
ns['linear_solver'] = 'mumps'

Now I want to tune the parameters like mat_mumps_icntl_14, so I did the following after reading some old posts

PETScOptions.set('mat_mumps_icntl_14', 40)
PETScOptions.set('mat_mumps_icntl_35', 2)
PETScOptions.set('mat_mumps_icntl_36', 1)

But nothing really changes (runtime, memory use, etc), but supposedly, at least the latter two should effectively reduce operations (by sacrificing accuracy). Am I missing something, or is this just how it is?

Thanks for any suggestions!

The following excerpt works for me in the context of a different problem:

problem = NonlinearVariationalProblem(F,w,bcs,J=derivative(F,w))
solver = NonlinearVariationalSolver(problem)
solver.parameters['newton_solver']['linear_solver'] = 'mumps'

In this example, F is the residual for a saddle point problem (which I’ve left out for clarity), and MUMPS fails if I comment the first line, so the option is clearly being applied.

1 Like

Just saw the reply. I decided to go directly with PETSc to avoid the ambiguity from the dolfin wrappers:

from petsc4py import PETSc
PETSc.Options()['mat_mumps_icntl_35'] = 1

It seems to work.

Thanks anyways