Chaste Commit::ca8ccdedf819b6e02855bc0e8e6f50bdecbc5208
AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM > Class Template Reference

#include <AbstractBidomainSolver.hpp>

+ Inheritance diagram for AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >:
+ Collaboration diagram for AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >:

Public Member Functions

 AbstractBidomainSolver (bool bathSimulation, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh, BidomainTissue< SPACE_DIM > *pTissue, BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, 2 > *pBoundaryConditions)
 
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)
 
- Public Member Functions inherited from AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, 2 >
 AbstractDynamicLinearPdeSolver (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh)
 
void SetTimes (double tStart, double tEnd)
 
void SetTimeStep (double dt)
 
void SetInitialCondition (Vec initialCondition)
 
virtual Vec Solve ()
 
void SetMatrixIsNotAssembled ()
 
void SetTimeAdaptivityController (AbstractTimeAdaptivityController *pTimeAdaptivityController)
 
void SetOutputToVtk (bool output)
 
void SetOutputToParallelVtk (bool output)
 
void SetOutputToTxt (bool output)
 
void SetOutputDirectoryAndPrefix (std::string outputDirectory, std::string prefix)
 
void SetPrintingTimestepMultiple (unsigned multiple)
 
- Public Member Functions inherited from AbstractLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >
 AbstractLinearPdeSolver (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh)
 
virtual ~AbstractLinearPdeSolver ()
 
virtual void FollowingSolveLinearSystem (Vec currentSolution)
 
virtual void SetupLinearSystem (Vec currentSolution, bool computeMatrix)=0
 
LinearSystemGetLinearSystem ()
 

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 Member Functions inherited from AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, 2 >
void InitialiseHdf5Writer ()
 
void WriteOneStep (double time, Vec solution)
 

Protected Attributes

bool mBathSimulation
 
BidomainTissue< SPACE_DIM > * mpBidomainTissue
 
BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, 2 > * mpBoundaryConditions
 
bool mNullSpaceCreated
 
HeartConfigmpConfig
 
std::vector< unsignedmFixedExtracellularPotentialNodes
 
unsigned mRowForAverageOfPhiZeroed
 
- Protected Attributes inherited from AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, 2 >
double mTstart
 
double mTend
 
bool mTimesSet
 
Vec mInitialCondition
 
bool mMatrixIsAssembled
 
bool mMatrixIsConstant
 
double mIdealTimeStep
 
double mLastWorkingTimeStep
 
AbstractTimeAdaptivityControllermpTimeAdaptivityController
 
bool mOutputToVtk
 
bool mOutputToParallelVtk
 
bool mOutputToTxt
 
std::string mOutputDirectory
 
std::string mFilenamePrefix
 
unsigned mPrintingTimestepMultiple
 
Hdf5DataWritermpHdf5Writer
 
std::vector< int > mVariableColumnIds
 
- Protected Attributes inherited from AbstractLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >
LinearSystemmpLinearSystem
 
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * mpMesh
 

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 49 of file AbstractBidomainSolver.hpp.

Constructor & Destructor Documentation

◆ AbstractBidomainSolver()

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 
)

Constructor

Parameters
bathSimulationwhether the simulation has a perfusing bath
pMeshpointer to the mesh
pTissuepointer to the tissue
pBoundaryConditionspointer to the boundary conditions container

Definition at line 234 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 >::mpConfig, and AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mRowForAverageOfPhiZeroed.

◆ ~AbstractBidomainSolver()

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

Destructor

Definition at line 257 of file AbstractBidomainSolver.cpp.

Member Function Documentation

◆ CheckCompatibilityCondition()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::CheckCompatibilityCondition ( )
protectedvirtual

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.

Definition at line 198 of file AbstractBidomainSolver.cpp.

References DistributedVector::Begin(), DistributedVector::End(), and EXCEPTION.

◆ FinaliseForBath()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::FinaliseForBath ( bool  computeMatrix,
bool  computeVector 
)
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.

