Skip to content

Commit 3fd11dd

Browse files
connorjwardtcalderon-spacepbrubeck
committed
Document solver options (#4434)
--------- Co-authored-by: tcalderon-space <littlemelody_is_cool@yahoo.com> Co-authored-by: Pablo Brubeck <brubeck@protonmail.com>
1 parent 6b3c173 commit 3fd11dd

File tree

2 files changed

+19
-28
lines changed

2 files changed

+19
-28
lines changed

docs/source/solving-interface.rst

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,9 @@ precondition the system with:
271271
solver_parameters={'pc_type': 'hypre',
272272
'pc_hypre_type': 'boomeramg'})
273273
274-
Although the `KSP` name suggests that only Krylov methods are
275-
supported, this is not the case. We may, for example, solve the
276-
system directly by computing an LU factorisation of the problem. To
274+
Although the ``KSP`` name suggests that only Krylov methods are
275+
supported, this is not the case. We may, for example, solve the
276+
system directly by computing an LU factorisation of the problem. To
277277
do this, we set the ``pc_type`` to ``'lu'`` and tell PETSc to use a
278278
"preconditioner only" Krylov method:
279279

@@ -290,7 +290,7 @@ iterations with:
290290
291291
solve(a == L,
292292
solver_parameters={'ksp_type': 'richardson',
293-
'pc_type': 'jacobi'}
293+
'pc_type': 'jacobi'})
294294
295295
.. note::
296296

@@ -728,32 +728,23 @@ solving with.
728728
Default solver options
729729
~~~~~~~~~~~~~~~~~~~~~~
730730

731-
If no parameters are passed to a solve call, we use, in most cases,
731+
If no parameters are passed to a ``solve`` call, we use, in most cases,
732732
the defaults that PETSc supplies for solving the linear or nonlinear
733-
system. We describe the most commonly modified options (along with
734-
their defaults in Firedrake) here. For linear variational solves we
733+
system. We describe the most commonly modified options (along with
734+
their defaults in Firedrake) here. For linear variational solves we
735735
use:
736736

737-
* ``ksp_type``: GMRES, with a restart (``ksp_gmres_restart``) of 30
738-
* ``ksp_rtol``: 1e-7
739-
* ``ksp_atol``: 1e-50
740-
* ``ksp_divtol`` 1e4
741-
* ``ksp_max_it``: 10000
742-
* ``pc_type``: ILU (Jacobi preconditioning for mixed problems)
743-
744-
For nonlinear variational solves we have:
745-
746-
* ``snes_type``: Newton linesearch
747-
* ``ksp_type``: GMRES, with a restart (``ksp_gmres_restart``) of 30
748-
* ``snes_rtol``: 1e-8
749-
* ``snes_atol``: 1e-50
750-
* ``snes_stol``: 1e-8
751-
* ``snes_max_it``: 50
752-
* ``ksp_rtol``: 1e-5
753-
* ``ksp_atol``: 1e-50
754-
* ``ksp_divtol``: 1e4
755-
* ``ksp_max_it``: 10000
756-
* ``pc_type``: ILU (Jacobi preconditioning for mixed problems)
737+
* ``mat_type``: ``aij``
738+
* ``ksp_type``: ``preonly``
739+
* ``ksp_rtol``: ``1e-7``
740+
* ``pc_type``: ``lu``
741+
* ``pc_factor_mat_solver_type`` : ``mumps``
742+
* ``pc_factor_mat_mumps_icntl_14``: 200
743+
744+
For nonlinear variational solves we additionally have:
745+
746+
* ``snes_type`` : ``newtonls``
747+
* ``snes_linesearch_type`` : ``basic``
757748

758749
To see the full view that PETSc has of solver objects, you can pass a
759750
view flag to the solve call. For linear solves pass:

firedrake/petsc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def garbage_view(obj: Any):
440440
_DEFAULT_SNES_PARAMETERS = {
441441
"snes_type": "newtonls",
442442
"snes_linesearch_type": "basic",
443-
# Really we want **DEFAULT_KSP_PARAMETERS in here, but it isn't the way the NonlinearVariationalSovler class works
443+
# Really we want **DEFAULT_KSP_PARAMETERS in here, but it isn't the way the NonlinearVariationalSolver class works
444444
}
445445
# We also want looser KSP tolerances for non-linear solves
446446
# DEFAULT_SNES_PARAMETERS["ksp_rtol"] = 1e-5

0 commit comments

Comments
 (0)