AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM > Class Template Reference

#include <AbstractBidomainSolver.hpp>

Inheritance diagram for AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >:

Inheritance graph
[legend]
Collaboration diagram for AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 AbstractBidomainSolver (bool bathSimulation, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh, BidomainTissue< SPACE_DIM > *pTissue, BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, 2 > *pBoundaryConditions, unsigned numQuadPoints=2)
virtual ~AbstractBidomainSolver ()
void SetFixedExtracellularPotentialNodes (std::vector< unsigned > fixedExtracellularPotentialNodes)
void SetRowForAverageOfPhiZeroed (unsigned rowMeanPhiEZero)
BoundaryConditionsContainer
< ELEMENT_DIM, SPACE_DIM, 2 > * 
GetBoundaryConditions ()
void ResetBoundaryConditionsContainer (BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, 2 > *pBcc)

Protected Member Functions

void InitialiseForSolve (Vec initialSolution)
virtual void CheckCompatibilityCondition ()
void PrepareForSetupLinearSystem (Vec existingSolution)
virtual void FinaliseLinearSystem (Vec existingSolution)
virtual Vec GenerateNullBasis () const
void FinaliseForBath (bool computeMatrix, bool computeVector)

Protected Attributes

bool mBathSimulation
BidomainTissue< SPACE_DIM > * mpBidomainTissue
BoundaryConditionsContainer
< ELEMENT_DIM, SPACE_DIM, 2 > * 
mpBoundaryConditions
BidomainAssembler< ELEMENT_DIM,
SPACE_DIM > * 
mpBidomainAssembler
unsigned mNumQuadPoints
bool mNullSpaceCreated
HeartConfigmpConfig
std::vector< unsigned > mFixedExtracellularPotentialNodes
unsigned mRowForAverageOfPhiZeroed


Detailed Description

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
class AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >

Abstract Bidomain class containing some common functionality Inherits from AbstractDynamicLinearPdeSolver so child classes must implement SetupLinearSystem()

Definition at line 43 of file AbstractBidomainSolver.hpp.


Constructor & Destructor Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::AbstractBidomainSolver ( bool  bathSimulation,
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *  pMesh,
BidomainTissue< SPACE_DIM > *  pTissue,
BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, 2 > *  pBoundaryConditions,
unsigned  numQuadPoints = 2 
) [inline]

Constructor

Parameters:
bathSimulation whether the simulation has a perfusing bath
pMesh pointer to the mesh
pTissue pointer to the tissue
pBoundaryConditions pointer to the boundary conditions container
numQuadPoints number of Gaussian quadrature points in each dimension

Definition at line 242 of file AbstractBidomainSolver.cpp.

References HeartConfig::Instance(), AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, 2 >::mMatrixIsConstant, AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mNullSpaceCreated, AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mpBidomainAssembler, AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mpConfig, and AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mRowForAverageOfPhiZeroed.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::~AbstractBidomainSolver (  )  [inline, virtual]


Member Function Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::InitialiseForSolve ( Vec  initialSolution  )  [inline, protected, virtual]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::CheckCompatibilityCondition (  )  [inline, protected, virtual]

Checks whether the linear system will have a solution (if so, infinite solutions) instead of zero solutions. The condition is, if the linear system is Ax=b, that sum b_i over for all the PHI_E components (ie i=1,3,5,..) is zero.

This check is not made if running in parallel, or in debug mode.

The reason why the sum must be zero: the Fredholm alternative states that a singular system Ax=b has a solution if and only if v.b=0 for all v in ker(A) (ie all v such that Av=b). The nullspace ker(A) is one dimensional with basis vector v = (0,1,0,1....,0,1), so v.b = sum_{i=1,3,5..} b_i.

Todo:
#1327 This could be a collective MPI-like operation

Definition at line 212 of file AbstractBidomainSolver.cpp.

References EXCEPTION, and AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::GetBoundaryConditions().

Referenced by AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::FinaliseLinearSystem().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::PrepareForSetupLinearSystem ( Vec  existingSolution  )  [inline, protected, virtual]

PrepareForSetupLinearSystem

Called at the beginning of SetupLinearSystem(). Here, used to integrate cell model odes.

Parameters:
existingSolution is the voltage to feed into the cell models

Reimplemented from AbstractLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >.

Definition at line 112 of file AbstractBidomainSolver.cpp.

References PdeSimulationTime::GetTime(), AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, 2 >::mDt, and AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mpBidomainTissue.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::FinaliseLinearSystem ( Vec  existingSolution  )  [inline, protected, virtual]

FinaliseAssembleSystem

Called at the end of SetupLinearSystem(), before the system is solved.

If no dirichlet boundary conditions (i) Check compatibility condition to check we are solving a linear system that can be solved Then either: (a) If not setting average(phi)=0, we are solving a singular system, so set up a null space. (b) Apply average(phi)=0 constraint by altering the last row, to get a non-singular system

Parameters:
existingSolution Solution at current time

Reimplemented from AbstractLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >.

Definition at line 144 of file AbstractBidomainSolver.cpp.

References LinearSystem::AssembleFinalLhsMatrix(), LinearSystem::AssembleRhsVector(), AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::CheckCompatibilityCondition(), AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::GenerateNullBasis(), AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::GetBoundaryConditions(), LinearSystem::GetSize(), AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, 2 >::mMatrixIsAssembled, AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mNullSpaceCreated, AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mpConfig, AbstractLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpLinearSystem, AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mRowForAverageOfPhiZeroed, HeartConfig::SetKSPSolver(), LinearSystem::SetKspType(), LinearSystem::SetMatrixElement(), LinearSystem::SetNullBasis(), LinearSystem::SetRhsVectorElement(), and LinearSystem::ZeroMatrixRowsWithValueOnDiagonal().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
Vec AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::GenerateNullBasis (  )  const [inline, protected, virtual]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::FinaliseForBath ( bool  computeMatrix,
bool  computeVector 
) [inline, protected]

