ElectroMechanicsProblemDefinition.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 "ElectroMechanicsProblemDefinition.hpp"
00030
00031 template<unsigned DIM>
00032 ElectroMechanicsProblemDefinition<DIM>::ElectroMechanicsProblemDefinition(QuadraticMesh<DIM>& rMesh)
00033 : SolidMechanicsProblemDefinition<DIM>(rMesh),
00034 mContractionModelOdeTimeStep(-1.0),
00035 mMechanicsSolveTimestep(-1.0),
00036 mDeformationAffectsConductivity(false),
00037 mDeformationAffectsCellModels(false),
00038 mpDefaultMaterialLaw(NULL),
00039 mReadFibreSheetInformationFromFile(false)
00040 {
00041 }
00042
00043 template<unsigned DIM>
00044 ElectroMechanicsProblemDefinition<DIM>::~ElectroMechanicsProblemDefinition()
00045 {
00046 if(mpDefaultMaterialLaw)
00047 {
00048 delete mpDefaultMaterialLaw;
00049 }
00050 }
00051
00052 template<unsigned DIM>
00053 void ElectroMechanicsProblemDefinition<DIM>::SetContractionModel(ContractionModelName contractionModel, double timestep)
00054 {
00055 assert(timestep > 0.0);
00056 mContractionModel = contractionModel;
00057 mContractionModelOdeTimeStep = timestep;
00058 }
00059
00060 template<unsigned DIM>
00061 void ElectroMechanicsProblemDefinition<DIM>::SetUseDefaultCardiacMaterialLaw(CompressibilityType compressibilityType)
00062 {
00063 if(mpDefaultMaterialLaw)
00064 {
00065 delete mpDefaultMaterialLaw;
00066 }
00067
00068 if(compressibilityType == INCOMPRESSIBLE)
00069 {
00070 mpDefaultMaterialLaw = new NashHunterPoleZeroLaw<DIM>();
00071 this->SetMaterialLaw(INCOMPRESSIBLE, mpDefaultMaterialLaw);
00072 }
00073 else
00074 {
00075 mpDefaultMaterialLaw = new CompressibleExponentialLaw<DIM>();
00076 this->SetMaterialLaw(COMPRESSIBLE, mpDefaultMaterialLaw);
00077 }
00078 }
00079
00080 template<unsigned DIM>
00081 void ElectroMechanicsProblemDefinition<DIM>::SetDeformationAffectsElectrophysiology(bool deformationAffectsConductivity, bool deformationAffectsCellModels)
00082 {
00083 mDeformationAffectsConductivity = deformationAffectsConductivity;
00084 mDeformationAffectsCellModels = deformationAffectsCellModels;
00085 }
00086
00087 template<unsigned DIM>
00088 void ElectroMechanicsProblemDefinition<DIM>::SetMechanicsSolveTimestep(double timestep)
00089 {
00090 assert(timestep > 0.0);
00091 mMechanicsSolveTimestep = timestep;
00092 }
00093
00094 template<unsigned DIM>
00095 void ElectroMechanicsProblemDefinition<DIM>::SetVariableFibreSheetDirectionsFile(std::string fibreSheetDirectionsFile, bool definedPerQuadraturePoint)
00096 {
00097 mReadFibreSheetInformationFromFile = true;
00098 mFibreSheetDirectionsFile = fibreSheetDirectionsFile;
00099 mFibreSheetDirectionsDefinedPerQuadraturePoint = definedPerQuadraturePoint;
00100 }
00101
00102 template<unsigned DIM>
00103 void ElectroMechanicsProblemDefinition<DIM>::Validate()
00104 {
00105 SolidMechanicsProblemDefinition<DIM>::Validate();
00106
00107 if(mMechanicsSolveTimestep < 0.0)
00108 {
00109 EXCEPTION("Timestep for mechanics solve hasn't been set yet");
00110 }
00111
00112 if(mContractionModelOdeTimeStep < 0.0)
00113 {
00114 EXCEPTION("Contraction model hasn't been set yet");
00115 }
00116
00117 if(mDeformationAffectsConductivity && this->GetCompressibilityType()==COMPRESSIBLE)
00118 {
00119
00120
00121
00122 EXCEPTION("Deformation affecting the conductivity is currently not implemented fully for compressible problems");
00123 }
00124
00125 if(mDeformationAffectsCellModels && mReadFibreSheetInformationFromFile && mFibreSheetDirectionsDefinedPerQuadraturePoint)
00126 {
00127
00128 std::stringstream message;
00129 message << "Deformation affecting cell models cannot be done when fibres-sheet information is defined for each quadrature point.";
00130 message << "Define fibre-sheet information for each element instead.";
00131 EXCEPTION(message.str());
00132 }
00133 }
00134
00136
00138
00139 template class ElectroMechanicsProblemDefinition<2>;
00140 template class ElectroMechanicsProblemDefinition<3>;