Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
CardiacElectroMechanicsProblem.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
37#ifndef CARDIACELECTROMECHANICSPROBLEM_HPP_
38#define CARDIACELECTROMECHANICSPROBLEM_HPP_
39
40#include <vector>
41#include <string>
42#include "UblasIncludes.hpp"
43
44#include "AbstractCardiacCellFactory.hpp"
45#include "MonodomainProblem.hpp"
46#include "TetrahedralMesh.hpp"
47#include "QuadraticMesh.hpp"
48#include "AbstractOdeBasedContractionModel.hpp"
49#include "AbstractCardiacMechanicsSolver.hpp"
50#include "AbstractCardiacMechanicsSolverInterface.hpp"
51#include "FineCoarseMeshPair.hpp"
52#include "AbstractConductivityModifier.hpp"
53#include "ElectroMechanicsProblemDefinition.hpp"
54
59typedef enum ElectricsProblemType_
60{
61 MONODOMAIN,
62 BIDOMAIN,
63 BIDOMAIN_WITH_BATH
64 //EXTENDED_BIDOMAIN
65} ElectricsProblemType;
66
93template<unsigned DIM, unsigned ELEC_PROB_DIM=1>
95 : public AbstractConductivityModifier<DIM,DIM> // this only inherits from this class so it can be passed to the tissue to
96 // allow deformation-based altering of the conductivity
97{
98friend class TestAbstractContractionCellFactory;
99friend class TestCardiacElectroMechanicsProblem;
100friend class TestCardiacElectroMechanicsFurtherFunctionality;
101friend class TestElectroMechanicsExactSolution;
102
103protected :
105 CompressibilityType mCompressibilityType;
106
109
116
119
124 std::vector<double> mInterpolatedCalciumConcs;
125
130 std::vector<double> mInterpolatedVoltages;
131
136
139
142
145
147 std::string mOutputDirectory;
154
156 static const int WRITE_EVERY_NTH_TIME = 1; //hardcoded for the time being ///\todo, allow user to set this
157
161 c_vector<double,DIM> mWatchedLocation;
168
171
175 std::vector<c_matrix<double,DIM,DIM> > mDeformationGradientsForEachMechanicsElement;
176
178 c_matrix<double,DIM,DIM> mModifiedConductivityTensor;
179
184
185
192 void WriteWatchedLocationData(double time, Vec voltage);
193
194
195public :
196
207 CardiacElectroMechanicsProblem(CompressibilityType compressibilityType,
208 ElectricsProblemType electricsProblemType,
209 TetrahedralMesh<DIM,DIM>* pElectricsMesh,
210 QuadraticMesh<DIM>* pMechanicsMesh,
212 ElectroMechanicsProblemDefinition<DIM>* pProblemDefinition,
213 std::string outputDirectory);
214
224
229 void Initialise();
230
234 void Solve();
235
241 double Max(std::vector<double>& vec);
242
245
256 void SetWatchedPosition(c_vector<double,DIM> watchedLocation);
257
265 void SetOutputDeformationGradientsAndStress(double timestep);
266
268 std::vector<c_vector<double,DIM> >& rGetDeformedPosition();
269
270
279 c_matrix<double,DIM,DIM>& rCalculateModifiedConductivityTensor(unsigned elementIndex, const c_matrix<double,DIM,DIM>& rOriginalConductivity, unsigned domainIndex);
280
281
285 virtual void PrepareForSolve(){}
286
291 virtual void OnEndOfTimeStep(unsigned counter)
292 {
293 }
294
305};
306
307#endif /*CARDIACELECTROMECHANICSPROBLEM_HPP_*/
double Max(std::vector< double > &vec)
virtual void OnEndOfTimeStep(unsigned counter)
std::vector< c_matrix< double, DIM, DIM > > mDeformationGradientsForEachMechanicsElement
AbstractNonlinearElasticitySolver< DIM > * mpMechanicsSolver
AbstractCardiacMechanicsSolverInterface< DIM > * mpCardiacMechSolver
c_matrix< double, DIM, DIM > mModifiedConductivityTensor
c_matrix< double, DIM, DIM > & rCalculateModifiedConductivityTensor(unsigned elementIndex, const c_matrix< double, DIM, DIM > &rOriginalConductivity, unsigned domainIndex)
void SetWatchedPosition(c_vector< double, DIM > watchedLocation)
std::vector< c_vector< double, DIM > > & rGetDeformedPosition()
void WriteWatchedLocationData(double time, Vec voltage)
ElectroMechanicsProblemDefinition< DIM > * mpProblemDefinition
AbstractCardiacProblem< DIM, DIM, ELEC_PROB_DIM > * mpElectricsProblem
AbstractNonlinearElasticitySolver< DIM > * GetMechanicsSolver()