Apply any changes needed to the linear system for problems that include a bath. Checks the voltage-voltage block of the matrix at bath-nodes is zero, and puts a 1 on the diagonal.

Parameters:
computeMatrix Whether the LHS matrix of the linear system has been computed
computeVector Whether the RHS vector of the linear system has been computed

Todo:
: #1215 #1328 this seems not to be an issue anymore. Document and remove code.

Todo:
#1328 This code may no longer be needed since all the operations in the following loop may apply only to local elements. MatSetValue and VecSetValue are not collective...

Definition at line 324 of file AbstractBidomainSolver.cpp.

References HeartRegionCode::BATH, LinearSystem::GetMatrixElement(), LinearSystem::GetOwnershipRange(), LinearSystem::GetSize(), AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mBathSimulation, AbstractLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpLinearSystem, AbstractLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpMesh, LinearSystem::rGetLhsMatrix(), and LinearSystem::rGetRhsVector().

Referenced by MatrixBasedBidomainSolver< ELEMENT_DIM, SPACE_DIM >::SetupLinearSystem(), and BasicBidomainSolver< ELEMENT_DIM, SPACE_DIM >::SetupLinearSystem().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::SetFixedExtracellularPotentialNodes ( std::vector< unsigned >  fixedExtracellularPotentialNodes  )  [inline]

Set the nodes at which phi_e (the extracellular potential) is fixed to zero. This does not necessarily have to be called. If it is not, phi_e is only defined up to a constant.

Parameters:
fixedExtracellularPotentialNodes the nodes to be fixed.
Note:
currently, the value of phi_e at the fixed nodes cannot be set to be anything other than zero.

Definition at line 278 of file AbstractBidomainSolver.cpp.

References BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::AddDirichletBoundaryCondition(), EXCEPTION, AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::GetBoundaryConditions(), AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mFixedExtracellularPotentialNodes, AbstractLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpMesh, and AbstractBoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::ResetDirichletCommunication().

Referenced by BidomainProblem< DIM >::CreateSolver().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::SetRowForAverageOfPhiZeroed ( unsigned  rowMeanPhiEZero  )  [inline]

Used when removing a single row to resolve singularity and replacing it with a constraint on the average phi_e being zero. It is set from the problem class.

Parameters:
rowMeanPhiEZero indicates the row of the matrix to be replaced. Ought to be an odd number...

Definition at line 311 of file AbstractBidomainSolver.cpp.

References EXCEPTION, and AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mRowForAverageOfPhiZeroed.

Referenced by BidomainProblem< DIM >::CreateSolver().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,2>* AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::GetBoundaryConditions (  )  [inline]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::ResetBoundaryConditionsContainer ( BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, 2 > *  pBcc  )  [inline]

Reset the boundary conditions being used. The caller should deal with deleting the old bcc pointer.

Parameters:
pBcc The new boundary conditions container.

Definition at line 206 of file AbstractBidomainSolver.hpp.

Referenced by BidomainProblem< DIM >::AtBeginningOfTimestep(), and BidomainProblem< DIM >::OnEndOfTimestep().


Member Data Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mBathSimulation [protected]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
BidomainTissue<SPACE_DIM>* AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mpBidomainTissue [protected]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,2>* AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mpBoundaryConditions [protected]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
BidomainAssembler<ELEMENT_DIM,SPACE_DIM>* AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mpBidomainAssembler [protected]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mNumQuadPoints [protected]

Number of quadrature points per dimension (only saved so it can be passed to the assembler)

Definition at line 65 of file AbstractBidomainSolver.hpp.

Referenced by BasicBidomainSolver< ELEMENT_DIM, SPACE_DIM >::InitialiseAssembler(), and MatrixBasedBidomainSolver< ELEMENT_DIM, SPACE_DIM >::SetupLinearSystem().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
bool AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mNullSpaceCreated [protected]

Used when intialising null-space solver to resolve singularity

Definition at line 68 of file AbstractBidomainSolver.hpp.

Referenced by AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::AbstractBidomainSolver(), and AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::FinaliseLinearSystem().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
HeartConfig* AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mpConfig [protected]

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
std::vector<unsigned> AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mFixedExtracellularPotentialNodes [protected]

Used when pinning nodes to resolve singularity. This vector indicates the global indices of the nodes to be pinned

Definition at line 76 of file AbstractBidomainSolver.hpp.

Referenced by AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::SetFixedExtracellularPotentialNodes().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
unsigned AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mRowForAverageOfPhiZeroed [protected]

Used when removing a single row to resolve singularity and replacing it with a constraint on the average phi_e being zero. This number indicates the row of the matrix to be replaced. This is INT_MAX if unset. It is set from the problem class.

Definition at line 83 of file AbstractBidomainSolver.hpp.

Referenced by AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::AbstractBidomainSolver(), AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::FinaliseLinearSystem(), AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::InitialiseForSolve(), and AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::SetRowForAverageOfPhiZeroed().


The documentation for this class was generated from the following files:

Generated on Mon Nov 1 12:35:30 2010 for Chaste by  doxygen 1.5.5