Chaste Commit::675f9facbe008c5eacb9006feaeb6423206579ea
CardiacElectroMechanicsProblem.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
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#include "CardiacElectroMechanicsVtkHandler.hpp"
55#include "VoltageInterpolaterOntoMechanicsMesh.hpp"
56
61typedef enum ElectricsProblemType_
62{
63 MONODOMAIN,
64 BIDOMAIN,
65 BIDOMAIN_WITH_BATH
66 //EXTENDED_BIDOMAIN
67} ElectricsProblemType;
68
95template<unsigned DIM, unsigned ELEC_PROB_DIM=1>
97 : public AbstractConductivityModifier<DIM,DIM> // this only inherits from this class so it can be passed to the tissue to
98 // allow deformation-based altering of the conductivity
99{
100friend class TestAbstractContractionCellFactory;
101friend class TestCardiacElectroMechanicsProblem;
102friend class TestCardiacElectroMechanicsFurtherFunctionality;
103friend class TestElectroMechanicsExactSolution;
104
105protected :
107 CompressibilityType mCompressibilityType;
108
111
118
121
126 std::vector<double> mInterpolatedCalciumConcs;
127
132 std::vector<double> mInterpolatedVoltages;
133
134
139
142
145
148
150 std::string mOutputDirectory;
157
159 static const int WRITE_EVERY_NTH_TIME = 1; //hardcoded for the time being ///\todo, allow user to set this
160
164 c_vector<double,DIM> mWatchedLocation;
171
174
178 std::vector<c_matrix<double,DIM,DIM> > mDeformationGradientsForEachMechanicsElement;
179
181 c_matrix<double,DIM,DIM> mModifiedConductivityTensor;
182
185
190
191
198 void WriteWatchedLocationData(double time, Vec voltage);
199
200
201
202public :
203
214 CardiacElectroMechanicsProblem(CompressibilityType compressibilityType,
215 ElectricsProblemType electricsProblemType,
216 TetrahedralMesh<DIM,DIM>* pElectricsMesh,
217 QuadraticMesh<DIM>* pMechanicsMesh,
219 ElectroMechanicsProblemDefinition<DIM>* pProblemDefinition,
220 std::string outputDirectory);
221
231
236 void Initialise();
237
241 void Solve();
242
248 double Max(std::vector<double>& vec);
249
252
263 void SetWatchedPosition(c_vector<double,DIM> watchedLocation);
264
272 void SetOutputDeformationGradientsAndStress(double timestep);
273
275 std::vector<c_vector<double,DIM> >& rGetDeformedPosition();
276
277
286 c_matrix<double,DIM,DIM>& rCalculateModifiedConductivityTensor(unsigned elementIndex, const c_matrix<double,DIM,DIM>& rOriginalConductivity, unsigned domainIndex);
287
288
292 virtual void PrepareForSolve(){}
293
298 virtual void OnEndOfTimeStep(unsigned counter)
299 {
300 }
301
312};
313
314#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)
CardiacElectroMechanicsVtkHandler< DIM, ELEC_PROB_DIM > * mpCardiacVtkWriter
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()