Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
BidomainProblem< DIM > Class Template Reference

#include <BidomainProblem.hpp>

+ Inheritance diagram for BidomainProblem< DIM >:
+ Collaboration diagram for BidomainProblem< DIM >:

Public Member Functions

 BidomainProblem (AbstractCardiacCellFactory< DIM > *pCellFactory, bool hasBath=false)
 
 BidomainProblem ()
 
void SetFixedExtracellularPotentialNodes (std::vector< unsigned > nodes)
 
void SetNodeForAverageOfPhiZeroed (unsigned node)
 
BidomainTissue< DIM > * GetBidomainTissue ()
 
void WriteInfo (double time)
 
virtual void DefineWriterColumns (bool extending)
 
virtual void WriteOneStep (double time, Vec voltageVec)
 
void PreSolveChecks ()
 
void AtBeginningOfTimestep (double time)
 
void OnEndOfTimestep (double time)
 
void SetUpAdditionalStoppingTimes (std::vector< double > &rAdditionalStoppingTimes)
 
template<class Archive >
void LoadExtraArchiveForBidomain (Archive &archive, unsigned version)
 
bool GetHasBath ()
 
void SetElectrodes ()
 
- Public Member Functions inherited from AbstractCardiacProblem< DIM, DIM, 2 >
 AbstractCardiacProblem (AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM > *pCellFactory)
 
 AbstractCardiacProblem ()
 
virtual ~AbstractCardiacProblem ()
 
void Initialise ()
 
void SetNodesPerProcessorFilename (const std::string &rFilename)
 
void SetBoundaryConditionsContainer (BccType pBcc)
 
void SetMesh (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh)
 
void PrintOutput (bool rPrintOutput)
 
void SetWriteInfo (bool writeInfo=true)
 
Vec GetSolution ()
 
DistributedVector GetSolutionDistributedVector ()
 
double GetCurrentTime ()
 
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > & rGetMesh ()
 
AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM > * GetTissue ()
 
void Solve ()
 
void CloseFilesAndPostProcess ()
 
void DefineExtraVariablesWriterColumns (bool extending)
 
void WriteExtraVariablesOneStep ()
 
bool InitialiseWriter ()
 
void SetUseHdf5DataWriterCache (bool useCache=true)
 
void SetHdf5DataWriterTargetChunkSizeAndAlignment (hsize_t size)
 
void SetOutputNodes (std::vector< unsigned > &rNodesToOutput)
 
Hdf5DataReader GetDataReader ()
 
void SetUseTimeAdaptivityController (bool useAdaptivity, AbstractTimeAdaptivityController *pController=NULL)
 
void LoadExtraArchive (Archive &archive, unsigned version)
 
void AddOutputModifier (boost::shared_ptr< AbstractOutputModifier > pOutputModifier)
 
- Public Member Functions inherited from AbstractUntemplatedCardiacProblem
virtual ~AbstractUntemplatedCardiacProblem ()
 

Protected Member Functions

Vec CreateInitialCondition ()
 
void AnalyseMeshForBath ()
 
virtual AbstractCardiacTissue< DIM > * CreateCardiacTissue ()
 
virtual AbstractDynamicLinearPdeSolver< DIM, DIM, 2 > * CreateSolver ()
 
- Protected Member Functions inherited from AbstractCardiacProblem< DIM, DIM, 2 >
virtual void CreateMeshFromHeartConfig ()
 

Protected Attributes

BidomainTissue< DIM > * mpBidomainTissue
 
std::vector< unsignedmFixedExtracellularPotentialNodes
 
unsigned mExtracelluarColumnId
 
unsigned mRowForAverageOfPhiZeroed
 
bool mHasBath
 
boost::shared_ptr< Electrodes< DIM > > mpElectrodes
 
AbstractBidomainSolver< DIM, DIM > * mpSolver
 
- Protected Attributes inherited from AbstractCardiacProblem< DIM, DIM, 2 >
std::string mMeshFilename
 
bool mAllocatedMemoryForMesh
 
bool mWriteInfo
 
bool mPrintOutput
 
std::vector< unsignedmNodesToOutput
 
unsigned mVoltageColumnId
 
std::vector< unsignedmExtraVariablesId
 
unsigned mTimeColumnId
 
unsigned mNodeColumnId
 
AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM > * mpCardiacTissue
 
BccType mpBoundaryConditionsContainer
 
