# Default parameters for NonLinearVariationalSolver

**URL:** <https://fenicsproject.discourse.group/t/default-parameters-for-nonlinearvariationalsolver/13609>\
**Category:** Linear Algebra\
**Created:** [February 13, 2024, 10:58pm UTC](https://fenicsproject.discourse.group/t/default-parameters-for-nonlinearvariationalsolver/13609 "2024-02-13T22:58:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![RemDelaporteMathurin](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/remdelaportemathurin/32/4543_2.png) [@RemDelaporteMathurin](https://fenicsproject.discourse.group/u/RemDelaporteMathurin)\
**Post date:** [February 13, 2024, 10:58pm UTC](https://fenicsproject.discourse.group/t/default-parameters-for-nonlinearvariationalsolver/13609/1 "2024-02-13T22:58:30Z")

</div>

Hi all,

I’m looking for the default parameters of the NonLinearVariationalSolver.

I’m running

```python
info(NonlinearVariationalSolver.default_parameters(), True)

```

And get a lot of “default” strings.

I’m mostly looking for the default linear solver and pre-conditioner.

Can anyone point me towards the relevant documentation?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![nate](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/nate/32/17_2.png) [@nate](https://fenicsproject.discourse.group/u/nate)\
**Post date:** [February 13, 2024, 11:08pm UTC](https://fenicsproject.discourse.group/t/default-parameters-for-nonlinearvariationalsolver/13609/2 "2024-02-13T23:08:29Z")

</div>

See, e.g., [Bitbucket](https://bitbucket.org/fenics-project/dolfin/src/946dbd3e268dc20c64778eb5b734941ca5c343e5/dolfin/fem/NonlinearVariationalSolver.h)

See also [Default absolute tolerance and relative tolerance - #2 by nate](https://fenicsproject.discourse.group/t/default-absolute-tolerance-and-relative-tolerance/3829/2)

---

<div class="post-metadata">

**Author:** ![RemDelaporteMathurin](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/remdelaportemathurin/32/4543_2.png) [@RemDelaporteMathurin](https://fenicsproject.discourse.group/u/RemDelaporteMathurin)\
**Post date:** [February 13, 2024, 11:09pm UTC](https://fenicsproject.discourse.group/t/default-parameters-for-nonlinearvariationalsolver/13609/3 "2024-02-13T23:09:36Z")

</div>

Thanks @nate unfortunately, as you can see [here](https://bitbucket.org/fenics-project/dolfin/src/946dbd3e268dc20c64778eb5b734941ca5c343e5/dolfin/nls/NewtonSolver.cpp#lines-52) it still shows “default” for the linear solver.

---

<div class="post-metadata">

**Author:** ![nate](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/nate/32/17_2.png) [@nate](https://fenicsproject.discourse.group/u/nate)\
**Post date:** [February 13, 2024, 11:16pm UTC](https://fenicsproject.discourse.group/t/default-parameters-for-nonlinearvariationalsolver/13609/4 "2024-02-13T23:16:37Z")

</div>

Whoops. Yep. I just realised this after writing. If you dig around in the source you’ll likely find what you’re looking for.

If I remember rightly, old dolfin defaults to umfpack in serial and mumps in parallel, for the linear solve.

---

<div class="post-metadata">

**Author:** ![RemDelaporteMathurin](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/remdelaportemathurin/32/4543_2.png) [@RemDelaporteMathurin](https://fenicsproject.discourse.group/u/RemDelaporteMathurin)\
**Post date:** [February 13, 2024, 11:45pm UTC](https://fenicsproject.discourse.group/t/default-parameters-for-nonlinearvariationalsolver/13609/5 "2024-02-13T23:45:36Z")

</div>

This is what I read here and there yes. No preconditioners by default I suppose then since they don’t use a preconditioner, right?

---

<div class="post-metadata">

**Author:** ![nate](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/nate/32/17_2.png) [@nate](https://fenicsproject.discourse.group/u/nate)\
**Post date:** [February 14, 2024, 2:13am UTC](https://fenicsproject.discourse.group/t/default-parameters-for-nonlinearvariationalsolver/13609/6 "2024-02-14T02:13:14Z")

</div>

If you want to do fancier things with preconditioning your system in conjunction with an iterative solver, I highly recommend migrating to DOLFINx. The [Stokes demo](https://github.com/FEniCS/dolfinx/blob/main/python/demo/demo_stokes.py) is a great place to start.

Otherwise there are some old examples knocking around, e.g.,

[https://bitbucket.org/fenics-project/dolfin/src/master/python/demo/undocumented/elasticity/demo\_elasticity.py](https://bitbucket.org/fenics-project/dolfin/src/master/python/demo/undocumented/elasticity/demo_elasticity.py)

> [@Set krylov linear solver paramters in newton solver](https://fenicsproject.discourse.group/t/set-krylov-linear-solver-paramters-in-newton-solver/1070/9):
>
> Here is a silly example which should only be considered for its syntax. The preconditioner I’ve designed here is deliberately not a good approximation of the Jacobian. import matplotlib.pyplot as plt from dolfin import \* class Problem(NonlinearProblem): def \_\_init\_\_(self, J, J\_pc, F, bcs): self.bilinear\_form = J self.preconditioner\_form = J\_pc self.linear\_form = F self.bcs = bcs NonlinearProblem.\_\_init\_\_(self) def F(self, b, x): pass …
