#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 purpouse-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)
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 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 98 of file PCLDUFactorisation.hpp.
PCLDUFactorisation::PCLDUFactorisation | ( | KSP & | rKspObject | ) |
Constructor
rKspObject | KSP object where we want to install the block diagonal preconditioner. |
Definition at line 32 of file PCLDUFactorisation.cpp.
References PCLDUFactorisationCreate(), and PCLDUFactorisationSetUp().
void PCLDUFactorisation::PCLDUFactorisationCreate | ( | KSP & | rKspObject | ) | [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 57 of file PCLDUFactorisation.cpp.
References PetscTools::CreateVec(), mPCContext, and mPetscPCObject.
Referenced by PCLDUFactorisation().
void PCLDUFactorisation::PCLDUFactorisationSetUp | ( | ) | [private] |
Setups preconditioner
Definition at line 119 of file PCLDUFactorisation.cpp.
References PCLDUFactorisation::PCLDUFactorisationContext::A11_matrix_subblock, PCLDUFactorisation::PCLDUFactorisationContext::A22_matrix_subblock, mPCContext, PCLDUFactorisation::PCLDUFactorisationContext::PC_amg_A11, and PCLDUFactorisation::PCLDUFactorisationContext::PC_amg_A22.
Referenced by PCLDUFactorisation().
PC context, this will be passed to PCBlockDiagonalApply when PETSc returns control to our preconditioner subroutine. See PCShellSetContext().
Definition at line 118 of file PCLDUFactorisation.hpp.
Referenced by PCLDUFactorisationCreate(), and PCLDUFactorisationSetUp().
Generic PETSc preconditioner object
Definition at line 119 of file PCLDUFactorisation.hpp.
Referenced by PCLDUFactorisationCreate().