|
|
|
|
|
By default GetDP uses linear solvers from [PETSc](https://www.mcs.anl.gov/petsc). (You can also compile GetDP with alternative linear solvers - see the [GetDP documentation](http://getdp.info/doc/texinfo/getdp.html#Compiling-the-source-code).)
|
|
|
|
|
|
PETSc options can be specified:
|
|
|
* on the command line (e.g. `getdp test.pro -solve -ksp_type cg -pc_type ilu`)
|
|
|
* in the `Resolution` operations, with the `SetGlobalSolverOptions[]` function (e.g. `SetGlobalSolverOptions["-ksp_type gmres -petsc_prealloc 400"];`)
|
|
|
* in a file :
|
|
|
- either as default options in a `.petscrc` file in your home directory
|
|
|
- or in an arbitrary file, specified to getdp with the `-solver` option (e.g. `getdp test.pro -solve -solver "myoptions.txt"`)
|
|
|
|
|
|
Here are some useful PETSc options:
|
|
|
|
|
|
```bash
|
|
|
# To use GMRES+ILU(3) with a relative tolerance of 1e-12 and a restart of 300:
|
|
|
-ksp_rtol 1.e-12
|
|
|
-ksp_type gmres
|
|
|
-ksp_gmres_restart 300
|
|
|
-pc_type ilu
|
|
|
-pc_factor_levels 3
|
|
|
```
|
|
|
|
|
|
```bash
|
|
|
# To use PETSc's built-in direct LU solver
|
|
|
-ksp_type preonly
|
|
|
-pc_type lu
|
|
|
-pc_factor_mat_solver_package petsc
|
|
|
```
|
|
|
|
|
|
```bash
|
|
|
# To use the direct LU solver from UMFPACK
|
|
|
-ksp_type preonly
|
|
|
-pc_type lu
|
|
|
-pc_factor_mat_solver_package umfpack
|
|
|
```
|
|
|
|
|
|
```bash
|
|
|
# To use the direct LU solver from MUMPS
|
|
|
-ksp_type preonly
|
|
|
-pc_type lu
|
|
|
-pc_factor_mat_solver_package mumps
|
|
|
```
|
|
|
|
|
|
```bash
|
|
|
# To preallocate 300 nonzero elements per line in the matrix
|
|
|
-petsc_prealloc 300
|
|
|
```
|
|
|
|
|
|
```bash
|
|
|
# To see the residual
|
|
|
-ksp_monitor
|
|
|
```
|
|
|
|
|
|
```bash
|
|
|
# To use GMRES+Jacobi with a relative tolerance of 1e-12 and a restart of 100:
|
|
|
-ksp_rtol 1.e-12
|
|
|
-ksp_type gmres
|
|
|
-ksp_gmres_restart 100
|
|
|
-pc_type jacobi
|
|
|
-pc_factor_levels 3
|
|
|
``` |