36 #include "ElectroMechanicsProblemDefinition.hpp"
37 #include "LabelBasedContractionCellFactory.hpp"
39 template<
unsigned DIM>
42 mContractionModelOdeTimeStep(-1.0),
43 mMechanicsSolveTimestep(-1.0),
44 mDeformationAffectsConductivity(false),
45 mDeformationAffectsCellModels(false),
46 mpDefaultMaterialLaw(NULL),
47 mReadFibreSheetInformationFromFile(false),
48 mNumIncrementsForInitialDeformation(1),
49 mApplyCrossFibreTension(false),
52 mpContractionCellFactory(NULL),
53 mWeMadeCellFactory(false),
58 template<
unsigned DIM>
61 if(mpDefaultMaterialLaw)
63 delete mpDefaultMaterialLaw;
66 if (mWeMadeCellFactory)
68 delete mpContractionCellFactory;
72 template<
unsigned DIM>
75 assert(timestep > 0.0);
76 SetContractionModelOdeTimestep(timestep);
78 if (contractionModel == NASH2004 || contractionModel == CONSTANT)
81 SetSolverType(EXPLICIT);
85 assert(mpContractionCellFactory==NULL);
88 mWeMadeCellFactory =
true;
89 SetContractionCellFactory(p_factory);
92 template<
unsigned DIM>
95 if(mpDefaultMaterialLaw)
97 delete mpDefaultMaterialLaw;
100 if(compressibilityType == INCOMPRESSIBLE)
103 this->SetMaterialLaw(INCOMPRESSIBLE, mpDefaultMaterialLaw);
108 this->SetMaterialLaw(COMPRESSIBLE, mpDefaultMaterialLaw);
112 template<
unsigned DIM>
115 mDeformationAffectsConductivity = deformationAffectsConductivity;
116 mDeformationAffectsCellModels = deformationAffectsCellModels;
119 template<
unsigned DIM>
122 assert(timestep > 0.0);
123 mMechanicsSolveTimestep = timestep;
126 template<
unsigned DIM>
129 mReadFibreSheetInformationFromFile =
true;
130 mFibreSheetDirectionsFile = rFibreSheetDirectionsFile;
131 mFibreSheetDirectionsDefinedPerQuadraturePoint = definedPerQuadraturePoint;
134 template<
unsigned DIM>
137 mApplyCrossFibreTension = applyCrossFibreTension;
138 mSheetTensionFraction = crossFibreTensionFraction;
139 mSheetNormalTensionFraction = crossFibreTensionFraction;
142 template<
unsigned DIM>
147 EXCEPTION(
"You can only apply anisotropic cross fibre tensions in a 3D simulation.");
149 mApplyCrossFibreTension = applyCrossFibreTension;
150 mSheetTensionFraction = sheetTensionFraction;
151 mSheetNormalTensionFraction = sheetNormalTensionFraction;
154 template<
unsigned DIM>
158 assert(mpContractionCellFactory == NULL);
160 mpContractionCellFactory = pCellFactory;
164 template<
unsigned DIM>
169 if(mMechanicsSolveTimestep < 0.0)
171 EXCEPTION(
"Timestep for mechanics solve hasn't been set yet");
174 if(mContractionModelOdeTimeStep < 0.0)
176 std::string message =
"Contraction model or contraction model ODE timestep have not been set. "
177 "Make sure SetContractionModel(), or SetContractionCellFactory() AND SetContractionModelOdeTimestep "
178 "are called. (Pass in a timestep even if contraction model is algebraic and won't use it). ";
182 if(mDeformationAffectsConductivity && this->GetCompressibilityType()==COMPRESSIBLE)
187 EXCEPTION(
"Deformation affecting the conductivity is currently not implemented fully for compressible problems");
190 if(mDeformationAffectsCellModels && mReadFibreSheetInformationFromFile && mFibreSheetDirectionsDefinedPerQuadraturePoint)
193 std::stringstream message;
194 message <<
"Deformation affecting cell models cannot be done when fibres-sheet information is defined for each quadrature point.";
195 message <<
"Define fibre-sheet information for each element instead.";
ElectroMechanicsProblemDefinition(QuadraticMesh< DIM > &rMesh)
void SetContractionCellFactory(AbstractContractionCellFactory< DIM > *pCellFactory)
#define EXCEPTION(message)
void SetContractionModel(ContractionModelName contractionModel, double timestep)
void SetMechanicsMesh(QuadraticMesh< DIM > *pMesh)
const double DOUBLE_UNSET
void SetMechanicsSolveTimestep(double timestep)
void SetVariableFibreSheetDirectionsFile(const FileFinder &rFibreSheetDirectionsFile, bool definedPerQuadPoint)
virtual ~ElectroMechanicsProblemDefinition()
void SetApplyAnisotropicCrossFibreTension(bool applyCrossFibreTension, double sheetTensionFraction, double sheetNormalTensionFraction)
void SetDeformationAffectsElectrophysiology(bool deformationAffectsConductivity, bool deformationAffectsCellModels)
void SetApplyIsotropicCrossFibreTension(bool applyCrossFibreTension, double crossFibreTensionFraction)
void SetUseDefaultCardiacMaterialLaw(CompressibilityType compressibilityType)