By default GetDP uses linear solvers from PETSc. (You can also compile GetDP with alternative linear solvers - see the GetDP documentation.) The choice of which particular linear solver to use for a given problem is handled directly through PETSc options, which can be specified:
- on the command line (e.g.
getdp test.pro -solve -ksp_type cg -pc_type ilu
) - in the
Resolution
operations, with theSetGlobalSolverOptions[]
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"
)
- either as default options in a
Here are some useful PETSc options:
# 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
# To use PETSc's built-in direct LU solver
-ksp_type preonly
-pc_type lu
-pc_factor_mat_solver_package petsc
# To use the direct LU solver from UMFPACK
-ksp_type preonly
-pc_type lu
-pc_factor_mat_solver_package umfpack
# To use the direct LU solver from MUMPS
-ksp_type preonly
-pc_type lu
-pc_factor_mat_solver_package mumps
# To preallocate 300 nonzero elements per line in the matrix
-petsc_prealloc 300
# To see the residual
-ksp_monitor
# 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