Chaste Release::3.1
|
#include <CardiacElectroMechanicsProblem.hpp>
CardiacElectroMechanicsProblem
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 contraction model) 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 contraction model (one for each point) Solve static finite elasticity problem implicity
Definition at line 94 of file CardiacElectroMechanicsProblem.hpp.
CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::CardiacElectroMechanicsProblem | ( | CompressibilityType | compressibilityType, |
ElectricsProblemType | electricsProblemType, | ||
TetrahedralMesh< DIM, DIM > * | pElectricsMesh, | ||
QuadraticMesh< DIM > * | pMechanicsMesh, | ||
AbstractCardiacCellFactory< DIM > * | pCellFactory, | ||
ElectroMechanicsProblemDefinition< DIM > * | pProblemDefinition, | ||
std::string | outputDirectory = "" |
||
) |
Constructor.
compressibilityType | Should be either INCOMPRESSIBLE or COMPRESSIBLE |
electricsProblemType | the type of electrics problem (MONODOMAIN or BIDOMAIN) |
pElectricsMesh | Mesh on which to solve electrics (Monodomain) |
pMechanicsMesh | Mesh (2nd order) on which to solve mechanics |
pCellFactory | factory to use to create cells |
pProblemDefinition | electro-mechanics problem definition |
outputDirectory | the output directory |
Definition at line 265 of file CardiacElectroMechanicsProblem.cpp.
References GenericEventHandler< 7, MechanicsEventHandler >::BeginEvent(), GenericEventHandler< 16, HeartEventHandler >::Disable(), HeartConfig::Instance(), CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mDeformationOutputDirectory, CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mHasBath, CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mLastModifiedConductivity, CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mOutputDirectory, CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mpElectricsProblem, CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mWriteOutput, GenericEventHandler< 7, MechanicsEventHandler >::Reset(), HeartConfig::SetOutputDirectory(), HeartConfig::SetOutputFilenamePrefix(), and UNSIGNED_UNSET.
CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::~CardiacElectroMechanicsProblem | ( | ) | [virtual] |
Delete allocated memory and close the watched location file
NOTE if SetWatchedLocation but not Initialise has been called, mpWatchedLocationFile will be uninitialised and using it will cause a seg fault. Hence the mpMechanicsMesh!=NULL it is true if Initialise has been called.
Definition at line 338 of file CardiacElectroMechanicsProblem.cpp.
References LogFile::Close().
void CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::DetermineWatchedNodes | ( | ) | [protected] |
Determine which node is closest to the watched location
Definition at line 61 of file CardiacElectroMechanicsProblem.cpp.
References NEVER_REACHED, OutputFileHandler::OpenOutputFile(), and UNSIGNED_UNSET.
void CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::Initialise | ( | ) |
Initialise the class. Initialises the MonodomainProblem and sets up the electrics mesh to mechanics mesh data.
Definition at line 356 of file CardiacElectroMechanicsProblem.cpp.
References EXCEPTION, HeartConfig::GetPdeTimeStep(), LogFile::Instance(), HeartConfig::Instance(), LogFile::Set(), FineCoarseMeshPair< DIM >::SetUpBoxesOnFineMesh(), AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMesh(), and LogFile::WriteHeader().
double CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::Max | ( | std::vector< double > & | vec | ) |
Short helper function - the max of a std::vector
vec | a vector of doubles |
Definition at line 966 of file CardiacElectroMechanicsProblem.cpp.
virtual void CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::OnEndOfTimeStep | ( | unsigned | counter | ) | [inline, virtual] |
Called in Solve() at the end of every time step
counter | time step |
Definition at line 291 of file CardiacElectroMechanicsProblem.hpp.
virtual void CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::PrepareForSolve | ( | ) | [inline, virtual] |
Called in Solve() before the time loop
Definition at line 285 of file CardiacElectroMechanicsProblem.hpp.
std::vector< c_vector< double, DIM > > & CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::rGetDeformedPosition | ( | ) |
Definition at line 1001 of file CardiacElectroMechanicsProblem.cpp.
c_matrix< double, DIM, DIM > & CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::rGetModifiedConductivityTensor | ( | unsigned | elementIndex, |
const c_matrix< double, DIM, DIM > & | rOriginalConductivity | ||
) |
The implementation of the pure method defined in the base class AbstractConductivityModifier. The tissue class will call this method.
elementIndex | Index of current element |
rOriginalConductivity | Reference to the original (for example, undeformed) conductivity tensor |
Definition at line 170 of file CardiacElectroMechanicsProblem.cpp.
References Inverse().
void CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::SetNoElectricsOutput | ( | ) |
Call to not write out voltages
Definition at line 977 of file CardiacElectroMechanicsProblem.cpp.
void CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::SetOutputDeformationGradientsAndStress | ( | double | timestep | ) |
Call this for a files containing the deformation gradients (F), evaluated at the centroids of element, and the 2nd PK stress for each element (averaged over the values at the quadrature points of that element), to be written,
timestep | how often to write this. Must be a multiple of the mechanics timestep. |
Definition at line 990 of file CardiacElectroMechanicsProblem.cpp.
References EXCEPTION.
void CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::SetWatchedPosition | ( | c_vector< double, DIM > | watchedLocation | ) |
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
watchedLocation | location (x,y,z) in space. Watched node is the closest to this point. |
Definition at line 983 of file CardiacElectroMechanicsProblem.cpp.
void CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::Solve | ( | ) |
Solve the electromechanics problem
Definition at line 509 of file CardiacElectroMechanicsProblem.cpp.
References PetscTools::Barrier(), GenericEventHandler< 7, MechanicsEventHandler >::BeginEvent(), PetscTools::Destroy(), GenericEventHandler< 7, MechanicsEventHandler >::EndEvent(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), HeartConfig::GetOutputDirectory(), HeartConfig::GetPdeTimeStep(), LogFile::Instance(), HeartConfig::Instance(), CommandLineArguments::Instance(), CommandLineArguments::OptionExists(), HeartConfig::Reset(), AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetInitialCondition(), AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetMatrixIsNotAssembled(), HeartConfig::SetOutputDirectory(), HeartConfig::SetPrintingTimeStep(), AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetTimes(), AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetTimeStep(), AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve(), UNSIGNED_UNSET, and LogFile::WriteElapsedTime().
void CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::WriteWatchedLocationData | ( | double | time, |
Vec | voltage | ||
) | [protected] |
Write info (x, y, [z], V) for the watched node.
time | Time-step now, to write out |
voltage | Vm vector (this is Monodomain) |
Definition at line 145 of file CardiacElectroMechanicsProblem.cpp.
CompressibilityType CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mCompressibilityType [protected] |
Either COMPRESSIBLE or INCOMPRESSIBLE
Definition at line 104 of file CardiacElectroMechanicsProblem.hpp.
std::vector<c_matrix<double,DIM,DIM> > CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mDeformationGradientsForEachMechanicsElement [protected] |
A vector of deformation gradients (each entry a matrix), one for each element in the mechanics mesh
Definition at line 174 of file CardiacElectroMechanicsProblem.hpp.
std::string CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mDeformationOutputDirectory [protected] |
Deformation output-sub-directory
Definition at line 148 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::CardiacElectroMechanicsProblem().
bool CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mHasBath [protected] |
Whether the mesh has a bath (non-active) region or not. False by default.
Definition at line 140 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::CardiacElectroMechanicsProblem().
std::vector<double> CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mInterpolatedCalciumConcs [protected] |
A cache for the interpolated calcium concentrations from electrics to mechanics mesh. Memory is allocated within Initialise(). Filled in during Solve() and passed on to the mechanics solver
Definition at line 123 of file CardiacElectroMechanicsProblem.hpp.
std::vector<double> CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mInterpolatedVoltages [protected] |
A cache for the interpolated voltages from electrics to mechanics mesh. Memory is allocated within Initialise(). Filled in during Solve() and passed on to the mechanics solver
Definition at line 129 of file CardiacElectroMechanicsProblem.hpp.
bool CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mIsWatchedLocation [protected] |
Whether any location has been set to be watched (lots of output for that location
Definition at line 158 of file CardiacElectroMechanicsProblem.hpp.
std::pair<unsigned, c_matrix<double,DIM,DIM> > CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mLastModifiedConductivity [protected] |
A pair of (element_index, deformed_conductivity) for the last element on which the deformed conductivity sigma_def = F^{-1} sigma_undef F^{-T} has been computed. Used in rGetModifiedConductivityTensor().
Definition at line 179 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::CardiacElectroMechanicsProblem().
bool CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mNoElectricsOutput [protected] |
Whether to not write out voltages
Definition at line 152 of file CardiacElectroMechanicsProblem.hpp.
unsigned CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mNumElecTimestepsPerMechTimestep [protected] |
The number of electrics timesteps per mechanics timestep
Definition at line 117 of file CardiacElectroMechanicsProblem.hpp.
unsigned CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mNumTimestepsToOutputDeformationGradientsAndStress [protected] |
How often to print the deformation gradients and stress to file (if ever)
Definition at line 169 of file CardiacElectroMechanicsProblem.hpp.
std::string CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mOutputDirectory [protected] |
Output directory, relative to TEST_OUTPUT
Definition at line 146 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::CardiacElectroMechanicsProblem().
AbstractCardiacMechanicsSolverInterface<DIM>* CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mpCardiacMechSolver [protected] |
The mechanics solver - a pointer to the part that sees the cardiac mechanics interface bit. (Object pointed to is the same as with mpMechanicsSolver)
Definition at line 111 of file CardiacElectroMechanicsProblem.hpp.
TetrahedralMesh<DIM,DIM>* CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mpElectricsMesh [protected] |
The mesh for the electrics
Definition at line 132 of file CardiacElectroMechanicsProblem.hpp.
AbstractCardiacProblem<DIM,DIM,ELEC_PROB_DIM>* CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mpElectricsProblem [protected] |
The cardiac problem class
Definition at line 107 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::CardiacElectroMechanicsProblem().
QuadraticMesh<DIM>* CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mpMechanicsMesh [protected] |
The mesh for the mechanics
Definition at line 134 of file CardiacElectroMechanicsProblem.hpp.
AbstractNonlinearElasticitySolver<DIM>* CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mpMechanicsSolver [protected] |
The mechanics solver - a pointer to the part that sees the solid mechanics solver (Object pointed to is the same as with mpCardiacMechSolver)
Definition at line 114 of file CardiacElectroMechanicsProblem.hpp.
FineCoarseMeshPair<DIM>* CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mpMeshPair [protected] |
Class wrapping both meshes, useful for transferring information
Definition at line 143 of file CardiacElectroMechanicsProblem.hpp.
ElectroMechanicsProblemDefinition<DIM>* CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mpProblemDefinition [protected] |
Object containing information about the problem to be solved
Definition at line 137 of file CardiacElectroMechanicsProblem.hpp.
out_stream CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mpWatchedLocationFile [protected] |
File where watched location info is written
Definition at line 166 of file CardiacElectroMechanicsProblem.hpp.
std::vector<double> CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mStretchesForEachMechanicsElement [protected] |
A vector of stretches (in the fibre direction), one for each element in the mechanics mesh
Definition at line 172 of file CardiacElectroMechanicsProblem.hpp.
unsigned CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mWatchedElectricsNodeIndex [protected] |
The node in the electrics mesh corresponding to the watched location
Definition at line 162 of file CardiacElectroMechanicsProblem.hpp.
c_vector<double,DIM> CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mWatchedLocation [protected] |
The watched location if there is one
Definition at line 160 of file CardiacElectroMechanicsProblem.hpp.
unsigned CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mWatchedMechanicsNodeIndex [protected] |
The node in the mechanics mesh corresponding to the watched location
Definition at line 164 of file CardiacElectroMechanicsProblem.hpp.
bool CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::mWriteOutput [protected] |
Whether to write any output
Definition at line 150 of file CardiacElectroMechanicsProblem.hpp.
Referenced by CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::CardiacElectroMechanicsProblem().
const int CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::WRITE_EVERY_NTH_TIME = 1 [static, protected] |
when to write output
Definition at line 155 of file CardiacElectroMechanicsProblem.hpp.