Chaste Commit::1fd4e48e3990e67db148bc1bc4cf6991a0049d0c
|
#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 86 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 41 of file PCTwoLevelsBlockDiagonal.cpp.
References PCTwoLevelsBlockDiagonalCreate(), and PCTwoLevelsBlockDiagonalSetUp().
PCTwoLevelsBlockDiagonal::~PCTwoLevelsBlockDiagonal | ( | ) |
Destructor.
Definition at line 47 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::Destroy(), mPCContext, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::PC_amg_A11, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::PC_amg_A22_B1, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::PC_amg_A22_B2, PETSC_DESTROY_PARAM, 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.
|
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 71 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::Destroy(), PetscTools::IsSequential(), mPCContext, mPetscPCObject, PETSC_DESTROY_PARAM, 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().
|
private |
Setups preconditioner.
Definition at line 256 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, PCTwoLevelsBlockDiagonal::PCTwoLevelsBlockDiagonalContext::PC_amg_A22_B2, and PetscTools::SetOption().
Referenced by PCTwoLevelsBlockDiagonal().
PCTwoLevelsBlockDiagonalContext PCTwoLevelsBlockDiagonal::mPCContext |
PC context, this will be passed to PCTwoLevelsBlockDiagonalApply when PETSc returns control to our preconditioner subroutine. See PCShellSetContext().
Definition at line 112 of file PCTwoLevelsBlockDiagonal.hpp.
Referenced by ~PCTwoLevelsBlockDiagonal(), PCTwoLevelsBlockDiagonalCreate(), and PCTwoLevelsBlockDiagonalSetUp().
PC PCTwoLevelsBlockDiagonal::mPetscPCObject |
Generic PETSc preconditioner object
Definition at line 113 of file PCTwoLevelsBlockDiagonal.hpp.
Referenced by PCTwoLevelsBlockDiagonalCreate().