Preconditioners and linear solvers
MOOSE allows users to utilise the full power of the PETSc preconditioners and linear solvers. The following choices have been found to be effective for various types of PorousFlow simulations.
pc_type = lu, pc_factor_mat_solver_package = mumps
(the most robust choice)pc_type = bjacobi, ksp_type = bcgs
pc_type = bjacobi, ksp_type = gmres
pc_type = asm, pc_asm_overlap = 2, sub_pc_type = lu, sub_pc_factor_shift_type = NONZERO, ksp_type = gmres
pc_type = asm, pc_asm_overlap = 2, sub_pc_type = lu, sub_pc_factor_shift_type = NONZERO, ksp_type = gmres
along with the following options-ksp_diagonal_scale -ksp_diagonal_scale_fix -ksp_gmres_modifiedgramschmidt
These options can be set in the Preconditioning
block in the input file
Example of using solver options
[Preconditioning<<<{"href": "../../syntax/Preconditioning/index.html"}>>>]
[andy]
type = SMP<<<{"description": "Single matrix preconditioner (SMP) builds a preconditioner using user defined off-diagonal parts of the Jacobian.", "href": "../../source/preconditioners/SingleMatrixPreconditioner.html"}>>>
full<<<{"description": "Set to true if you want the full set of couplings between variables simply for convenience so you don't have to set every off_diag_row and off_diag_column combination."}>>> = true
petsc_options<<<{"description": "Singleton PETSc options"}>>> = '-snes_converged_reason'
petsc_options_iname<<<{"description": "Names of PETSc name/value pairs"}>>> = '-ksp_type -pc_type -sub_pc_type -snes_max_it -sub_pc_factor_shift_type -pc_asm_overlap -snes_atol -snes_rtol '
petsc_options_value<<<{"description": "Values of PETSc name/value pairs (must correspond with \"petsc_options_iname\""}>>> = 'gmres asm lu 100 NONZERO 2 1E-14 1E-12'
[]
[]
(modules/porous_flow/test/tests/newton_cooling/nc04.i)The "mumps" method is usually superior to the "asm + LU" method, but isn't always installed on all computer systems. Increasing the pc_asm_overlap
improves the strength of the preconditioner, but uses a huge amount of memory. The NONZERO
shifting helps reduce problems when the diagonal of the Jacobian contains zeroes.