CardiacElectroMechanicsProblem< DIM > Class Template Reference

#include <CardiacElectroMechanicsProblem.hpp>

Inherits AbstractConductivityModifier< DIM, DIM >.

Inherited by CardiacElectroMechProbRegularGeom< DIM >.

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

List of all members.

Public Member Functions

 CardiacElectroMechanicsProblem (CompressibilityType compressibilityType, TetrahedralMesh< DIM, DIM > *pElectricsMesh, QuadraticMesh< DIM > *pMechanicsMesh, AbstractCardiacCellFactory< DIM > *pCellFactory, ElectroMechanicsProblemDefinition< DIM > *pProblemDefinition, 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 ()
c_matrix< double, DIM, DIM > & rGetModifiedConductivityTensor (unsigned elementIndex, const c_matrix< double, DIM, DIM > &rOriginalConductivity)
virtual void PrepareForSolve ()
virtual void OnEndOfTimeStep (unsigned counter)

Protected Member Functions

void DetermineWatchedNodes ()
void WriteWatchedLocationData (double time, Vec voltage)

Protected Attributes

CompressibilityType mCompressibilityType
MonodomainProblem< DIM > * mpMonodomainProblem
AbstractCardiacMechanicsSolverInterface
< DIM > * 
mpCardiacMechSolver
AbstractNonlinearElasticitySolver
< DIM > * 
mpMechanicsSolver
unsigned mNumElecTimestepsPerMechTimestep
TetrahedralMesh< DIM, DIM > * mpElectricsMesh
QuadraticMesh< DIM > * mpMechanicsMesh
ElectroMechanicsProblemDefinition
< DIM > * 
mpProblemDefinition
FineCoarseMeshPair< DIM > * mpMeshPair
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< doublemStretchesForEachMechanicsElement
std::vector< c_matrix< double,
DIM, DIM > > 
mDeformationGradientsForEachMechanicsElement
std::pair< unsigned, c_matrix
< double, DIM, DIM > > 
mLastModifiedConductivity

Static Protected Attributes

static const int WRITE_EVERY_NTH_TIME = 1

Friends

class TestCardiacElectroMechanicsProblem
class TestCardiacElectroMechanicsFurtherFunctionality

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 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 74 of file CardiacElectroMechanicsProblem.hpp.


Constructor & Destructor Documentation

template<unsigned DIM>
CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem ( CompressibilityType  compressibilityType,
TetrahedralMesh< DIM, DIM > *  pElectricsMesh,
QuadraticMesh< DIM > *  pMechanicsMesh,
AbstractCardiacCellFactory< DIM > *  pCellFactory,
ElectroMechanicsProblemDefinition< DIM > *  pProblemDefinition,
std::string  outputDirectory = "" 
) [inline]

Constructor.

Parameters:
compressibilityType Should be either INCOMPRESSIBLE or COMPRESSIBLE
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 224 of file CardiacElectroMechanicsProblem.cpp.

References GenericEventHandler< 7, MechanicsEventHandler >::BeginEvent(), GenericEventHandler< 16, HeartEventHandler >::Disable(), HeartConfig::Instance(), CardiacElectroMechanicsProblem< DIM >::mDeformationOutputDirectory, CardiacElectroMechanicsProblem< DIM >::mLastModifiedConductivity, CardiacElectroMechanicsProblem< DIM >::mOutputDirectory, CardiacElectroMechanicsProblem< DIM >::mpMonodomainProblem, CardiacElectroMechanicsProblem< DIM >::mWriteOutput, GenericEventHandler< 7, MechanicsEventHandler >::Reset(), HeartConfig::SetOutputDirectory(), HeartConfig::SetOutputFilenamePrefix(), and UNSIGNED_UNSET.

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.

Definition at line 290 of file CardiacElectroMechanicsProblem.cpp.

References LogFile::Close(), CardiacElectroMechanicsProblem< DIM >::mIsWatchedLocation, CardiacElectroMechanicsProblem< DIM >::mpCardiacMechSolver, CardiacElectroMechanicsProblem< DIM >::mpMechanicsMesh, CardiacElectroMechanicsProblem< DIM >::mpMeshPair, 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 >::Initialise (  )  [inline]

Initialise the class. Initialises the MonodomainProblem and sets up the electrics mesh to mechanics mesh data.

Definition at line 308 of file CardiacElectroMechanicsProblem.cpp.

References CardiacElectroMechanicsProblem< DIM >::DetermineWatchedNodes(), EXCEPTION, MonodomainProblem< ELEMENT_DIM, SPACE_DIM >::GetMonodomainTissue(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), HeartConfig::GetPdeTimeStep(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Initialise(), LogFile::Instance(), HeartConfig::Instance(), CardiacElectroMechanicsProblem< DIM >::mCompressibilityType, CardiacElectroMechanicsProblem< DIM >::mDeformationGradientsForEachMechanicsElement, CardiacElectroMechanicsProblem< DIM >::mDeformationOutputDirectory, CardiacElectroMechanicsProblem< DIM >::mIsWatchedLocation, CardiacElectroMechanicsProblem< DIM >::mNumElecTimestepsPerMechTimestep, CardiacElectroMechanicsProblem< DIM >::mOutputDirectory, CardiacElectroMechanicsProblem< DIM >::mpCardiacMechSolver, CardiacElectroMechanicsProblem< DIM >::mpElectricsMesh, CardiacElectroMechanicsProblem< DIM >::mpMechanicsMesh, CardiacElectroMechanicsProblem< DIM >::mpMechanicsSolver, CardiacElectroMechanicsProblem< DIM >::mpMeshPair, CardiacElectroMechanicsProblem< DIM >::mpMonodomainProblem, CardiacElectroMechanicsProblem< DIM >::mpProblemDefinition, CardiacElectroMechanicsProblem< DIM >::mStretchesForEachMechanicsElement, CardiacElectroMechanicsProblem< DIM >::mWriteOutput, LogFile::Set(), AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::SetConductivityModifier(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetMesh(), AbstractTetrahedralMeshWriter< ELEMENT_DIM, SPACE_DIM >::WriteFilesUsingMesh(), and LogFile::WriteHeader().

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

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

Short helper function - the max of a std::vector

Parameters:
vec a vector of doubles

Definition at line 779 of file CardiacElectroMechanicsProblem.cpp.

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

template<unsigned DIM>
virtual void CardiacElectroMechanicsProblem< DIM >::OnEndOfTimeStep ( unsigned  counter  )  [inline, virtual]

Called in Solve() at the end of every time step

Parameters:
counter time step

Definition at line 251 of file CardiacElectroMechanicsProblem.hpp.

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

template<unsigned DIM>
virtual void CardiacElectroMechanicsProblem< DIM >::PrepareForSolve (  )  [inline, virtual]

Called in Solve() before the time loop

Definition at line 245 of file CardiacElectroMechanicsProblem.hpp.

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

template<unsigned DIM>
std::vector< c_vector< double, DIM > > & CardiacElectroMechanicsProblem< DIM >::rGetDeformedPosition (  )  [inline]
Returns:
the current deformed position of the nodes

Definition at line 804 of file CardiacElectroMechanicsProblem.cpp.

References CardiacElectroMechanicsProblem< DIM >::mpMechanicsSolver.

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

template<unsigned DIM>
c_matrix< double, DIM, DIM > & CardiacElectroMechanicsProblem< DIM >::rGetModifiedConductivityTensor ( unsigned  elementIndex,
const c_matrix< double, DIM, DIM > &  rOriginalConductivity 
) [inline]

The implementation of the pure method defined in the base class AbstractConductivityModifier. The tissue class will call this method.

Parameters:
elementIndex Index of current element
rOriginalConductivity Reference to the original (for example, undeformed) conductivity tensor
Returns:
Reference to a modified conductivity tensor.

Definition at line 162 of file CardiacElectroMechanicsProblem.cpp.

References Inverse(), CardiacElectroMechanicsProblem< DIM >::mDeformationGradientsForEachMechanicsElement, CardiacElectroMechanicsProblem< DIM >::mLastModifiedConductivity, and CardiacElectroMechanicsProblem< DIM >::mpMeshPair.

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

Call to not write out voltages

Definition at line 790 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 796 of file CardiacElectroMechanicsProblem.cpp.

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

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

Solve the electromechanics problem

Definition at line 454 of file CardiacElectroMechanicsProblem.cpp.

References Hdf5DataWriter::AdvanceAlongUnlimitedDimension(), PetscTools::Barrier(), GenericEventHandler< 7, MechanicsEventHandler >::BeginEvent(), Hdf5DataWriter::Close(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::CreateInitialCondition(), MonodomainProblem< ELEMENT_DIM, SPACE_DIM >::CreateSolver(), GenericEventHandler< 7, MechanicsEventHandler >::EndEvent(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetDistributedVectorFactory(), AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM >::GetElement(), DistributedVectorFactory::GetHigh(), DistributedVectorFactory::GetLow(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNodeGlobalIndex(), AbstractElement< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), AbstractMesh< ELEMENT_DIM, SPACE_DIM >::GetNumNodes(), HeartConfig::GetOutputDirectory(), HeartConfig::GetPdeTimeStep(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::GetTissue(), CardiacElectroMechanicsProblem< DIM >::Initialise(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::InitialiseWriter(), LogFile::Instance(), HeartConfig::Instance(), CardiacElectroMechanicsProblem< DIM >::Max(), CardiacElectroMechanicsProblem< DIM >::mDeformationGradientsForEachMechanicsElement, CardiacElectroMechanicsProblem< DIM >::mIsWatchedLocation, CardiacElectroMechanicsProblem< DIM >::mNoElectricsOutput, CardiacElectroMechanicsProblem< DIM >::mNumElecTimestepsPerMechTimestep, CardiacElectroMechanicsProblem< DIM >::mOutputDirectory, CardiacElectroMechanicsProblem< DIM >::mpCardiacMechSolver, CardiacElectroMechanicsProblem< DIM >::mpElectricsMesh, CardiacElectroMechanicsProblem< DIM >::mpMechanicsMesh, CardiacElectroMechanicsProblem< DIM >::mpMechanicsSolver, CardiacElectroMechanicsProblem< DIM >::mpMeshPair, CardiacElectroMechanicsProblem< DIM >::mpMonodomainProblem, CardiacElectroMechanicsProblem< DIM >::mpProblemDefinition, AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpWriter, CardiacElectroMechanicsProblem< DIM >::mStretchesForEachMechanicsElement, CardiacElectroMechanicsProblem< DIM >::mWriteOutput, CardiacElectroMechanicsProblem< DIM >::OnEndOfTimeStep(), CardiacElectroMechanicsProblem< DIM >::PrepareForSolve(), HeartConfig::Reset(), CardiacElectroMechanicsProblem< DIM >::rGetDeformedPosition(), AbstractCardiacProblem< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetBoundaryConditionsContainer(), 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(), CardiacElectroMechanicsProblem< DIM >::WRITE_EVERY_NTH_TIME, LogFile::WriteElapsedTime(), MonodomainProblem< ELEMENT_DIM, SPACE_DIM >::WriteOneStep(), and CardiacElectroMechanicsProblem< DIM >::WriteWatchedLocationData().

template<unsigned DIM>
void CardiacElectroMechanicsProblem< DIM >::WriteWatchedLocationData ( double  time,
Vec  voltage 
) [inline, protected]

Member Data Documentation

template<unsigned DIM>
CompressibilityType CardiacElectroMechanicsProblem< DIM >::mCompressibilityType [protected]

Either COMPRESSIBLE or INCOMPRESSIBLE

Definition at line 84 of file CardiacElectroMechanicsProblem.hpp.

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

template<unsigned DIM>
std::vector<c_matrix<double,DIM,DIM> > CardiacElectroMechanicsProblem< DIM >::mDeformationGradientsForEachMechanicsElement [protected]

A vector of deformation gradients (each entry a matrix), one for each element in the mechanics mesh

Definition at line 138 of file CardiacElectroMechanicsProblem.hpp.

Referenced by CardiacElectroMechanicsProblem< DIM >::Initialise(), CardiacElectroMechanicsProblem< DIM >::rGetModifiedConductivityTensor(), and CardiacElectroMechanicsProblem< DIM >::Solve().

template<unsigned DIM>
std::string CardiacElectroMechanicsProblem< DIM >::mDeformationOutputDirectory [protected]
template<unsigned DIM>
bool CardiacElectroMechanicsProblem< DIM >::mIsWatchedLocation [protected]
template<unsigned DIM>
std::pair<unsigned, c_matrix<double,DIM,DIM> > CardiacElectroMechanicsProblem< 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 143 of file CardiacElectroMechanicsProblem.hpp.

Referenced by CardiacElectroMechanicsProblem< DIM >::CardiacElectroMechanicsProblem(), and CardiacElectroMechanicsProblem< DIM >::rGetModifiedConductivityTensor().

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

The number of electrics timesteps per mechanics timestep

Definition at line 97 of file CardiacElectroMechanicsProblem.hpp.

Referenced by CardiacElectroMechanicsProblem< DIM >::Initialise(), and CardiacElectroMechanicsProblem< DIM >::Solve().

template<unsigned DIM>
std::string CardiacElectroMechanicsProblem< DIM >::mOutputDirectory [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 91 of file CardiacElectroMechanicsProblem.hpp.

Referenced by CardiacElectroMechanicsProblem< DIM >::Initialise(), CardiacElectroMechanicsProblem< DIM >::Solve(), and CardiacElectroMechanicsProblem< DIM >::~CardiacElectroMechanicsProblem().

template<unsigned DIM>
TetrahedralMesh<DIM,DIM>* CardiacElectroMechanicsProblem< DIM >::mpElectricsMesh [protected]
template<unsigned DIM>
QuadraticMesh<DIM>* CardiacElectroMechanicsProblem< DIM >::mpMechanicsMesh [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 94 of file CardiacElectroMechanicsProblem.hpp.

Referenced by CardiacElectroMechanicsProblem< DIM >::Initialise(), CardiacElectroMechanicsProblem< DIM >::rGetDeformedPosition(), CardiacElectroMechanicsProblem< DIM >::Solve(), and CardiacElectroMechanicsProblem< DIM >::WriteWatchedLocationData().

template<unsigned DIM>
FineCoarseMeshPair<DIM>* CardiacElectroMechanicsProblem< DIM >::mpMeshPair [protected]
template<unsigned DIM>
MonodomainProblem<DIM>* CardiacElectroMechanicsProblem< DIM >::mpMonodomainProblem [protected]
template<unsigned DIM>
out_stream CardiacElectroMechanicsProblem< DIM >::mpWatchedLocationFile [protected]
template<unsigned DIM>
std::vector<double> CardiacElectroMechanicsProblem< DIM >::mStretchesForEachMechanicsElement [protected]

A vector of stretches (in the fibre direction), one for each element in the mechanics mesh

Definition at line 136 of file CardiacElectroMechanicsProblem.hpp.

Referenced by CardiacElectroMechanicsProblem< DIM >::Initialise(), and CardiacElectroMechanicsProblem< DIM >::Solve().

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

The node in the electrics mesh corresponding to the watched location

Definition at line 129 of file CardiacElectroMechanicsProblem.hpp.

Referenced by CardiacElectroMechanicsProblem< DIM >::DetermineWatchedNodes(), and CardiacElectroMechanicsProblem< DIM >::WriteWatchedLocationData().

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

The node in the mechanics mesh corresponding to the watched location

Definition at line 131 of file CardiacElectroMechanicsProblem.hpp.

Referenced by CardiacElectroMechanicsProblem< DIM >::DetermineWatchedNodes(), and CardiacElectroMechanicsProblem< DIM >::WriteWatchedLocationData().

template<unsigned DIM>
bool CardiacElectroMechanicsProblem< DIM >::mWriteOutput [protected]
template<unsigned DIM>
const int CardiacElectroMechanicsProblem< DIM >::WRITE_EVERY_NTH_TIME = 1 [static, protected]

when to write output

Definition at line 122 of file CardiacElectroMechanicsProblem.hpp.

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


The documentation for this class was generated from the following files:
Generated on Thu Dec 22 13:03:10 2011 for Chaste by  doxygen 1.6.3