Skip to content

Preconditioners

preconditioners

This module contains classes that augment default Firedrake preconditioners.

FreeSurfaceMassInvPC

Bases: MassInvPC

Version of MassInvPC that includes free surface variables.

SPDAssembledPC

Bases: AssembledPC

Version of AssembledPC that sets the SPD flag for the matrix.

For use in the velocity fieldsplit_0 block in combination with gamg. Setting PETSc MatOption MAT_SPD (for Symmetric Positive Definite matrices) at the moment only changes the Krylov method for the eigenvalue estimate in the Chebyshev smoothers to CG.

Users can provide this class as a pc_python_type entry to a PETSc solver option dictionary.

initialize(pc)

Initialises the preconditioner.

Parameters:

Name Type Description Default
pc PC

PETSc preconditioner.

required
Source code in g-adopt/gadopt/preconditioners.py
41
42
43
44
45
46
47
48
49
def initialize(self, pc: PETSc.PC):
    """Initialises the preconditioner.

    Args:
      pc: PETSc preconditioner.
    """
    super().initialize(pc)
    mat = self.P.petscmat
    mat.setOption(mat.Option.SPD, True)