#include <BidomainProblem.hpp>
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 () |
Protected Member Functions | |
Vec | CreateInitialCondition () |
void | AnalyseMeshForBath () |
virtual AbstractCardiacTissue < DIM > * | CreateCardiacTissue () |
virtual AbstractDynamicLinearPdeSolver < DIM, DIM, 2 > * | CreateSolver () |
void | SetElectrodes () |
Protected Attributes | |
BidomainTissue< DIM > * | mpBidomainTissue |
std::vector< unsigned > | mFixedExtracellularPotentialNodes |
unsigned | mExtracelluarColumnId |
unsigned | mRowForAverageOfPhiZeroed |
bool | mHasBath |
boost::shared_ptr< Electrodes < DIM > > | mpElectrodes |
AbstractBidomainSolver< DIM, DIM > * | mpSolver |
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 |
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 58 of file BidomainProblem.hpp.
BidomainProblem< DIM >::BidomainProblem | ( | AbstractCardiacCellFactory< DIM > * | pCellFactory, | |
bool | hasBath = false | |||
) | [inline] |
Constructor
pCellFactory | User defined cell factory which shows how the pde should create cells. | |
hasBath | Whether 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 161 of file BidomainProblem.cpp.
References BidomainProblem< DIM >::mFixedExtracellularPotentialNodes.
BidomainProblem< DIM >::BidomainProblem | ( | ) | [inline] |
Constructor just used for archiving
Definition at line 172 of file BidomainProblem.cpp.
References BidomainProblem< DIM >::mFixedExtracellularPotentialNodes.
void BidomainProblem< DIM >::save | ( | Archive & | archive, | |
const unsigned int | version | |||
) | const [inline, private] |
Save the member variables to an archive.
archive | ||
version |
Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.
Definition at line 73 of file BidomainProblem.hpp.
References BidomainProblem< DIM >::mHasBath, BidomainProblem< DIM >::mpBidomainTissue, BidomainProblem< DIM >::mpElectrodes, and BidomainProblem< DIM >::mRowForAverageOfPhiZeroed.
void BidomainProblem< DIM >::load | ( | Archive & | archive, | |
const unsigned int | version | |||
) | [inline, private] |
Load the member variables from an archive.
archive | ||
version |
Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.
Definition at line 90 of file BidomainProblem.hpp.
References BidomainProblem< DIM >::AnalyseMeshForBath(), BidomainProblem< DIM >::mHasBath, BidomainProblem< DIM >::mpBidomainTissue, BidomainProblem< DIM >::mpElectrodes, and BidomainProblem< DIM >::mRowForAverageOfPhiZeroed.
Vec BidomainProblem< DIM >::CreateInitialCondition | ( | ) | [inline, protected, virtual] |
Create normal initial condition but overwrite V to zero for bath nodes, if there are any.
Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.
Definition at line 85 of file BidomainProblem.cpp.
References HeartRegionCode::BATH, DistributedVector::Begin(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::CreateInitialCondition(), DistributedVector::End(), BidomainProblem< DIM >::mHasBath, AbstractCardiacProblem< DIM, DIM, 2 >::mpMesh, and DistributedVector::Restore().
void BidomainProblem< DIM >::AnalyseMeshForBath | ( | ) | [inline, protected] |
Annotate bath nodes with the correct region code, if a bath is present. Will throw if mHasBath is set but no bath is present in the mesh.
Definition at line 39 of file BidomainProblem.cpp.
References HeartRegionCode::BATH, EXCEPTION, AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNode(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetRegion(), BidomainProblem< DIM >::mHasBath, AbstractCardiacProblem< DIM, DIM, 2 >::mpMesh, PetscTools::ReplicateBool(), and HeartRegionCode::TISSUE.
Referenced by BidomainProblem< DIM >::CreateCardiacTissue(), and BidomainProblem< DIM >::load().
AbstractCardiacTissue< DIM > * BidomainProblem< DIM >::CreateCardiacTissue | ( | ) | [inline, protected, virtual] |
Create our bidomain PDE object
Implements AbstractCardiacProblem< DIM, DIM, 2 >.
Definition at line 110 of file BidomainProblem.cpp.
References BidomainProblem< DIM >::AnalyseMeshForBath(), BidomainProblem< DIM >::mpBidomainTissue, and AbstractCardiacProblem< DIM, DIM, 2 >::mpCellFactory.
AbstractDynamicLinearPdeSolver< DIM, DIM, 2 > * BidomainProblem< DIM >::CreateSolver | ( | ) | [inline, protected, virtual] |
Create a suitable bidomain solver
Implements AbstractCardiacProblem< DIM, DIM, 2 >.
Definition at line 118 of file BidomainProblem.cpp.
References BidomainProblem< DIM >::mFixedExtracellularPotentialNodes, BidomainProblem< DIM >::mHasBath, BidomainProblem< DIM >::mpBidomainTissue, AbstractCardiacProblem< DIM, DIM, 2 >::mpBoundaryConditionsContainer, AbstractCardiacProblem< DIM, DIM, 2 >::mpMesh, BidomainProblem< DIM >::mpSolver, BidomainProblem< DIM >::mRowForAverageOfPhiZeroed, AbstractCardiacProblem< DIM, DIM, 2 >::mUseMatrixBasedRhsAssembly, AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::SetFixedExtracellularPotentialNodes(), and AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::SetRowForAverageOfPhiZeroed().
Referenced by BidomainProblem< DIM >::OnEndOfTimestep().
void BidomainProblem< DIM >::SetElectrodes | ( | ) | [inline, protected, 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 280 of file BidomainProblem.cpp.
References HeartConfig::Instance(), BidomainProblem< DIM >::mHasBath, BidomainProblem< DIM >::mpElectrodes, and AbstractCardiacProblem< DIM, DIM, 2 >::mpMesh.
void BidomainProblem< DIM >::SetFixedExtracellularPotentialNodes | ( | std::vector< unsigned > | nodes | ) | [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.
nodes | the nodes to be fixed. |
Definition at line 183 of file BidomainProblem.cpp.
References BidomainProblem< DIM >::mFixedExtracellularPotentialNodes.
void BidomainProblem< DIM >::SetNodeForAverageOfPhiZeroed | ( | unsigned | node | ) | [inline] |
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.
node | the mesh node index giving the row at which to impose the constraint |
Definition at line 195 of file BidomainProblem.cpp.
References BidomainProblem< DIM >::mRowForAverageOfPhiZeroed.
BidomainTissue< DIM > * BidomainProblem< DIM >::GetBidomainTissue | ( | ) | [inline] |
Get the pde. Can only be called after Initialise()
Definition at line 201 of file BidomainProblem.cpp.
References BidomainProblem< DIM >::mpBidomainTissue.
void BidomainProblem< DIM >::WriteInfo | ( | double | time | ) | [inline, virtual] |
Print out time and max/min voltage/phi_e values at current time.
time | current time. |
Implements AbstractCardiacProblem< DIM, DIM, 2 >.
Definition at line 208 of file BidomainProblem.cpp.
References PetscTools::AmMaster(), and AbstractCardiacProblem< DIM, DIM, 2 >::mSolution.
void BidomainProblem< DIM >::DefineWriterColumns | ( | bool | extending | ) | [inline, virtual] |
Define what variables are written to the primary results file. Adds the extracellular potential.
extending | whether we are extending an existing results file |
Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.
Definition at line 234 of file BidomainProblem.cpp.
References AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::DefineExtraVariablesWriterColumns(), Hdf5DataWriter::DefineVariable(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::DefineWriterColumns(), Hdf5DataWriter::GetVariableByName(), BidomainProblem< DIM >::mExtracelluarColumnId, and AbstractCardiacProblem< DIM, DIM, 2 >::mpWriter.
void BidomainProblem< DIM >::WriteOneStep | ( | double | time, | |
Vec | voltageVec | |||
) | [inline, virtual] |
Write one timestep of output data to the primary results file. Adds the extracellular potential to the results.
time | the current time | |
voltageVec | the solution vector to write |
Implements AbstractCardiacProblem< DIM, DIM, 2 >.
Definition at line 249 of file BidomainProblem.cpp.
References BidomainProblem< DIM >::mExtracelluarColumnId, AbstractCardiacProblem< DIM, DIM, 2 >::mpWriter, AbstractCardiacProblem< DIM, DIM, 2 >::mVoltageColumnId, Hdf5DataWriter::PutStripedVector(), Hdf5DataWriter::PutUnlimitedVariable(), and AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::WriteExtraVariablesOneStep().
void BidomainProblem< DIM >::PreSolveChecks | ( | ) | [inline, 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 260 of file BidomainProblem.cpp.
References EXCEPTION, HeartConfig::GetUseRelativeTolerance(), HeartConfig::Instance(), BidomainProblem< DIM >::mFixedExtracellularPotentialNodes, BidomainProblem< DIM >::mRowForAverageOfPhiZeroed, and AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::PreSolveChecks().
void BidomainProblem< DIM >::AtBeginningOfTimestep | ( | double | time | ) | [inline, 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).
time | the current time |
Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.
Definition at line 297 of file BidomainProblem.cpp.
References AbstractLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::GetLinearSystem(), AbstractCardiacProblem< DIM, DIM, 2 >::mpBoundaryConditionsContainer, AbstractCardiacProblem< DIM, DIM, 2 >::mpDefaultBoundaryConditionsContainer, BidomainProblem< DIM >::mpElectrodes, BidomainProblem< DIM >::mpSolver, LinearSystem::RemoveNullSpace(), and AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::ResetBoundaryConditionsContainer().
void BidomainProblem< DIM >::OnEndOfTimestep | ( | double | time | ) | [inline, 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).
time | the current time |
Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.
Definition at line 338 of file BidomainProblem.cpp.
References BidomainProblem< DIM >::CreateSolver(), AbstractCardiacProblem< DIM, DIM, 2 >::mpBoundaryConditionsContainer, AbstractCardiacProblem< DIM, DIM, 2 >::mpDefaultBoundaryConditionsContainer, BidomainProblem< DIM >::mpElectrodes, AbstractCardiacProblem< DIM, DIM, 2 >::mpMesh, BidomainProblem< DIM >::mpSolver, and AbstractBidomainSolver< ELEMENT_DIM, SPACE_DIM >::ResetBoundaryConditionsContainer().
void BidomainProblem< DIM >::SetUpAdditionalStoppingTimes | ( | std::vector< double > & | rAdditionalStoppingTimes | ) | [inline, 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
rAdditionalStoppingTimes | reference to vector that will contain the on and off times for the electrodes |
Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.
Definition at line 375 of file BidomainProblem.cpp.
References BidomainProblem< DIM >::mpElectrodes.
void BidomainProblem< DIM >::LoadExtraArchiveForBidomain | ( | Archive & | archive, | |
unsigned | version | |||
) | [inline] |
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.
archive | the archive to load | |
version | the archive file version |
This gets called by AbstractCardiacProblem::LoadExtraArchive when it's done the generic stuff.
Definition at line 293 of file BidomainProblem.hpp.
References AbstractCardiacProblem< DIM, DIM, 2 >::mpBoundaryConditionsContainer, and AbstractCardiacProblem< DIM, DIM, 2 >::mpMesh.
Referenced by AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::LoadExtraArchive().
bool BidomainProblem< DIM >::GetHasBath | ( | ) | [inline, virtual] |
Return whether this is a bidomain problem with bath or not
Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.
Definition at line 385 of file BidomainProblem.cpp.
References BidomainProblem< DIM >::mHasBath.
friend class boost::serialization::access [friend] |
Needed for serialization.
Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.
Reimplemented in BidomainWithBathProblem< DIM >.
Definition at line 61 of file BidomainProblem.hpp.
BidomainTissue<DIM>* BidomainProblem< DIM >::mpBidomainTissue [protected] |
The bidomain PDE
Definition at line 112 of file BidomainProblem.hpp.
Referenced by BidomainProblem< DIM >::CreateCardiacTissue(), BidomainProblem< DIM >::CreateSolver(), BidomainProblem< DIM >::GetBidomainTissue(), BidomainProblem< DIM >::load(), and BidomainProblem< DIM >::save().
std::vector<unsigned> BidomainProblem< DIM >::mFixedExtracellularPotentialNodes [protected] |
Nodes at which the extracellular voltage is fixed to zero (replicated)
Definition at line 115 of file BidomainProblem.hpp.
Referenced by BidomainProblem< DIM >::BidomainProblem(), BidomainProblem< DIM >::CreateSolver(), BidomainProblem< DIM >::PreSolveChecks(), and BidomainProblem< DIM >::SetFixedExtracellularPotentialNodes().
unsigned BidomainProblem< DIM >::mExtracelluarColumnId [protected] |
Used by the writer
Definition at line 117 of file BidomainProblem.hpp.
Referenced by BidomainProblem< DIM >::DefineWriterColumns(), and BidomainProblem< DIM >::WriteOneStep().
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 122 of file BidomainProblem.hpp.
Referenced by BidomainProblem< DIM >::CreateSolver(), BidomainProblem< DIM >::load(), BidomainProblem< DIM >::PreSolveChecks(), BidomainProblem< DIM >::save(), and BidomainProblem< DIM >::SetNodeForAverageOfPhiZeroed().
bool BidomainProblem< DIM >::mHasBath [protected] |
Whether the mesh has a bath, ie whether this is a bath simulation
Definition at line 125 of file BidomainProblem.hpp.
Referenced by BidomainProblem< DIM >::AnalyseMeshForBath(), BidomainProblem< DIM >::CreateInitialCondition(), BidomainProblem< DIM >::CreateSolver(), BidomainProblem< DIM >::GetHasBath(), BidomainProblem< DIM >::load(), BidomainProblem< DIM >::save(), and BidomainProblem< DIM >::SetElectrodes().
boost::shared_ptr<Electrodes<DIM> > BidomainProblem< DIM >::mpElectrodes [protected] |
Electrodes used to provide a shock
Definition at line 128 of file BidomainProblem.hpp.
Referenced by BidomainProblem< DIM >::AtBeginningOfTimestep(), BidomainProblem< DIM >::load(), BidomainProblem< DIM >::OnEndOfTimestep(), BidomainProblem< DIM >::save(), BidomainProblem< DIM >::SetElectrodes(), and BidomainProblem< DIM >::SetUpAdditionalStoppingTimes().
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)
Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.
Definition at line 147 of file BidomainProblem.hpp.
Referenced by BidomainProblem< DIM >::AtBeginningOfTimestep(), BidomainProblem< DIM >::CreateSolver(), and BidomainProblem< DIM >::OnEndOfTimestep().