Chaste Commit::675f9facbe008c5eacb9006feaeb6423206579ea
AbstractCardiacMechanicsSolver.hpp
1/*
2
3Copyright (c) 2005-2025, University of Oxford.
4All rights reserved.
5
6University of Oxford means the Chancellor, Masters and Scholars of the
7University of Oxford, having an administrative office at Wellington
8Square, Oxford OX1 2JD, UK.
9
10This file is part of Chaste.
11
12Redistribution and use in source and binary forms, with or without
13modification, are permitted provided that the following conditions are met:
14 * Redistributions of source code must retain the above copyright notice,
15 this list of conditions and the following disclaimer.
16 * Redistributions in binary form must reproduce the above copyright notice,
17 this list of conditions and the following disclaimer in the documentation
18 and/or other materials provided with the distribution.
19 * Neither the name of the University of Oxford nor the names of its
20 contributors may be used to endorse or promote products derived from this
21 software without specific prior written permission.
22
23THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34*/
35
36#ifndef ABSTRACTCARDIACMECHANICSSOLVER_HPP_
37#define ABSTRACTCARDIACMECHANICSSOLVER_HPP_
38
39#include <map>
40#include "IncompressibleNonlinearElasticitySolver.hpp"
41#include "CompressibleNonlinearElasticitySolver.hpp"
42#include "QuadraticBasisFunction.hpp"
43#include "LinearBasisFunction.hpp"
44#include "AbstractContractionModel.hpp"
45#include "FibreReader.hpp"
46#include "FineCoarseMeshPair.hpp"
47#include "AbstractCardiacMechanicsSolverInterface.hpp"
48#include "HeartRegionCodes.hpp"
49#include "ElectroMechanicsProblemDefinition.hpp"
50
51
59{
61// bool Active;/**<whether this quad point is active or not*/
62 double Stretch;
66
67
80template<class ELASTICITY_SOLVER, unsigned DIM>
82{
83 friend class TestCardiacElectroMechanicsVtkHandler; // for testing
84
85protected:
86 static const unsigned NUM_VERTICES_PER_ELEMENT = ELASTICITY_SOLVER::NUM_VERTICES_PER_ELEMENT;
98 std::map<unsigned,DataAtQuadraturePoint> mQuadPointToDataAtQuadPointMap;
99
103 std::map<unsigned,DataAtQuadraturePoint>::iterator mMapIterator;
104
107
110
113
115 double mNextTime;
116
119
124 c_matrix<double,DIM,DIM> mConstantFibreSheetDirections;
125
130 std::vector<c_matrix<double,DIM,DIM> >* mpVariableFibreSheetDirections;
131
137
139 c_vector<double,DIM> mCurrentElementFibreDirection;
140
142 c_vector<double,DIM> mCurrentElementSheetDirection;
143
146
147
152
157 virtual bool IsImplicitSolver()=0;
158
159
174 void AddActiveStressAndStressDerivative(c_matrix<double,DIM,DIM>& rC,
175 unsigned elementIndex,
176 unsigned currentQuadPointGlobalIndex,
177 c_matrix<double,DIM,DIM>& rT,
179 bool addToDTdE);
180
181
189 void SetupChangeOfBasisMatrix(unsigned elementIndex, unsigned currentQuadPointGlobalIndex);
190
196 void Initialise();
197
210 virtual void GetActiveTensionAndTensionDerivs(double currentFibreStretch,
211 unsigned currentQuadPointGlobalIndex,
212 bool assembleJacobian,
213 double& rActiveTension,
214 double& rDerivActiveTensionWrtLambda,
215 double& rDerivActiveTensionWrtDLambdaDt)=0;
216public:
225 ElectroMechanicsProblemDefinition<DIM>& rProblemDefinition,
226 std::string outputDirectory);
227
232
241
244 {
245 return mTotalQuadPoints;
246 }
247
250 {
251 return this->mpQuadratureRule;
252 }
253
257 std::map<unsigned,DataAtQuadraturePoint>& rGetQuadPointToDataAtQuadPointMap()
258 {
260 }
261
262
269 void SetConstantFibreSheetDirections(const c_matrix<double,DIM,DIM>& rFibreSheetMatrix);
270
282 void SetVariableFibreSheetDirections(const FileFinder& rOrthoFile, bool definedPerQuadraturePoint);
283
296 void SetCalciumAndVoltage(std::vector<double>& rCalciumConcentrations,
297 std::vector<double>& rVoltages);
298
306 virtual void Solve(double time, double nextTime, double odeTimestep)=0;
307
327 void ComputeDeformationGradientAndStretchInEachElement(std::vector<c_matrix<double,DIM,DIM> >& rDeformationGradients,
328 std::vector<double>& rStretches);
329};
330
331
332#endif /*ABSTRACTCARDIACMECHANICSSOLVER_HPP_*/
c_matrix< double, DIM, DIM > mConstantFibreSheetDirections
std::map< unsigned, DataAtQuadraturePoint > mQuadPointToDataAtQuadPointMap
void SetCalciumAndVoltage(std::vector< double > &rCalciumConcentrations, std::vector< double > &rVoltages)
virtual bool IsImplicitSolver()=0
virtual void Solve(double time, double nextTime, double odeTimestep)=0
void ComputeDeformationGradientAndStretchInEachElement(std::vector< c_matrix< double, DIM, DIM > > &rDeformationGradients, std::vector< double > &rStretches)
std::map< unsigned, DataAtQuadraturePoint >::iterator mMapIterator
virtual GaussianQuadratureRule< DIM > * GetQuadratureRule()
c_vector< double, DIM > mCurrentElementSheetNormalDirection
std::map< unsigned, DataAtQuadraturePoint > & rGetQuadPointToDataAtQuadPointMap()
void SetFineCoarseMeshPair(FineCoarseMeshPair< DIM > *pMeshPair)
std::vector< c_matrix< double, DIM, DIM > > * mpVariableFibreSheetDirections
void SetVariableFibreSheetDirections(const FileFinder &rOrthoFile, bool definedPerQuadraturePoint)
virtual void GetActiveTensionAndTensionDerivs(double currentFibreStretch, unsigned currentQuadPointGlobalIndex, bool assembleJacobian, double &rActiveTension, double &rDerivActiveTensionWrtLambda, double &rDerivActiveTensionWrtDLambdaDt)=0
ElectroMechanicsProblemDefinition< DIM > & mrElectroMechanicsProblemDefinition
void SetupChangeOfBasisMatrix(unsigned elementIndex, unsigned currentQuadPointGlobalIndex)
void SetConstantFibreSheetDirections(const c_matrix< double, DIM, DIM > &rFibreSheetMatrix)
void AddActiveStressAndStressDerivative(c_matrix< double, DIM, DIM > &rC, unsigned elementIndex, unsigned currentQuadPointGlobalIndex, c_matrix< double, DIM, DIM > &rT, FourthOrderTensor< DIM, DIM, DIM, DIM > &rDTdE, bool addToDTdE)
AbstractContractionModel * ContractionModel