#include <PCTwoLevelsBlockDiagonal.hpp>
Classes | |
struct | PCTwoLevelsBlockDiagonalContext |
Public Member Functions | |
PCTwoLevelsBlockDiagonal (KSP &rKspObject, std::vector< PetscInt > &rBathNodes) | |
~PCTwoLevelsBlockDiagonal () | |
Public Attributes | |
PCTwoLevelsBlockDiagonalContext | mPCContext |
PC | mPetscPCObject |
Private Member Functions | |
void | PCTwoLevelsBlockDiagonalCreate (KSP &rKspObject, std::vector< PetscInt > &rBathNodes) |
void | PCTwoLevelsBlockDiagonalSetUp () |
This class defines a PETSc-compliant purpose-build preconditioner.
Let A be a matrix arising in the FEM discretisation of the bidomain equations with the following block structure:
A = (A11 B') (B A22)
By creating an instance of this class, one will define the following preconditioner:
inv(M) = inv( (A11 0) = (inv(A11) 0) (0 A22) ) (0 inv(A22))
The inverses are approximate with one cycle of AMG.
Note: This class requires PETSc to be build including HYPRE library. If it's not available, it will throw the following error:
[0]PETSC ERROR: --------------------- Error Message ------------------------------------ [0]PETSC ERROR: Unknown type. Check for miss-spelling or missing external package needed for type! [0]PETSC ERROR: Unable to find requested PC type hypre!
and will approximate the inverse of the subblocks with PETSc's default preconditioner (bjacobi at the time of writing this).
Definition at line 79 of file PCTwoLevelsBlockDiagonal.hpp.
PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonal | ( | KSP & | rKspObject, | |
std::vector< PetscInt > & | rBathNodes | |||
) |
Constructor.
rKspObject | KSP object where we want to install the block diagonal preconditioner. | |
rBathNodes | a list of nodes defining the bath |
Definition at line 34 of file PCTwoLevelsBlockDiagonal.cpp.
References PCTwoLevelsBlockDiagonalCreate(), and PCTwoLevelsBlockDiagonalSetUp().
PCTwoLevelsBlockDiagonal::~PCTwoLevelsBlockDiagonal | ( | ) |
Destructor.
Definition at line 40 of file PCTwoLevelsBlockDiagonal.cpp.
References PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::A11_matrix_subblock, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::A11_scatter_ctx, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::A22_B1_matrix_subblock, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::A22_B1_scatter_ctx, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::A22_B2_matrix_subblock, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::A22_B2_scatter_ctx, mPCContext, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::PC_amg_A11, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::PC_amg_A22_B1, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::PC_amg_A22_B2, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::x1_subvector, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::x21_subvector, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::x22_subvector, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::y1_subvector, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::y21_subvector, and PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::y22_subvector.
void PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalCreate | ( | KSP & | rKspObject, | |
std::vector< PetscInt > & | rBathNodes | |||
) | [private] |
Creates all the state data required by the preconditioner.
rKspObject | KSP object where we want to install the block diagonal preconditioner. | |
rBathNodes | a list of nodes defining the bath |
Definition at line 64 of file PCTwoLevelsBlockDiagonal.cpp.
References PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::A11_matrix_subblock, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::A11_scatter_ctx, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::A22_B1_matrix_subblock, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::A22_B1_scatter_ctx, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::A22_B2_matrix_subblock, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::A22_B2_scatter_ctx, PetscTools::CreateVec(), PetscTools::IsSequential(), mPCContext, mPetscPCObject, TERMINATE, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::x1_subvector, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::x21_subvector, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::x22_subvector, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::y1_subvector, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::y21_subvector, and PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::y22_subvector.
Referenced by PCTwoLevelsBlockDiagonal().
void PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalSetUp | ( | ) | [private] |
Setups preconditioner.
Definition at line 241 of file PCTwoLevelsBlockDiagonal.cpp.
References PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::A11_matrix_subblock, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::A22_B1_matrix_subblock, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::A22_B2_matrix_subblock, mPCContext, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::PC_amg_A11, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::PC_amg_A22_B1, and PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::PC_amg_A22_B2.
Referenced by PCTwoLevelsBlockDiagonal().
PC context, this will be passed to PCTwoLevelsBlockDiagonalApply when PETSc returns control to our preconditioner subroutine. See PCShellSetContext().
Definition at line 105 of file PCTwoLevelsBlockDiagonal.hpp.
Referenced by PCTwoLevelsBlockDiagonalCreate(), PCTwoLevelsBlockDiagonalSetUp(), and ~PCTwoLevelsBlockDiagonal().
Generic PETSc preconditioner object
Definition at line 106 of file PCTwoLevelsBlockDiagonal.hpp.
Referenced by PCTwoLevelsBlockDiagonalCreate().