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