ExplicitCardiacMechanicsSolver.cpp
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 #include "ExplicitCardiacMechanicsSolver.hpp"
00037
00038 template<class ELASTICITY_SOLVER,unsigned DIM>
00039 ExplicitCardiacMechanicsSolver<ELASTICITY_SOLVER,DIM>::ExplicitCardiacMechanicsSolver(QuadraticMesh<DIM>& rQuadMesh,
00040 ElectroMechanicsProblemDefinition<DIM>& rProblemDefinition,
00041 std::string outputDirectory)
00042 : AbstractCardiacMechanicsSolver<ELASTICITY_SOLVER,DIM>(rQuadMesh,
00043 rProblemDefinition,
00044 outputDirectory)
00045 {
00046
00047 }
00048
00049 template<class ELASTICITY_SOLVER,unsigned DIM>
00050 ExplicitCardiacMechanicsSolver<ELASTICITY_SOLVER,DIM>::~ExplicitCardiacMechanicsSolver()
00051 {
00052 }
00053
00054 template<class ELASTICITY_SOLVER,unsigned DIM>
00055 void ExplicitCardiacMechanicsSolver<ELASTICITY_SOLVER,DIM>::GetActiveTensionAndTensionDerivs(double currentFibreStretch,
00056 unsigned currentQuadPointGlobalIndex,
00057 bool assembleJacobian,
00058 double& rActiveTension,
00059 double& rDerivActiveTensionWrtLambda,
00060 double& rDerivActiveTensionWrtDLambdaDt)
00061 {
00062
00063
00064 assert(this->mMapIterator->first==currentQuadPointGlobalIndex);
00065 DataAtQuadraturePoint& r_data_at_quad_point = this->mMapIterator->second;
00066
00067
00068
00069 rActiveTension = r_data_at_quad_point.ContractionModel->GetActiveTension();
00070
00071
00072 rDerivActiveTensionWrtLambda = 0.0;
00073 rDerivActiveTensionWrtDLambdaDt = 0.0;
00074
00075
00076
00077 r_data_at_quad_point.Stretch = currentFibreStretch;
00078
00079
00080 this->mMapIterator++;
00081 if(this->mMapIterator==this->mQuadPointToDataAtQuadPointMap.end())
00082 {
00083 this->mMapIterator = this->mQuadPointToDataAtQuadPointMap.begin();
00084 }
00085
00086 }
00087
00088 template<class ELASTICITY_SOLVER,unsigned DIM>
00089 void ExplicitCardiacMechanicsSolver<ELASTICITY_SOLVER,DIM>::Solve(double time, double nextTime, double odeTimestep)
00090 {
00091 assert(time < nextTime);
00092 this->mCurrentTime = time;
00093 this->mNextTime = nextTime;
00094 this->mOdeTimestep = odeTimestep;
00095
00096
00097
00098 this->AssembleSystem(true,false);
00099
00100
00101 for(std::map<unsigned,DataAtQuadraturePoint>::iterator iter = this->mQuadPointToDataAtQuadPointMap.begin();
00102 iter != this->mQuadPointToDataAtQuadPointMap.end();
00103 iter++)
00104 {
00105 AbstractContractionModel* p_contraction_model = iter->second.ContractionModel;
00106 double stretch = iter->second.Stretch;
00107 p_contraction_model->SetStretchAndStretchRate(stretch, 0.0 );
00108 p_contraction_model->RunAndUpdate(time, nextTime, odeTimestep);
00109 }
00110
00111
00112 ELASTICITY_SOLVER::Solve();
00113 }
00114
00115
00116
00117 template class ExplicitCardiacMechanicsSolver<IncompressibleNonlinearElasticitySolver<2>,2>;
00118 template class ExplicitCardiacMechanicsSolver<IncompressibleNonlinearElasticitySolver<3>,3>;
00119 template class ExplicitCardiacMechanicsSolver<CompressibleNonlinearElasticitySolver<2>,2>;
00120 template class ExplicitCardiacMechanicsSolver<CompressibleNonlinearElasticitySolver<3>,3>;