00001 /* 00002 00003 Copyright (c) 2005-2015, University of Oxford. 00004 All rights reserved. 00005 00006 University of Oxford means the Chancellor, Masters and Scholars of the 00007 University of Oxford, having an administrative office at Wellington 00008 Square, Oxford OX1 2JD, UK. 00009 00010 This file is part of Chaste. 00011 00012 Redistribution and use in source and binary forms, with or without 00013 modification, are permitted provided that the following conditions are met: 00014 * Redistributions of source code must retain the above copyright notice, 00015 this list of conditions and the following disclaimer. 00016 * Redistributions in binary form must reproduce the above copyright notice, 00017 this list of conditions and the following disclaimer in the documentation 00018 and/or other materials provided with the distribution. 00019 * Neither the name of the University of Oxford nor the names of its 00020 contributors may be used to endorse or promote products derived from this 00021 software without specific prior written permission. 00022 00023 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00024 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00025 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00026 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 00027 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00028 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 00029 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00030 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00031 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00032 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 00034 */ 00035 00036 #ifndef ELECTROMECHANICSPROBLEMDEFINITION_HPP_ 00037 #define ELECTROMECHANICSPROBLEMDEFINITION_HPP_ 00038 00039 #include "SolidMechanicsProblemDefinition.hpp" 00040 #include "ContractionModelName.hpp" 00041 #include "NashHunterPoleZeroLaw.hpp" 00042 #include "CompressibleExponentialLaw.hpp" 00043 #include "FileFinder.hpp" 00044 #include "AbstractContractionCellFactory.hpp" 00045 #include "SolverType.hpp" 00046 00051 template<unsigned DIM> 00052 class ElectroMechanicsProblemDefinition : public SolidMechanicsProblemDefinition<DIM> 00053 { 00054 private: 00055 friend class TestExplicitCardiacMechanicsSolver; 00056 friend class TestImplicitCardiacMechanicsSolver; 00057 friend class TestElectroMechanicsProblemDefinition; 00058 00060 double mContractionModelOdeTimeStep; 00061 00063 double mMechanicsSolveTimestep; 00064 00069 bool mDeformationAffectsConductivity; 00070 00075 bool mDeformationAffectsCellModels; 00076 00080 AbstractMaterialLaw<DIM>* mpDefaultMaterialLaw; 00081 00082 00084 bool mReadFibreSheetInformationFromFile; 00085 00090 FileFinder mFibreSheetDirectionsFile; 00091 00096 bool mFibreSheetDirectionsDefinedPerQuadraturePoint; 00097 00103 unsigned mNumIncrementsForInitialDeformation; 00104 00108 bool mApplyCrossFibreTension; 00109 00113 double mSheetTensionFraction; 00114 00118 double mSheetNormalTensionFraction; 00119 00121 AbstractContractionCellFactory<DIM>* mpContractionCellFactory; 00122 00124 bool mWeMadeCellFactory; 00125 00127 SolverType mSolverType; 00128 00129 public: 00134 ElectroMechanicsProblemDefinition(QuadraticMesh<DIM>& rMesh); 00135 00137 virtual ~ElectroMechanicsProblemDefinition(); 00138 00149 void SetContractionModel(ContractionModelName contractionModel, double timestep); 00150 00160 void SetContractionCellFactory(AbstractContractionCellFactory<DIM>* pCellFactory); 00161 00167 void SetUseDefaultCardiacMaterialLaw(CompressibilityType compressibilityType); 00168 00175 void SetSolverType(SolverType solver) 00176 { 00177 mSolverType = solver; 00178 } 00179 00202 void SetDeformationAffectsElectrophysiology(bool deformationAffectsConductivity, bool deformationAffectsCellModels); 00203 00208 void SetMechanicsSolveTimestep(double timestep); 00209 00210 00225 void SetVariableFibreSheetDirectionsFile(const FileFinder& rFibreSheetDirectionsFile, bool definedPerQuadPoint); 00226 00227 00239 void SetApplyIsotropicCrossFibreTension(bool applyCrossFibreTension, double crossFibreTensionFraction); 00240 00252 void SetApplyAnisotropicCrossFibreTension(bool applyCrossFibreTension, double sheetTensionFraction, double sheetNormalTensionFraction); 00253 00257 AbstractContractionCellFactory<DIM>* GetContractionCellFactory() 00258 { 00259 assert(mpContractionCellFactory); 00260 return mpContractionCellFactory; 00261 } 00262 00270 void SetContractionModelOdeTimestep(double timestep) 00271 { 00272 mContractionModelOdeTimeStep = timestep; 00273 } 00274 00278 double GetContractionModelOdeTimestep() 00279 { 00280 assert(mContractionModelOdeTimeStep>0.0); // see exception message in Validate() 00281 return mContractionModelOdeTimeStep; 00282 } 00283 00287 double GetMechanicsSolveTimestep() 00288 { 00289 assert(mMechanicsSolveTimestep>0.0); // if this fails SetMechanicsSolveTimestep() probably hasn't been called - call Validate() to check 00290 return mMechanicsSolveTimestep; 00291 } 00292 00297 bool GetDeformationAffectsConductivity() 00298 { 00299 return mDeformationAffectsConductivity; 00300 } 00301 00306 bool GetDeformationAffectsCellModels() 00307 { 00308 return mDeformationAffectsCellModels; 00309 } 00310 00314 SolverType GetSolverType() 00315 { 00316 return mSolverType; 00317 } 00318 00322 bool ReadFibreSheetDirectionsFromFile() 00323 { 00324 return mReadFibreSheetInformationFromFile; 00325 } 00326 00330 FileFinder GetFibreSheetDirectionsFile() 00331 { 00332 assert(mReadFibreSheetInformationFromFile); 00333 assert(mFibreSheetDirectionsFile.GetAbsolutePath()!=""); 00334 return mFibreSheetDirectionsFile; 00335 } 00336 00342 bool GetFibreSheetDirectionsDefinedPerQuadraturePoint() 00343 { 00344 assert(mReadFibreSheetInformationFromFile); 00345 return mFibreSheetDirectionsDefinedPerQuadraturePoint; 00346 } 00347 00354 void SetNumIncrementsForInitialDeformation(unsigned numIncrements) 00355 { 00356 if(numIncrements==0) 00357 { 00358 EXCEPTION("Number of increments for initial deformation must be 1 or more"); 00359 } 00360 mNumIncrementsForInitialDeformation = numIncrements; 00361 } 00362 00367 unsigned GetNumIncrementsForInitialDeformation() 00368 { 00369 return mNumIncrementsForInitialDeformation; 00370 } 00371 00375 double GetApplyCrossFibreTension() 00376 { 00377 return mApplyCrossFibreTension; 00378 } 00379 00383 double GetSheetTensionFraction() 00384 { 00385 return mSheetTensionFraction; 00386 } 00387 00391 double GetSheetNormalTensionFraction() 00392 { 00393 return mSheetNormalTensionFraction; 00394 } 00395 00396 00401 virtual void Validate(); 00402 }; 00403 00404 #endif // ELECTROMECHANICSPROBLEMDEFINITION_HPP_