BccType mpDefaultBoundaryConditionsContainer
 
AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM > * mpSolver
 
AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM > * mpCellFactory
 
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * mpMesh
 
Vec mSolution
 
double mCurrentTime
 
AbstractTimeAdaptivityControllermpTimeAdaptivityController
 
Hdf5DataWritermpWriter
 
bool mUseHdf5DataWriterCache
 
hsize_t mHdf5DataWriterChunkSizeAndAlignment
 
std::vector< boost::shared_ptr< AbstractOutputModifier > > mOutputModifiers
 

Private Member Functions

template<class Archive >
void save (Archive &archive, const unsigned int version) const
 
template<class Archive >
void load (Archive &archive, const unsigned int version)
 

Friends

class boost::serialization::access
 
class TestPCTwoLevelsBlockDiagonal
 
class TestBidomainWithBathProblem
 
class TestCardiacSimulationArchiver
 

Detailed Description

template<unsigned DIM>
class BidomainProblem< DIM >

Class which specifies and solves a bidomain problem.

The solution vector is of the form: (V_1, phi_1, V_2, phi_2, ......, V_N, phi_N), where V_j is the voltage at node j and phi_j is the extracellular potential at node j.

Definition at line 65 of file BidomainProblem.hpp.

Constructor & Destructor Documentation

◆ BidomainProblem() [1/2]

template<unsigned DIM>
BidomainProblem< DIM >::BidomainProblem ( AbstractCardiacCellFactory< DIM > *  pCellFactory,
bool  hasBath = false 
)

Constructor

Parameters
pCellFactoryUser defined cell factory which shows how the pde should create cells.
hasBathWhether the simulation has a bath (if this is true, all elements with attribute = 1 will be set to be bath elements (the rest should have attribute = 0)).

Definition at line 164 of file BidomainProblem.cpp.

References BidomainProblem< DIM >::mFixedExtracellularPotentialNodes.

◆ BidomainProblem() [2/2]

template<unsigned DIM>
BidomainProblem< DIM >::BidomainProblem ( )

Constructor just used for archiving

Definition at line 175 of file BidomainProblem.cpp.

References BidomainProblem< DIM >::mFixedExtracellularPotentialNodes.

Member Function Documentation

◆ AnalyseMeshForBath()

◆ AtBeginningOfTimestep()

template<unsigned DIM>
void BidomainProblem< DIM >::AtBeginningOfTimestep ( double  time)
virtual

Called at beginning of each time step in the main time-loop in AbstractCardiacProblem::Solve(). Overloaded here to switch on the electrodes (if there are any).

Parameters
timethe current time
Todo:
#1159 #1324 heart/src/problem/AbstractCardiacProblem.hpp:657 expects both pointing at the same place when unarchiving

Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.

Definition at line 296 of file BidomainProblem.cpp.

◆ CreateCardiacTissue()

template<unsigned DIM>
AbstractCardiacTissue< DIM > * BidomainProblem< DIM >::CreateCardiacTissue ( )
protectedvirtual
Returns
a newly created bidomain PDE object

Implements AbstractCardiacProblem< DIM, DIM, 2 >.

Definition at line 125 of file BidomainProblem.cpp.

References HeartConfig::Instance().

◆ CreateInitialCondition()

template<unsigned DIM>
Vec BidomainProblem< DIM >::CreateInitialCondition ( )
protectedvirtual

Create normal initial condition but overwrite V to zero for bath nodes, if there are any.

Returns
the newly created intial conditions vector

Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.

Definition at line 100 of file BidomainProblem.cpp.

