#include <CardiacElectroMechanicsProblem.hpp>
Public Member Functions | |
CardiacElectroMechanicsProblem (TetrahedralMesh< DIM, DIM > *pElectricsMesh, QuadraticMesh< DIM > *pMechanicsMesh, std::vector< unsigned > fixedMechanicsNodes, AbstractCardiacCellFactory< DIM > *pCellFactory, double endTime, unsigned numElecTimeStepsPerMechTimestep, double nhsOdeTimeStep, std::string outputDirectory) | |
virtual | ~CardiacElectroMechanicsProblem () |
void | Initialise () |
void | Solve () |
double | Max (std::vector< double > &vec) |
void | SetNoElectricsOutput () |
void | SetWatchedPosition (c_vector< double, DIM > watchedLocation) |
std::vector< c_vector< double, DIM > > & | rGetDeformedPosition () |
Protected Member Functions | |
void | DetermineWatchedNodes () |
void | WriteWatchedLocationData (double time, Vec voltage) |
Protected Attributes | |
MonodomainProblem< DIM > * | mpMonodomainProblem |
ImplicitCardiacMechanicsAssembler < DIM > * | mpCardiacMechAssembler |
double | mEndTime |
double | mElectricsTimeStep |
double | mMechanicsTimeStep |
unsigned | mNumElecTimestepsPerMechTimestep |
double | mNhsOdeTimeStep |
TetrahedralMesh< DIM, DIM > * | mpElectricsMesh |
QuadraticMesh< DIM > * | mpMechanicsMesh |
std::vector< ElementAndWeights < DIM > > | mElementAndWeightsForQuadPoints |
std::string | mOutputDirectory |
std::string | mDeformationOutputDirectory |
bool | mWriteOutput |
bool | mNoElectricsOutput |
bool | mIsWatchedLocation |
c_vector< double, DIM > | mWatchedLocation |
unsigned | mWatchedElectricsNodeIndex |
unsigned | mWatchedMechanicsNodeIndex |
out_stream | mpWatchedLocationFile |
std::vector< unsigned > | mFixedNodes |
Static Protected Attributes | |
static const int | WRITE_EVERY_NTH_TIME = 1 |
Friends | |
class | TestCardiacElectroMechanicsProblem |
For solving full electro-mechanical problems.
Solves a monodomain problem (diffusion plus cell models) on a (fine) electrics mesh, and a mechanics problem (finite elasticity plus NHS cell models) on a coarse mesh. An implicit scheme (Jon Whiteley's algorithm) be be used.
For solving problems on regular grids use CardiacElectroMechProbRegularGeom
The implicit algorithm:
Store the position in the electrics mesh of each quad point in the mechanics mesh For every time: Solve the monodomain problem (ie integrate ODEs, solve PDE) Get intracellular [Ca] at each electrics node and interpolate on each mechanics quad point Set [Ca] on each NHS model (one for each point) Solve static finite elasticity problem implicity
Note: invC is not used in the monodomain equations (code added but commented out) we have shown that this does not affect the mechanics results (might affect the electrics).
Definition at line 99 of file CardiacElectroMechanicsProblem.hpp.
CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem | ( | TetrahedralMesh< DIM, DIM > * | pElectricsMesh, | |
QuadraticMesh< DIM > * | pMechanicsMesh, | |||
std::vector< unsigned > | fixedMechanicsNodes, | |||
AbstractCardiacCellFactory< DIM > * | pCellFactory, | |||
double | endTime, | |||
unsigned | numElecTimeStepsPerMechTimestep, | |||
double | nhsOdeTimeStep, | |||
std::string | outputDirectory = "" | |||
) | [inline] |
Constructor
Definition at line 162 of file CardiacElectroMechanicsProblem.cpp.
References GenericEventHandler< 11, HeartEventHandler >::Disable(), LogFile::Instance(), CardiacElectroMechanicsProblem< DIM >::mDeformationOutputDirectory, CardiacElectroMechanicsProblem< DIM >::mElectricsTimeStep, CardiacElectroMechanicsProblem< DIM >::mEndTime, CardiacElectroMechanicsProblem< DIM >::mFixedNodes, CardiacElectroMechanicsProblem< DIM >::mIsWatchedLocation, CardiacElectroMechanicsProblem< DIM >::mMechanicsTimeStep, CardiacElectroMechanicsProblem< DIM >::mNhsOdeTimeStep, CardiacElectroMechanicsProblem< DIM >::mNoElectricsOutput, CardiacElectroMechanicsProblem< DIM >::mNumElecTimestepsPerMechTimestep, CardiacElectroMechanicsProblem< DIM >::mOutputDirectory, CardiacElectroMechanicsProblem< DIM >::mpCardiacMechAssembler, CardiacElectroMechanicsProblem< DIM >::mpElectricsMesh, CardiacElectroMechanicsProblem< DIM >::mpMechanicsMesh, CardiacElectroMechanicsProblem< DIM >::mpMonodomainProblem, CardiacElectroMechanicsProblem< DIM >::mWatchedElectricsNodeIndex, CardiacElectroMechanicsProblem< DIM >::mWatchedMechanicsNodeIndex, CardiacElectroMechanicsProblem< DIM >::mWriteOutput, LogFile::Set(), and LogFile::WriteHeader().
CardiacElectroMechanicsProblem< DIM >::~CardiacElectroMechanicsProblem | ( | ) | [inline, virtual] |
Delete allocated memory and close the watched location file
Definition at line 247 of file CardiacElectroMechanicsProblem.cpp.
References LogFile::Close(), CardiacElectroMechanicsProblem< DIM >::mIsWatchedLocation, CardiacElectroMechanicsProblem< DIM >::mpCardiacMechAssembler, CardiacElectroMechanicsProblem< DIM >::mpMechanicsMesh, CardiacElectroMechanicsProblem< DIM >::mpMonodomainProblem, and CardiacElectroMechanicsProblem< DIM >::mpWatchedLocationFile.
void CardiacElectroMechanicsProblem< DIM >::DetermineWatchedNodes | ( | ) | [inline, protected] |
Determine which node is closest to the watched location
Definition at line 53 of file CardiacElectroMechanicsProblem.cpp.
References CardiacElectroMechanicsProblem< DIM >::mIsWatchedLocation, CardiacElectroMechanicsProblem< DIM >::mOutputDirectory, CardiacElectroMechanicsProblem< DIM >::mpElectricsMesh, CardiacElectroMechanicsProblem< DIM >::mpMechanicsMesh, CardiacElectroMechanicsProblem< DIM >::mpWatchedLocationFile, CardiacElectroMechanicsProblem< DIM >::mWatchedElectricsNodeIndex, CardiacElectroMechanicsProblem< DIM >::mWatchedLocation, CardiacElectroMechanicsProblem< DIM >::mWatchedMechanicsNodeIndex, and OutputFileHandler::OpenOutputFile().
Referenced by CardiacElectroMechanicsProblem< DIM >::Initialise().
void CardiacElectroMechanicsProblem< DIM >::WriteWatchedLocationData | ( | double | time, | |
Vec | voltage | |||
) | [inline, protected] |
Write info (x, y, V, and Ca) for the watched node. Note: the Ca is written, but this ASSUMES LUO-RUDY IS USED
Definition at line 137 of file CardiacElectroMechanicsProblem.cpp.
References CardiacElectroMechanicsProblem< DIM >::mIsWatchedLocation, CardiacElectroMechanicsProblem< DIM >::mpCardiacMechAssembler, CardiacElectroMechanicsProblem< DIM >::mpMonodomainProblem, CardiacElectroMechanicsProblem< DIM >::mpWatchedLocationFile, CardiacElectroMechanicsProblem< DIM >::mWatchedElectricsNodeIndex, and CardiacElectroMechanicsProblem< DIM >::mWatchedMechanicsNodeIndex.
Referenced by CardiacElectroMechanicsProblem< DIM >::Solve().
void CardiacElectroMechanicsProblem< DIM >::Initialise | ( | ) | [inline] |
Initialise the class. Calls ConstructMeshes() and ConstructMechanicsAssembler(). Initialises the MonodomainProblem and sets up the electrics mesh to mechanics mesh data.
Definition at line 265 of file CardiacElectroMechanicsProblem.cpp.
References CardiacElectroMechanicsProblem< DIM >::DetermineWatchedNodes(), QuadraturePointsGroup< DIM >::Get(), CardiacElectroMechanicsProblem< DIM >::mDeformationOutputDirectory, CardiacElectroMechanicsProblem< DIM >::mElementAndWeightsForQuadPoints, CardiacElectroMechanicsProblem< DIM >::mFixedNodes, CardiacElectroMechanicsProblem< DIM >::mIsWatchedLocation, CardiacElectroMechanicsProblem< DIM >::mOutputDirectory, CardiacElectroMechanicsProblem< DIM >::mpCardiacMechAssembler, CardiacElectroMechanicsProblem< DIM >::mpElectricsMesh, CardiacElectroMechanicsProblem< DIM >::mpMechanicsMesh, CardiacElectroMechanicsProblem< DIM >::mpMonodomainProblem, CardiacElectroMechanicsProblem< DIM >::mWriteOutput, and QuadraturePointsGroup< DIM >::Size().
Referenced by CardiacElectroMechanicsProblem< DIM >::Solve().
void CardiacElectroMechanicsProblem< DIM >::Solve | ( | ) | [inline] |
Solve the electromechanics problem
Definition at line 334 of file CardiacElectroMechanicsProblem.cpp.
References BoundaryConditionsContainer< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::DefineZeroNeumannOnMeshBoundary(), CardiacElectroMechanicsProblem< DIM >::Initialise(), LogFile::Instance(), CardiacElectroMechanicsProblem< DIM >::mElectricsTimeStep, CardiacElectroMechanicsProblem< DIM >::mElementAndWeightsForQuadPoints, CardiacElectroMechanicsProblem< DIM >::mEndTime, CardiacElectroMechanicsProblem< DIM >::mIsWatchedLocation, CardiacElectroMechanicsProblem< DIM >::mMechanicsTimeStep, CardiacElectroMechanicsProblem< DIM >::mNhsOdeTimeStep, CardiacElectroMechanicsProblem< DIM >::mNoElectricsOutput, CardiacElectroMechanicsProblem< DIM >::mNumElecTimestepsPerMechTimestep, CardiacElectroMechanicsProblem< DIM >::mpCardiacMechAssembler, CardiacElectroMechanicsProblem< DIM >::mpElectricsMesh, CardiacElectroMechanicsProblem< DIM >::mpMonodomainProblem, CardiacElectroMechanicsProblem< DIM >::mWriteOutput, CardiacElectroMechanicsProblem< DIM >::WRITE_EVERY_NTH_TIME, LogFile::WriteElapsedTime(), and CardiacElectroMechanicsProblem< DIM >::WriteWatchedLocationData().
void CardiacElectroMechanicsProblem< DIM >::SetNoElectricsOutput | ( | ) | [inline] |
Call to not write out voltages
Definition at line 543 of file CardiacElectroMechanicsProblem.cpp.
References CardiacElectroMechanicsProblem< DIM >::mNoElectricsOutput.
void CardiacElectroMechanicsProblem< DIM >::SetWatchedPosition | ( | c_vector< double, DIM > | watchedLocation | ) | [inline] |
Set a location to be watched - for which lots of output is given. Should correspond to nodes in both meshes.
The watched file will have rows that look like: time x_pos y_pos [z_pos] voltage Ca_i_conc.
NOTE: for the Calcium - assumes LUO_RUDY IS USED
Definition at line 549 of file CardiacElectroMechanicsProblem.cpp.
References CardiacElectroMechanicsProblem< DIM >::mIsWatchedLocation, and CardiacElectroMechanicsProblem< DIM >::mWatchedLocation.
std::vector< c_vector< double, DIM > > & CardiacElectroMechanicsProblem< DIM >::rGetDeformedPosition | ( | ) | [inline] |
Get the current deformed position of the nodes
Definition at line 556 of file CardiacElectroMechanicsProblem.cpp.
References CardiacElectroMechanicsProblem< DIM >::mpCardiacMechAssembler.
MonodomainProblem<DIM>* CardiacElectroMechanicsProblem< DIM >::mpMonodomainProblem [protected] |
The cardiac problem class
Definition at line 106 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), CardiacElectroMechanicsProblem< DIM >::Initialise(), CardiacElectroMechanicsProblem< DIM >::Solve(), CardiacElectroMechanicsProblem< DIM >::WriteWatchedLocationData(), and CardiacElectroMechanicsProblem< DIM >::~CardiacElectroMechanicsProblem().
ImplicitCardiacMechanicsAssembler<DIM>* CardiacElectroMechanicsProblem< DIM >::mpCardiacMechAssembler [protected] |
The mechanics assembler
Definition at line 108 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), CardiacElectroMechanicsProblem< DIM >::Initialise(), CardiacElectroMechanicsProblem< DIM >::rGetDeformedPosition(), CardiacElectroMechanicsProblem< DIM >::Solve(), CardiacElectroMechanicsProblem< DIM >::WriteWatchedLocationData(), and CardiacElectroMechanicsProblem< DIM >::~CardiacElectroMechanicsProblem().
double CardiacElectroMechanicsProblem< DIM >::mEndTime [protected] |
End time. The start time is assumed to be 0.0
Definition at line 111 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), and CardiacElectroMechanicsProblem< DIM >::Solve().
double CardiacElectroMechanicsProblem< DIM >::mElectricsTimeStep [protected] |
The electrics timestep.
Definition at line 113 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), and CardiacElectroMechanicsProblem< DIM >::Solve().
double CardiacElectroMechanicsProblem< DIM >::mMechanicsTimeStep [protected] |
The mechanics timestep. Needs to be a multiple of the electrics timestep
Definition at line 115 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), and CardiacElectroMechanicsProblem< DIM >::Solve().
unsigned CardiacElectroMechanicsProblem< DIM >::mNumElecTimestepsPerMechTimestep [protected] |
The number of electrics timesteps per mechanics timestep
Definition at line 117 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), and CardiacElectroMechanicsProblem< DIM >::Solve().
double CardiacElectroMechanicsProblem< DIM >::mNhsOdeTimeStep [protected] |
Timestep to use when solving NHS models (for implicit version)
Definition at line 119 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), and CardiacElectroMechanicsProblem< DIM >::Solve().
TetrahedralMesh<DIM,DIM>* CardiacElectroMechanicsProblem< DIM >::mpElectricsMesh [protected] |
The mesh for the electrics
Definition at line 122 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), CardiacElectroMechProbRegularGeom< DIM >::CardiacElectroMechProbRegularGeom(), CardiacElectroMechanicsProblem< DIM >::DetermineWatchedNodes(), CardiacElectroMechanicsProblem< DIM >::Initialise(), and CardiacElectroMechanicsProblem< DIM >::Solve().
QuadraticMesh<DIM>* CardiacElectroMechanicsProblem< DIM >::mpMechanicsMesh [protected] |
The mesh for the mechanics
Definition at line 124 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), CardiacElectroMechProbRegularGeom< DIM >::CardiacElectroMechProbRegularGeom(), CardiacElectroMechanicsProblem< DIM >::DetermineWatchedNodes(), CardiacElectroMechanicsProblem< DIM >::Initialise(), and CardiacElectroMechanicsProblem< DIM >::~CardiacElectroMechanicsProblem().
std::vector<ElementAndWeights<DIM> > CardiacElectroMechanicsProblem< DIM >::mElementAndWeightsForQuadPoints [protected] |
The (electrics-mesh) element numbers saying which element each (mechanics-mesh) gauss point is in, and the weight of that gauss point for that particular element.
Definition at line 131 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::Initialise(), and CardiacElectroMechanicsProblem< DIM >::Solve().
std::string CardiacElectroMechanicsProblem< DIM >::mOutputDirectory [protected] |
Output directory, relative to TEST_OUTPUT
Definition at line 134 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), CardiacElectroMechanicsProblem< DIM >::DetermineWatchedNodes(), and CardiacElectroMechanicsProblem< DIM >::Initialise().
std::string CardiacElectroMechanicsProblem< DIM >::mDeformationOutputDirectory [protected] |
Deformation output-sub-directory
Definition at line 136 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), and CardiacElectroMechanicsProblem< DIM >::Initialise().
bool CardiacElectroMechanicsProblem< DIM >::mWriteOutput [protected] |
Whether to write any output
Definition at line 138 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), CardiacElectroMechanicsProblem< DIM >::Initialise(), and CardiacElectroMechanicsProblem< DIM >::Solve().
bool CardiacElectroMechanicsProblem< DIM >::mNoElectricsOutput [protected] |
Whether to not write out voltages
Definition at line 140 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), CardiacElectroMechanicsProblem< DIM >::SetNoElectricsOutput(), and CardiacElectroMechanicsProblem< DIM >::Solve().
const int CardiacElectroMechanicsProblem< DIM >::WRITE_EVERY_NTH_TIME = 1 [static, protected] |
when to write output
Definition at line 143 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::Solve().
bool CardiacElectroMechanicsProblem< DIM >::mIsWatchedLocation [protected] |
Whether any location has been set to be watched (lots of output for that location
Definition at line 146 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), CardiacElectroMechanicsProblem< DIM >::DetermineWatchedNodes(), CardiacElectroMechanicsProblem< DIM >::Initialise(), CardiacElectroMechanicsProblem< DIM >::SetWatchedPosition(), CardiacElectroMechanicsProblem< DIM >::Solve(), CardiacElectroMechanicsProblem< DIM >::WriteWatchedLocationData(), and CardiacElectroMechanicsProblem< DIM >::~CardiacElectroMechanicsProblem().
c_vector<double,DIM> CardiacElectroMechanicsProblem< DIM >::mWatchedLocation [protected] |
The watched location if there is one
Definition at line 148 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::DetermineWatchedNodes(), and CardiacElectroMechanicsProblem< DIM >::SetWatchedPosition().
unsigned CardiacElectroMechanicsProblem< DIM >::mWatchedElectricsNodeIndex [protected] |
The node in the electrics mesh corresponding to the watched location
Definition at line 150 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), CardiacElectroMechanicsProblem< DIM >::DetermineWatchedNodes(), and CardiacElectroMechanicsProblem< DIM >::WriteWatchedLocationData().
unsigned CardiacElectroMechanicsProblem< DIM >::mWatchedMechanicsNodeIndex [protected] |
The node in the mechanics mesh corresponding to the watched location
Definition at line 152 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), CardiacElectroMechanicsProblem< DIM >::DetermineWatchedNodes(), and CardiacElectroMechanicsProblem< DIM >::WriteWatchedLocationData().
out_stream CardiacElectroMechanicsProblem< DIM >::mpWatchedLocationFile [protected] |
File where watched location info is written
Definition at line 154 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::DetermineWatchedNodes(), CardiacElectroMechanicsProblem< DIM >::WriteWatchedLocationData(), and CardiacElectroMechanicsProblem< DIM >::~CardiacElectroMechanicsProblem().
std::vector<unsigned> CardiacElectroMechanicsProblem< DIM >::mFixedNodes [protected] |
Nodes for which the deformation is fixed to zero
Definition at line 157 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), CardiacElectroMechProbRegularGeom< DIM >::CardiacElectroMechProbRegularGeom(), and CardiacElectroMechanicsProblem< DIM >::Initialise().