Skip to content

Preconditioners

preconditioners

This module contains a class that augments a matrix preconditioner by setting the symmetric-positive-definite option. Users can provide this class as a pc_python_type entry to a PETSc solver option dictionary.

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.

initialize(pc)

Initialises the preconditioner.

Parameters:

Name Type Description Default
pc PC

PETSc preconditioner.

required
Source code in g-adopt/gadopt/preconditioners.py
20
21
22
23
24
25
26
27
28
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)