References DistributedVector::Begin(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::CreateInitialCondition(), DistributedVector::End(), HeartRegionCode::IsRegionBath(), and DistributedVector::Restore().

◆ CreateSolver()

template<unsigned DIM>
AbstractDynamicLinearPdeSolver< DIM, DIM, 2 > * BidomainProblem< DIM >::CreateSolver ( )
protectedvirtual
Returns
a newly created suitable bidomain solver

Implements AbstractCardiacProblem< DIM, DIM, 2 >.

Definition at line 133 of file BidomainProblem.cpp.

◆ DefineWriterColumns()

template<unsigned DIM>
void BidomainProblem< DIM >::DefineWriterColumns ( bool  extending)
virtual

Define what variables are written to the primary results file. Adds the extracellular potential.

Parameters
extendingwhether we are extending an existing results file

Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.

Definition at line 233 of file BidomainProblem.cpp.

References AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::DefineExtraVariablesWriterColumns(), and AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::DefineWriterColumns().

◆ GetBidomainTissue()

template<unsigned DIM>
BidomainTissue< DIM > * BidomainProblem< DIM >::GetBidomainTissue ( )
Returns
the pde. Can only be called after Initialise()

Definition at line 202 of file BidomainProblem.cpp.

◆ GetHasBath()

template<unsigned DIM>
bool BidomainProblem< DIM >::GetHasBath ( )
virtual
Returns
whether this is a bidomain problem with bath or not

Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.

Definition at line 383 of file BidomainProblem.cpp.

◆ load()

template<unsigned DIM>
template<class Archive >
void BidomainProblem< DIM >::load ( Archive &  archive,
const unsigned int  version 
)
inlineprivate

◆ LoadExtraArchiveForBidomain()

template<unsigned DIM>
template<class Archive >
void BidomainProblem< DIM >::LoadExtraArchiveForBidomain ( Archive &  archive,
unsigned  version 
)

Used when loading a set of archives written by a parallel simulation onto a single process. Loads data from the given process-specific archive (written by a non-master process) and merges it into our data.

Parameters
archivethe archive to load
versionthe archive file version
Note
The process-specific archives currently contain the following data. If the layout changes, then this method will need to be altered, since it hard-codes knowledge of the order in which things are archived.
  1. Stuff known by AbstractCardiacProblem
  2. mpElectrodes->mpBoundaryConditionsContainer

This gets called by AbstractCardiacProblem::LoadExtraArchive when it's done the generic stuff.

Todo:
#1159 sanity check that the contents of p_bcc and mpElectrodes->GetBoundaryConditionsContainer() match.

Definition at line 299 of file BidomainProblem.hpp.

References BidomainProblem< DIM >::mpElectrodes, and AbstractCardiacProblem< DIM, DIM, 2 >::mpMesh.

Referenced by AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::LoadExtraArchive().

◆ OnEndOfTimestep()

template<unsigned DIM>
void BidomainProblem< DIM >::OnEndOfTimestep ( double  time)
virtual

Called at end of each time step in the main time-loop in AbstractCardiacProblem::Solve(). Overloaded here to switch off the electrodes (if there are any).

Parameters
timethe current time

Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.

Definition at line 337 of file BidomainProblem.cpp.

References HeartConfig::Instance().

◆ PreSolveChecks()

template<unsigned DIM>
void BidomainProblem< DIM >::PreSolveChecks ( )
virtual

Performs a series of checks before solving. Checks that a suitable method of resolving the singularity is being used.

Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.

Definition at line 259 of file BidomainProblem.cpp.

References EXCEPTION, HeartConfig::Instance(), and AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::PreSolveChecks().

◆ save()

template<unsigned DIM>
template<class Archive >
void BidomainProblem< DIM >::save ( Archive &  archive,
const unsigned int  version 
) const
inlineprivate

Save the member variables to an archive.

Parameters
archive
version

Definition at line 80 of file BidomainProblem.hpp.

References BidomainProblem< DIM >::mHasBath, BidomainProblem< DIM >::mpBidomainTissue, BidomainProblem< DIM >::mpElectrodes, and BidomainProblem< DIM >::mRowForAverageOfPhiZeroed.

◆ SetElectrodes()

template<unsigned DIM>
void BidomainProblem< DIM >::SetElectrodes ( )
virtual

Set an electrode object (which provides boundary conditions). Only valid if there is a bath.

Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.

Definition at line 279 of file BidomainProblem.cpp.

References HeartConfig::Instance().

◆ SetFixedExtracellularPotentialNodes()

template<unsigned DIM>
void BidomainProblem< DIM >::SetFixedExtracellularPotentialNodes ( std::vector< unsigned nodes)

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
nodesthe 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 184 of file BidomainProblem.cpp.

◆ SetNodeForAverageOfPhiZeroed()

template<unsigned DIM>
void BidomainProblem< DIM >::SetNodeForAverageOfPhiZeroed ( unsigned  node)

Set which row of the linear system should be used to enforce the condition that the average of phi_e is zero. If not called, this condition will not be used.

Parameters
nodethe mesh node index giving the row at which to impose the constraint

Definition at line 196 of file BidomainProblem.cpp.

◆ SetUpAdditionalStoppingTimes()

template<unsigned DIM>
void BidomainProblem< DIM >::SetUpAdditionalStoppingTimes ( std::vector< double > &  rAdditionalStoppingTimes)
virtual

Method to fill in a vector of additional stopping times consisting of the times when the electrodes are to be turned on and off

Parameters
rAdditionalStoppingTimesreference to vector that will contain the on and off times for the electrodes

Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.

Definition at line 373 of file BidomainProblem.cpp.

◆ WriteInfo()

template<unsigned DIM>
void BidomainProblem< DIM >::WriteInfo ( double  time)
virtual

Print out time and max/min voltage/phi_e values at current time.

Parameters
timecurrent time.

Implements AbstractCardiacProblem< DIM, DIM, 2 >.

Definition at line 209 of file BidomainProblem.cpp.

References PetscTools::AmMaster(), and CHASTE_PETSC_NULLPTR.

◆ WriteOneStep()

template<unsigned DIM>
void BidomainProblem< DIM >::WriteOneStep ( double  time,
Vec  voltageVec 
)
virtual

Write one timestep of output data to the primary results file. Adds the extracellular potential to the results.

Parameters
timethe current time
voltageVecthe solution vector to write

Implements AbstractCardiacProblem< DIM, DIM, 2 >.

Definition at line 248 of file BidomainProblem.cpp.

References AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::WriteExtraVariablesOneStep().

Friends And Related Symbol Documentation

◆ boost::serialization::access

template<unsigned DIM>
friend class boost::serialization::access
friend

Needed for serialization.

Definition at line 68 of file BidomainProblem.hpp.

◆ TestBidomainWithBathProblem

template<unsigned DIM>
friend class TestBidomainWithBathProblem
friend

Definition at line 114 of file BidomainProblem.hpp.

◆ TestCardiacSimulationArchiver

template<unsigned DIM>
friend class TestCardiacSimulationArchiver
friend

Definition at line 115 of file BidomainProblem.hpp.

◆ TestPCTwoLevelsBlockDiagonal

template<unsigned DIM>
friend class TestPCTwoLevelsBlockDiagonal
friend

Definition at line 71 of file BidomainProblem.hpp.

Member Data Documentation

◆ mExtracelluarColumnId

template<unsigned DIM>
unsigned BidomainProblem< DIM >::mExtracelluarColumnId
protected

Used by the writer

Definition at line 124 of file BidomainProblem.hpp.

◆ mFixedExtracellularPotentialNodes

template<unsigned DIM>
std::vector<unsigned> BidomainProblem< DIM >::mFixedExtracellularPotentialNodes
protected

Nodes at which the extracellular voltage is fixed to zero (replicated)

Definition at line 122 of file BidomainProblem.hpp.

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

◆ mHasBath

template<unsigned DIM>
bool BidomainProblem< DIM >::mHasBath
protected

Whether the mesh has a bath, ie whether this is a bath simulation

Definition at line 132 of file BidomainProblem.hpp.

Referenced by BidomainProblem< DIM >::load(), and BidomainProblem< DIM >::save().

◆ mpBidomainTissue

template<unsigned DIM>
BidomainTissue<DIM>* BidomainProblem< DIM >::mpBidomainTissue
protected

The bidomain PDE

Definition at line 119 of file BidomainProblem.hpp.

Referenced by BidomainProblem< DIM >::load(), and BidomainProblem< DIM >::save().

◆ mpElectrodes

template<unsigned DIM>
boost::shared_ptr<Electrodes<DIM> > BidomainProblem< DIM >::mpElectrodes
protected

◆ mpSolver

template<unsigned DIM>
AbstractBidomainSolver<DIM,DIM>* BidomainProblem< DIM >::mpSolver
protected

We need to save the solver that is being used to be able to switch off the electrodes (by adding default boundary conditions to the solver)

Definition at line 155 of file BidomainProblem.hpp.

◆ mRowForAverageOfPhiZeroed

template<unsigned DIM>
unsigned BidomainProblem< DIM >::mRowForAverageOfPhiZeroed
protected

Another method of resolving the singularity in the bidomain equations. Specifies a row of the matrix at which to impose an extra condition.

Definition at line 129 of file BidomainProblem.hpp.

Referenced by BidomainProblem< DIM >::load(), and BidomainProblem< DIM >::save().


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