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 #include "ExplicitCardiacMechanicsSolver.hpp"
00030 #include "Nash2004ContractionModel.hpp"
00031 #include "Kerchoffs2003ContractionModel.hpp"
00032 #include "NonPhysiologicalContractionModel.hpp"
00033
00035
00036
00037 template<class ELASTICITY_SOLVER,unsigned DIM>
00038 ExplicitCardiacMechanicsSolver<ELASTICITY_SOLVER,DIM>::ExplicitCardiacMechanicsSolver(ContractionModel contractionModel,
00039 QuadraticMesh<DIM>* pQuadMesh,
00040 std::string outputDirectory,
00041 std::vector<unsigned>& rFixedNodes,
00042 AbstractMaterialLaw<DIM>* pMaterialLaw)
00043 : AbstractCardiacMechanicsSolver<ELASTICITY_SOLVER,DIM>(pQuadMesh,
00044 outputDirectory,
00045 rFixedNodes,
00046 pMaterialLaw)
00047 {
00048 switch(contractionModel)
00049 {
00050 case NONPHYSIOL1:
00051 case NONPHYSIOL2:
00052 case NONPHYSIOL3:
00053 {
00054 unsigned option = (contractionModel==NONPHYSIOL1 ? 1 : (contractionModel==NONPHYSIOL2? 2 : 3));
00055 for(unsigned i=0; i<this->mTotalQuadPoints; i++)
00056 {
00057 this->mContractionModelSystems.push_back(new NonPhysiologicalContractionModel(option));
00058 }
00059 break;
00060 }
00061 case NASH2004:
00062 {
00063 for(unsigned i=0; i<this->mTotalQuadPoints; i++)
00064 {
00065 this->mContractionModelSystems.push_back(new Nash2004ContractionModel);
00066 }
00067 break;
00068 }
00069 case KERCHOFFS2003:
00070 {
00071 for(unsigned i=0; i<this->mTotalQuadPoints; i++)
00072 {
00073 this->mContractionModelSystems.push_back(new Kerchoffs2003ContractionModel);
00074 }
00075 break;
00076 }
00077 default:
00078 {
00079 EXCEPTION("Unknown or stretch-rate-dependent contraction model");
00080 }
00081 }
00082
00083 assert(!(this->mContractionModelSystems[0]->IsStretchRateDependent()));
00084 }
00085
00086 template<class ELASTICITY_SOLVER,unsigned DIM>
00087 ExplicitCardiacMechanicsSolver<ELASTICITY_SOLVER,DIM>::~ExplicitCardiacMechanicsSolver()
00088 {
00089 for(unsigned i=0; i<this->mContractionModelSystems.size(); i++)
00090 {
00091 delete this->mContractionModelSystems[i];
00092 }
00093 }
00094
00095 template<class ELASTICITY_SOLVER,unsigned DIM>
00096 void ExplicitCardiacMechanicsSolver<ELASTICITY_SOLVER,DIM>::GetActiveTensionAndTensionDerivs(double currentFibreStretch,
00097 unsigned currentQuadPointGlobalIndex,
00098 bool assembleJacobian,
00099 double& rActiveTension,
00100 double& rDerivActiveTensionWrtLambda,
00101 double& rDerivActiveTensionWrtDLambdaDt)
00102 {
00103
00104
00105 rActiveTension = this->mContractionModelSystems[currentQuadPointGlobalIndex]->GetActiveTension();
00106
00107
00108 rDerivActiveTensionWrtLambda = 0.0;
00109 rDerivActiveTensionWrtDLambdaDt = 0.0;
00110
00111
00112
00113 this->mStretches[currentQuadPointGlobalIndex] = currentFibreStretch;
00114 }
00115
00116 template<class ELASTICITY_SOLVER,unsigned DIM>
00117 void ExplicitCardiacMechanicsSolver<ELASTICITY_SOLVER,DIM>::Solve(double time, double nextTime, double odeTimestep)
00118 {
00119 assert(time < nextTime);
00120 this->mCurrentTime = time;
00121 this->mNextTime = nextTime;
00122 this->mOdeTimestep = odeTimestep;
00123
00124
00125
00126 this->AssembleSystem(true,false);
00127
00128
00129 for(unsigned i=0; i<this->mContractionModelSystems.size(); i++)
00130 {
00131 this->mContractionModelSystems[i]->SetStretchAndStretchRate(this->mStretches[i], 0.0 );
00132 this->mContractionModelSystems[i]->RunAndUpdate(time, nextTime, odeTimestep);
00133 }
00134
00135
00136 ELASTICITY_SOLVER::Solve();
00137 }
00138
00139
00140
00141 template class ExplicitCardiacMechanicsSolver<NonlinearElasticitySolver<2>,2>;
00142 template class ExplicitCardiacMechanicsSolver<NonlinearElasticitySolver<3>,3>;