-
Notifications
You must be signed in to change notification settings - Fork 167
ISSUE 3763: Fix default solver options in documentation #4254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
5a12852
9aa68db
da8d06d
07a1b01
11c22ea
a380e5b
7af93ba
016a3db
96b51de
c7aadf5
6dfb553
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -257,7 +257,7 @@ definite, and therefore can choose the conjugate gradient method, | |
rather than GMRES. | ||
|
||
.. code-block:: python3 | ||
|
||
solve(a == L, solver_parameters={'ksp_type': 'cg'}) | ||
|
||
To change the preconditioner used, we set the ``'pc_type'`` option. | ||
|
@@ -271,17 +271,21 @@ precondition the system with: | |
solver_parameters={'pc_type': 'hypre', | ||
'pc_hypre_type': 'boomeramg'}) | ||
|
||
Although the `KSP` name suggests that only Krylov methods are | ||
supported, this is not the case. We may, for example, solve the | ||
system directly by computing an LU factorisation of the problem. To | ||
Although the ``KSP`` name suggests that only Krylov methods are | ||
supported, this is not the case. We may, for example, solve the | ||
system directly by computing an LU factorisation of the problem. To | ||
do this, we set the ``pc_type`` to ``'lu'`` and tell PETSc to use a | ||
"preconditioner only" Krylov method: | ||
|
||
.. code-block:: python3 | ||
|
||
solve(a == L, | ||
solver_parameters={'ksp_type': 'preonly', | ||
'pc_type': 'lu'}) | ||
solve(a == L, | ||
solver_parameters={ | ||
'mat_type': 'aij', | ||
'ksp_type': 'preonly', | ||
'ksp_rtol': 1e-7, | ||
'pc_type': 'lu' | ||
}) | ||
|
||
In a similar manner, we can use Jacobi preconditioned Richardson | ||
iterations with: | ||
|
@@ -290,7 +294,7 @@ iterations with: | |
|
||
solve(a == L, | ||
solver_parameters={'ksp_type': 'richardson', | ||
'pc_type': 'jacobi'} | ||
'pc_type': 'jacobi'}) | ||
|
||
.. note:: | ||
|
||
|
@@ -728,32 +732,40 @@ solving with. | |
Default solver options | ||
~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
If no parameters are passed to a solve call, we use, in most cases, | ||
|
||
If no parameters are passed to a ``solve`` call, we use, in most cases, | ||
the defaults that PETSc supplies for solving the linear or nonlinear | ||
system. We describe the most commonly modified options (along with | ||
their defaults in Firedrake) here. For linear variational solves we | ||
system. We describe the most commonly modified options (along with | ||
their defaults in Firedrake) here. For linear variational solves we | ||
use: | ||
|
||
* ``ksp_type``: GMRES, with a restart (``ksp_gmres_restart``) of 30 | ||
* ``ksp_rtol``: 1e-7 | ||
* ``ksp_atol``: 1e-50 | ||
* ``ksp_divtol`` 1e4 | ||
* ``ksp_max_it``: 10000 | ||
* ``pc_type``: ILU (Jacobi preconditioning for mixed problems) | ||
* ``mat_type``: ``aij`` | ||
* ``ksp_type``: ``preonly`` | ||
* ``ksp_rtol``: ``1e-7`` | ||
* ``ksp_atol``: ``1e-50`` | ||
* ``ksp_divtol``: ``1e4`` | ||
* ``ksp_max_it``: ``10000`` | ||
Comment on lines
+745
to
+747
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, please make sure the rest of the file is up to date. The options in 753-763 should have:
|
||
* ``pc_type``: ``lu`` | ||
|
||
|
||
For nonlinear variational solves we have: | ||
|
||
* ``snes_type``: Newton linesearch | ||
* ``ksp_type``: GMRES, with a restart (``ksp_gmres_restart``) of 30 | ||
* ``ksp_type``: ``preonly`` | ||
* ``mat_type``: ``aij`` | ||
* ``snes_rtol``: 1e-8 | ||
* ``snes_atol``: 1e-50 | ||
* ``snes_stol``: 1e-8 | ||
* ``snes_max_it``: 50 | ||
* ``snes_type`` : ``newtonls`` | ||
* ``snes_linesearch_type`` : `basic` | ||
* ``ksp_rtol``: 1e-5 | ||
* ``ksp_atol``: 1e-50 | ||
* ``ksp_divtol``: 1e4 | ||
* ``ksp_max_it``: 10000 | ||
* ``pc_type``: ILU (Jacobi preconditioning for mixed problems) | ||
* ``pc_type``: ``lu`` | ||
* ``pc_factor_mat_solver_type`` : ``mumps`` | ||
* ``pc_factor_mat_mumps_icntl_14``: 200 | ||
Comment on lines
+767
to
+768
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These parameters are only relevant if MUMPS is present. Do we want to keep them in the documentation? If so, they should also be included above in the linear solver parameters. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I wait for approval for whether I should update mumps or not? @pbrubeck @connorjward There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have to try quite hard to not have MUMPS installed. I think these options should be documented. |
||
|
||
To see the full view that PETSc has of solver objects, you can pass a | ||
view flag to the solve call. For linear solves pass: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for extra whitespace