Precondition: This method requires the system matrix to be in assembled state. Call FinaliseLhsMatrix() on your linear system if required.

Parameters
computeMatrixWhether the LHS matrix of the linear system has been computed
computeVectorWhether the RHS vector of the linear system has been computed

Definition at line 307 of file AbstractBidomainSolver.cpp.

References HeartRegionCode::IsRegionBath(), PetscMatTools::SetElement(), and PetscVecTools::SetElement().

◆ FinaliseLinearSystem()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::FinaliseLinearSystem ( Vec  existingSolution)
protectedvirtual

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
existingSolutionSolution at current time

Reimplemented from AbstractLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >.

Definition at line 129 of file AbstractBidomainSolver.cpp.

◆ GenerateNullBasis()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
Vec AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::GenerateNullBasis ( ) const
protectedvirtual
Returns
null basis vector

Called by FinaliseAssembleSystem to get the null basis to use for the particular formulation of the bidomain equations used.

Definition at line 105 of file AbstractBidomainSolver.cpp.

◆ GetBoundaryConditions()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, 2 > * AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::GetBoundaryConditions ( )
inline
Returns
the boundary conditions being used

Definition at line 192 of file AbstractBidomainSolver.hpp.

References AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mpBoundaryConditions.

◆ InitialiseForSolve()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::InitialiseForSolve ( Vec  initialSolution)
protectedvirtual

Create the linear system object if it hasn't been already. Can use an initial solution as PETSc template, or base it on the mesh size.

Parameters
initialSolutionan initial guess

Reimplemented from AbstractLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >.

Reimplemented in BidomainSolver< ELEMENT_DIM, SPACE_DIM >.

Definition at line 43 of file AbstractBidomainSolver.cpp.

References PetscTools::AmMaster(), AbstractLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::InitialiseForSolve(), and HeartConfig::Instance().

Referenced by BidomainSolver< ELEMENT_DIM, SPACE_DIM >::InitialiseForSolve().

◆ PrepareForSetupLinearSystem()

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
void AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::PrepareForSetupLinearSystem ( Vec  existingSolution)
protectedvirtual

PrepareForSetupLinearSystem

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

Parameters
existingSolutionis the voltage to feed into the cell models

Reimplemented from AbstractLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >.

Definition at line 99 of file AbstractBidomainSolver.cpp.

References PdeSimulationTime::GetNextTime(), and PdeSimulationTime::GetTime().

◆ ResetBoundaryConditionsContainer()

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
pBccThe new boundary conditions container.

Definition at line 202 of file AbstractBidomainSolver.hpp.

References AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::mpBoundaryConditions.

◆ SetFixedExtracellularPotentialNodes()

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

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
fixedExtracellularPotentialNodesthe 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 262 of file AbstractBidomainSolver.cpp.

References EXCEPTION.

◆ SetRowForAverageOfPhiZeroed()

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

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
rowMeanPhiEZeroindicates the row of the matrix to be replaced. Ought to be an odd number...

Definition at line 295 of file AbstractBidomainSolver.cpp.

References EXCEPTION.

Member Data Documentation

◆ mBathSimulation

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

Whether the simulation involves a perfusing bath

Definition at line 53 of file AbstractBidomainSolver.hpp.

◆ mFixedExtracellularPotentialNodes

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 70 of file AbstractBidomainSolver.hpp.

◆ mNullSpaceCreated

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 62 of file AbstractBidomainSolver.hpp.

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

◆ mpBidomainTissue

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

The PDE to be solved.

Definition at line 56 of file AbstractBidomainSolver.hpp.

Referenced by BidomainSolver< ELEMENT_DIM, SPACE_DIM >::BidomainSolver().

◆ mpBoundaryConditions

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

◆ mpConfig

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

Local cache of the configuration singleton instance

Definition at line 65 of file AbstractBidomainSolver.hpp.

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

◆ mRowForAverageOfPhiZeroed

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 77 of file AbstractBidomainSolver.hpp.

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


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