CardiacElectroMechanicsProblem< DIM > Class Template Reference

#include <CardiacElectroMechanicsProblem.hpp>

Inheritance diagram for CardiacElectroMechanicsProblem< DIM >:

Inheritance graph
[legend]
Collaboration diagram for CardiacElectroMechanicsProblem< DIM >:

Collaboration graph
[legend]

List of all members.

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


Detailed Description

template<unsigned DIM>
class CardiacElectroMechanicsProblem< DIM >

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 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.


Constructor & Destructor Documentation

template<unsigned DIM>
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.

Parameters:
pElectricsMesh Mesh on which to solve electrics (Monodomain)
pMechanicsMesh Mesh (2nd order) on which to solve mechanics
fixedMechanicsNodes Indices of those nodes which a pinned in space
pCellFactory factory to use to create cells
endTime the end time to use
numElecTimeStepsPerMechTimestep simple ratio
nhsOdeTimeStep Step size for NHS (Niederer, Hunter, Smith) model of active tension in cardiac cells.
outputDirectory the output directory

Todo:
Cover these lines

Definition at line 162 of file CardiacElectroMechanicsProblem.cpp.

References GenericEventHandler< 7, MechanicsEventHandler >::BeginEvent(), GenericEventHandler< 11, HeartEventHandler >::Disable(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), LogFile::Instance(), HeartConfig::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, GenericEventHandler< 7, MechanicsEventHandler >::Reset(), LogFile::Set(), HeartConfig::SetOutputDirectory(), HeartConfig::SetOutputFilenamePrefix(), and LogFile::WriteHeader().

