AbstractCardiacMechanicsSolver.hpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef ABSTRACTCARDIACMECHANICSSOLVER_HPP_
00037 #define ABSTRACTCARDIACMECHANICSSOLVER_HPP_
00038
00039 #include <map>
00040 #include "IncompressibleNonlinearElasticitySolver.hpp"
00041 #include "CompressibleNonlinearElasticitySolver.hpp"
00042 #include "QuadraticBasisFunction.hpp"
00043 #include "LinearBasisFunction.hpp"
00044 #include "AbstractContractionModel.hpp"
00045 #include "FibreReader.hpp"
00046 #include "FineCoarseMeshPair.hpp"
00047 #include "AbstractCardiacMechanicsSolverInterface.hpp"
00048 #include "HeartRegionCodes.hpp"
00049 #include "ElectroMechanicsProblemDefinition.hpp"
00050
00051
00058 typedef struct DataAtQuadraturePoint_
00059 {
00060 AbstractContractionModel* ContractionModel;
00061
00062 double Stretch;
00063 double StretchLastTimeStep;
00065 } DataAtQuadraturePoint;
00066
00067
00080 template<class ELASTICITY_SOLVER, unsigned DIM>
00081 class AbstractCardiacMechanicsSolver : public ELASTICITY_SOLVER, public AbstractCardiacMechanicsSolverInterface<DIM>
00082 {
00083 protected:
00084 static const unsigned NUM_VERTICES_PER_ELEMENT = ELASTICITY_SOLVER::NUM_VERTICES_PER_ELEMENT;
00096 std::map<unsigned,DataAtQuadraturePoint> mQuadPointToDataAtQuadPointMap;
00097
00101 std::map<unsigned,DataAtQuadraturePoint>::iterator mMapIterator;
00102
00104 FineCoarseMeshPair<DIM>* mpMeshPair;
00105
00107 unsigned mTotalQuadPoints;
00108
00110 double mCurrentTime;
00111
00113 double mNextTime;
00114
00116 double mOdeTimestep;
00117
00122 c_matrix<double,DIM,DIM> mConstantFibreSheetDirections;
00123
00128 std::vector<c_matrix<double,DIM,DIM> >* mpVariableFibreSheetDirections;
00129
00134 bool mFibreSheetDirectionsDefinedByQuadraturePoint;
00135
00137 c_vector<double,DIM> mCurrentElementFibreDirection;
00138
00140 c_vector<double,DIM> mCurrentElementSheetDirection;
00141
00143 c_vector<double,DIM> mCurrentElementSheetNormalDirection;
00144
00145
00149 ElectroMechanicsProblemDefinition<DIM>& mrElectroMechanicsProblemDefinition;
00150
00155 virtual bool IsImplicitSolver()=0;
00156
00157
00172 void AddActiveStressAndStressDerivative(c_matrix<double,DIM,DIM>& rC,
00173 unsigned elementIndex,
00174 unsigned currentQuadPointGlobalIndex,
00175 c_matrix<double,DIM,DIM>& rT,
00176 FourthOrderTensor<DIM,DIM,DIM,DIM>& rDTdE,
00177 bool addToDTdE);
00178
00179
00187 void SetupChangeOfBasisMatrix(unsigned elementIndex, unsigned currentQuadPointGlobalIndex);
00188
00194 void Initialise();
00195
00208 virtual void GetActiveTensionAndTensionDerivs(double currentFibreStretch,
00209 unsigned currentQuadPointGlobalIndex,
00210 bool assembleJacobian,
00211 double& rActiveTension,
00212 double& rDerivActiveTensionWrtLambda,
00213 double& rDerivActiveTensionWrtDLambdaDt)=0;
00214 public:
00222 AbstractCardiacMechanicsSolver(QuadraticMesh<DIM>& rQuadMesh,
00223 ElectroMechanicsProblemDefinition<DIM>& rProblemDefinition,
00224 std::string outputDirectory);
00225
00229 virtual ~AbstractCardiacMechanicsSolver();
00230
00238 void SetFineCoarseMeshPair(FineCoarseMeshPair<DIM>* pMeshPair);
00239
00241 unsigned GetTotalNumQuadPoints()
00242 {
00243 return mTotalQuadPoints;
00244 }
00245
00247 virtual GaussianQuadratureRule<DIM>* GetQuadratureRule()
00248 {
00249 return this->mpQuadratureRule;
00250 }
00251
00255 std::map<unsigned,DataAtQuadraturePoint>& rGetQuadPointToDataAtQuadPointMap()
00256 {
00257 return mQuadPointToDataAtQuadPointMap;
00258 }
00259
00260
00267 void SetConstantFibreSheetDirections(const c_matrix<double,DIM,DIM>& rFibreSheetMatrix);
00268
00280 void SetVariableFibreSheetDirections(const FileFinder& rOrthoFile, bool definedPerQuadraturePoint);
00281
00294 void SetCalciumAndVoltage(std::vector<double>& rCalciumConcentrations,
00295 std::vector<double>& rVoltages);
00296
00304 virtual void Solve(double time, double nextTime, double odeTimestep)=0;
00305
00306
00307
00327 void ComputeDeformationGradientAndStretchInEachElement(std::vector<c_matrix<double,DIM,DIM> >& rDeformationGradients,
00328 std::vector<double>& rStretches);
00329 };
00330
00331
00332 #endif