libmesh
libmesh copied to clipboard
Enable preconditioner reuse between nonlinear solves
Petsc supports reusing the preconditioner between iterations in a nonlinear solve and even in between multiple timesteps (i.e. repeat calls to solve a new nonlinear system using the same SNES instance) with SNESSetLagPreconditioner
and SNESSetLagPreconditionerPersists. Some testing in MOOSE in tensor_mechanics and associate apps suggests that for runs using a full Newton solve and using a direct solve for the linearized equations we can save 10x the computational work or more by reusing the factorized equations from past iterations/timesteps as a preconditioner for GMRES.
It would be nice to enable preconditioner reuse in PetscNonlinearSolver. One annoyance is that the current implementation clears and releases the SNES instance in between nonlinear solves (though the PetscNonlinearSolver is kept around in MOOSE). If you release the SNES instance you lose your preconditioner, so some refactoring is going to be required to enable this.