template<unsigned DIM>
CardiacElectroMechanicsProblem< DIM >::~CardiacElectroMechanicsProblem (  )  [inline, 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.

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 247 of file CardiacElectroMechanicsProblem.cpp.

References LogFile::Close(), CardiacElectroMechanicsProblem< DIM >::mIsWatchedLocation, CardiacElectroMechanicsProblem< DIM >::mpCardiacMechAssembler, CardiacElectroMechanicsProblem< DIM >::mpMechanicsMesh, CardiacElectroMechanicsProblem< DIM >::mpMonodomainProblem, and CardiacElectroMechanicsProblem< DIM >::mpWatchedLocationFile.


Member Function Documentation

template<unsigned DIM>
void CardiacElectroMechanicsProblem< DIM >::DetermineWatchedNodes (  )  [inline, protected]

template<unsigned DIM>
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

Parameters:
time Time-step now, to write out
voltage Vm vector (this is Monodomain)

Todo:
Improve efficiency of this method?

Todo:
: NOTE!!! HARDCODED state variable index - assumes Lr91. Metadata is currently being added to CellML models and then this will be avoided by asking for Calcium.

Definition at line 135 of file CardiacElectroMechanicsProblem.cpp.

References AbstractCardiacPde< ELEM_DIM, SPACE_DIM >::GetCardiacCell(), MonodomainProblem< ELEM_DIM, SPACE_DIM >::GetMonodomainPde(), CardiacElectroMechanicsProblem< DIM >::mIsWatchedLocation, CardiacElectroMechanicsProblem< DIM >::mpCardiacMechAssembler, CardiacElectroMechanicsProblem< DIM >::mpMonodomainProblem, CardiacElectroMechanicsProblem< DIM >::mpWatchedLocationFile, CardiacElectroMechanicsProblem< DIM >::mWatchedElectricsNodeIndex, CardiacElectroMechanicsProblem< DIM >::mWatchedMechanicsNodeIndex, and AbstractOdeSystem::rGetStateVariables().

Referenced by CardiacElectroMechanicsProblem< DIM >::Solve().

template<unsigned DIM>
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 266 of file CardiacElectroMechanicsProblem.cpp.

References CardiacElectroMechanicsProblem< DIM >::DetermineWatchedNodes(), QuadraturePointsGroup< DIM >::Get(), TetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetContainingElementIndex(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElement(), AbstractCardiacProblem< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::Initialise(), HeartConfig::Instance(), 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, ChastePoint< DIM >::rGetLocation(), HeartConfig::SetIntracellularConductivities(), AbstractCardiacProblem< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::SetMesh(), QuadraturePointsGroup< DIM >::Size(), and AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMesh().

Referenced by CardiacElectroMechanicsProblem< DIM >::Solve().

template<unsigned DIM>
void CardiacElectroMechanicsProblem< DIM >::Solve (  )  [inline]

Solve the electromechanics problem

Definition at line 335 of file CardiacElectroMechanicsProblem.cpp.

References Hdf5DataWriter::AdvanceAlongUnlimitedDimension(), TimeStepper::AdvanceOneTimeStep(), PetscTools::AmMaster(), GenericEventHandler< 7, MechanicsEventHandler >::BeginEvent(), Hdf5DataWriter::Close(), MonodomainProblem< ELEM_DIM, SPACE_DIM >::CreateAssembler(), AbstractCardiacProblem< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::CreateInitialCondition(), BoundaryConditionsContainer< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::DefineZeroNeumannOnMeshBoundary(), GenericEventHandler< 7, MechanicsEventHandler >::EndEvent(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElement(), TimeStepper::GetNextTime(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), HeartConfig::GetOutputDirectory(), AbstractCardiacProblem< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::GetPde(), TimeStepper::GetTime(), CardiacElectroMechanicsProblem< DIM >::Initialise(), AbstractCardiacProblem< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::InitialiseWriter(), HeartConfig::Instance(), LogFile::Instance(), TimeStepper::IsTimeAtEnd(), CardiacElectroMechanicsProblem< DIM >::Max(), 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 >::mOutputDirectory, CardiacElectroMechanicsProblem< DIM >::mpCardiacMechAssembler, CardiacElectroMechanicsProblem< DIM >::mpElectricsMesh, CardiacElectroMechanicsProblem< DIM >::mpMonodomainProblem, AbstractCardiacProblem< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::mpWriter, CardiacElectroMechanicsProblem< DIM >::mWriteOutput, HeartConfig::Reset(), AbstractCardiacProblem< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::SetBoundaryConditionsContainer(), AbstractDynamicAssemblerMixin< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetInitialCondition(), HeartConfig::SetOutputDirectory(), AbstractDynamicAssemblerMixin< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetTimes(), AbstractDynamicAssemblerMixin< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve(), HeartConfig::Write(), CardiacElectroMechanicsProblem< DIM >::WRITE_EVERY_NTH_TIME, LogFile::WriteElapsedTime(), AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMesh(), AbstractCardiacProblem< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::WriteOneStep(), and CardiacElectroMechanicsProblem< DIM >::WriteWatchedLocationData().

template<unsigned DIM>
double CardiacElectroMechanicsProblem< DIM >::Max ( std::vector< double > &  vec  )  [inline]

Short helper function - the max of a std::vec.

Todo:
Move to UblasCustomFunctions?
Parameters:
vec a vector of doubles

Definition at line 541 of file CardiacElectroMechanicsProblem.cpp.

Referenced by CardiacElectroMechanicsProblem< DIM >::Solve().

template<unsigned DIM>
void CardiacElectroMechanicsProblem< DIM >::SetNoElectricsOutput (  )  [inline]

Call to not write out voltages

Definition at line 552 of file CardiacElectroMechanicsProblem.cpp.

References CardiacElectroMechanicsProblem< DIM >::mNoElectricsOutput.

template<unsigned DIM>
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

Parameters:
watchedLocation location (x,y,z) in space. Watched node is the closest to this point.

Definition at line 558 of file CardiacElectroMechanicsProblem.cpp.

References CardiacElectroMechanicsProblem< DIM >::mIsWatchedLocation, and CardiacElectroMechanicsProblem< DIM >::mWatchedLocation.

template<unsigned DIM>
std::vector< c_vector< double, DIM > > & CardiacElectroMechanicsProblem< DIM >::rGetDeformedPosition (  )  [inline]

Returns:
the current deformed position of the nodes

Definition at line 565 of file CardiacElectroMechanicsProblem.cpp.

References CardiacElectroMechanicsProblem< DIM >::mpCardiacMechAssembler.


Member Data Documentation

template<unsigned DIM>
MonodomainProblem<DIM>* CardiacElectroMechanicsProblem< DIM >::mpMonodomainProblem [protected]

template<unsigned DIM>
double CardiacElectroMechanicsProblem< DIM >::mEndTime [protected]

template<unsigned DIM>
double CardiacElectroMechanicsProblem< DIM >::mElectricsTimeStep [protected]

template<unsigned DIM>
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().

template<unsigned DIM>
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().

template<unsigned DIM>
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().

template<unsigned DIM>
TetrahedralMesh<DIM,DIM>* CardiacElectroMechanicsProblem< DIM >::mpElectricsMesh [protected]

template<unsigned DIM>
QuadraticMesh<DIM>* CardiacElectroMechanicsProblem< DIM >::mpMechanicsMesh [protected]

template<unsigned DIM>
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().

template<unsigned DIM>
std::string CardiacElectroMechanicsProblem< DIM >::mOutputDirectory [protected]

template<unsigned DIM>
std::string CardiacElectroMechanicsProblem< DIM >::mDeformationOutputDirectory [protected]

template<unsigned DIM>
bool CardiacElectroMechanicsProblem< DIM >::mWriteOutput [protected]

template<unsigned DIM>
bool CardiacElectroMechanicsProblem< DIM >::mNoElectricsOutput [protected]

template<unsigned DIM>
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().

template<unsigned DIM>
bool CardiacElectroMechanicsProblem< DIM >::mIsWatchedLocation [protected]

template<unsigned DIM>
c_vector<double,DIM> CardiacElectroMechanicsProblem< DIM >::mWatchedLocation [protected]

template<unsigned DIM>
unsigned CardiacElectroMechanicsProblem< DIM >::mWatchedElectricsNodeIndex [protected]

template<unsigned DIM>
unsigned CardiacElectroMechanicsProblem< DIM >::mWatchedMechanicsNodeIndex [protected]

template<unsigned DIM>
out_stream CardiacElectroMechanicsProblem< DIM >::mpWatchedLocationFile [protected]

template<unsigned DIM>
std::vector<unsigned> CardiacElectroMechanicsProblem< DIM >::mFixedNodes [protected]


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

Generated on Tue Aug 4 16:11:04 2009 for Chaste by  doxygen 1.5.5