Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
AbstractCardiacMechanicsSolver.hpp
1/*
2
3Copyright (c) 2005-2024, 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{
83protected:
84 static const unsigned NUM_VERTICES_PER_ELEMENT = ELASTICITY_SOLVER::NUM_VERTICES_PER_ELEMENT;
96 std::map<unsigned,DataAtQuadraturePoint> mQuadPointToDataAtQuadPointMap;
97
101 std::map<unsigned,DataAtQuadraturePoint>::iterator mMapIterator;
102
105
108
111
113 double mNextTime;
114
117
122 c_matrix<double,DIM,DIM> mConstantFibreSheetDirections;
123
128 std::vector<c_matrix<double,DIM,DIM> >* mpVariableFibreSheetDirections;
129
135
137 c_vector<double,DIM> mCurrentElementFibreDirection;
138
140 c_vector<double,DIM> mCurrentElementSheetDirection;
141
144
145
150
155 virtual bool IsImplicitSolver()=0;
156
157
172 void AddActiveStressAndStressDerivative(c_matrix<double,DIM,DIM>& rC,
173 unsigned elementIndex,
174 unsigned currentQuadPointGlobalIndex,
175 c_matrix<double,DIM,DIM>& rT,
177 bool addToDTdE);
178
179
187 void SetupChangeOfBasisMatrix(unsigned elementIndex, unsigned currentQuadPointGlobalIndex);
188
194 void Initialise();
195
208 virtual void GetActiveTensionAndTensionDerivs(double currentFibreStretch,
209 unsigned currentQuadPointGlobalIndex,
210 bool assembleJacobian,
211 double& rActiveTension,
212 double& rDerivActiveTensionWrtLambda,
213 double& rDerivActiveTensionWrtDLambdaDt)=0;
214public:
223 ElectroMechanicsProblemDefinition<DIM>& rProblemDefinition,
224 std::string outputDirectory);
225
230
239
242 {
243 return mTotalQuadPoints;
244 }
245
248 {
249 return this->mpQuadratureRule;
250 }
251
255 std::map<unsigned,DataAtQuadraturePoint>& rGetQuadPointToDataAtQuadPointMap()
256 {
258 }
259
260
267 void SetConstantFibreSheetDirections(const c_matrix<double,DIM,DIM>& rFibreSheetMatrix);
268
280 void SetVariableFibreSheetDirections(const FileFinder& rOrthoFile, bool definedPerQuadraturePoint);
281
294 void SetCalciumAndVoltage(std::vector<double>& rCalciumConcentrations,
295 std::vector<double>& rVoltages);
296
304 virtual void Solve(double time, double nextTime, double odeTimestep)=0;
305
325 void ComputeDeformationGradientAndStretchInEachElement(std::vector<c_matrix<double,DIM,DIM> >& rDeformationGradients,
326 std::vector<double>& rStretches);
327};
328
329
330#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