![]() |
Chaste Commit::333233612e3dcc941d260418acd7b5ccdc30390e
|
#include <PCLDUFactorisation.hpp>
Classes | |
struct | PCLDUFactorisationContext |
Public Member Functions | |
PCLDUFactorisation (KSP &rKspObject) | |
Public Attributes | |
PCLDUFactorisationContext | mPCContext |
PC | mPetscPCObject |
Private Member Functions | |
void | PCLDUFactorisationCreate (KSP &rKspObject) |
void | PCLDUFactorisationSetUp () |
This class defines a PETSc-compliant purpose-built 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)
Let A=LDU be the following matrix factorisation
LDU = (I 0)(A11 0)(I inv(A11)B') (B*A11' I)(0 S)(0 I)
with I the identity matrix and S=A22-B*inv(A11)*B'
Let inv(A) be a preconditioner
inv(A) = inv(U)inv(D)inv(L) = (I -inv(A11)B')(inv(A11) 0)(I 0) (0 I)(0 inv(S))(-B*inv(A11) I)
This class implements an approximation of inv(A) where S=A22
inv(P) ~ inv(A)
inv(P) = (I -inv(A11)B')(inv(A11) 0)(I 0) (0 I)(0 inv(S=A22))(-B*inv(A11) I)
inv(P) = (inv(A11) -inv(A11)B'inv(S=A22))(I 0) (0 inv(S=A22))(-B*inv(A11) I)
In order to compute [y1 y2]' = inv(P)[x1 x2]' we do
z = inv(A11)*x1 y2 = inv(A22)*(x2 - B*z) y1 = z - inv(A11)(B*y2)
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 show the following warning: Chaste warning: in file linalg/src/PCLDUFactorisation.cpp at line ???: PETSc HYPRE preconditioning library is not installed and will approximate the inverse of the subblocks with PETSc's default preconditioner (bjacobi at the time of writing this).
Definition at line 107 of file PCLDUFactorisation.hpp.
PCLDUFactorisation::PCLDUFactorisation | ( | KSP & | rKspObject | ) |
Constructor.
rKspObject | KSP object where we want to install the block diagonal preconditioner. |
Definition at line 47 of file PCLDUFactorisation.cpp.
References mPCContext, PCLDUFactorisationCreate(), and PCLDUFactorisationSetUp().
PCLDUFactorisation::~PCLDUFactorisation | ( | ) |
Definition at line 60 of file PCLDUFactorisation.cpp.
|
private |
Creates all the state data required by the preconditioner.
rKspObject | KSP object where we want to install the block diagonal preconditioner. |
Definition at line 92 of file PCLDUFactorisation.cpp.
References PCLDUFactorisation::PCLDUFactorisationContext::A11_matrix_subblock, PCLDUFactorisation::PCLDUFactorisationContext::A11_scatter_ctx, PCLDUFactorisation::PCLDUFactorisationContext::A22_matrix_subblock, PCLDUFactorisation::PCLDUFactorisationContext::A22_scatter_ctx, PCLDUFactorisation::PCLDUFactorisationContext::B_matrix_subblock, PetscTools::CreateVec(), PetscTools::Destroy(), mPCContext, mPetscPCObject, PETSC_DESTROY_PARAM, PetscVecTools::SetupInterleavedVectorScatterGather(), PCLDUFactorisation::PCLDUFactorisationContext::temp, TERMINATE, PCLDUFactorisation::PCLDUFactorisationContext::x1_subvector, PCLDUFactorisation::PCLDUFactorisationContext::x2_subvector, PCLDUFactorisation::PCLDUFactorisationContext::y1_subvector, PCLDUFactorisation::PCLDUFactorisationContext::y2_subvector, and PCLDUFactorisation::PCLDUFactorisationContext::z.
Referenced by PCLDUFactorisation().
|
private |
Setups preconditioner.
Definition at line 244 of file PCLDUFactorisation.cpp.
References PCLDUFactorisation::PCLDUFactorisationContext::A11_matrix_subblock, PCLDUFactorisation::PCLDUFactorisationContext::A22_matrix_subblock, mPCContext, PCLDUFactorisation::PCLDUFactorisationContext::PC_amg_A11, PCLDUFactorisation::PCLDUFactorisationContext::PC_amg_A22, and PetscTools::SetOption().
Referenced by PCLDUFactorisation().
PCLDUFactorisationContext PCLDUFactorisation::mPCContext |
PC context, this will be passed to PCBlockDiagonalApply when PETSc returns control to our preconditioner subroutine. See PCShellSetContext().
Definition at line 138 of file PCLDUFactorisation.hpp.
Referenced by PCLDUFactorisation(), PCLDUFactorisationCreate(), and PCLDUFactorisationSetUp().
PC PCLDUFactorisation::mPetscPCObject |
Generic PETSc preconditioner object
Definition at line 139 of file PCLDUFactorisation.hpp.
Referenced by PCLDUFactorisationCreate().