Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
ContinuumMechanicsProblemDefinition.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 CONTINUUMMECHANICSPROBLEMDEFINITION_HPP_
37#define CONTINUUMMECHANICSPROBLEMDEFINITION_HPP_
38
39#include "AbstractTetrahedralMesh.hpp"
41#include "AbstractIncompressibleMaterialLaw.hpp"
42#include "AbstractCompressibleMaterialLaw.hpp"
43#include "CompressibilityType.hpp"
44
45
49typedef enum BodyForceType_
50{
51 CONSTANT_BODY_FORCE,
52 FUNCTIONAL_BODY_FORCE
53} BodyForceType;
54
58typedef enum TractionBoundaryConditionType_
59{
60 NO_TRACTIONS,
61 ELEMENTWISE_TRACTION,
62 FUNCTIONAL_TRACTION,
63 PRESSURE_ON_DEFORMED,
64 FUNCTIONAL_PRESSURE_ON_DEFORMED
65} TractionBoundaryConditionType;
66
67
73template<unsigned DIM>
75{
76public:
79 static const double FREE; // set to DBL_MAX
80
81protected:
84
86 double mDensity;
87
89 // body force
91
93 BodyForceType mBodyForceType;
94
96 c_vector<double,DIM> mConstantBodyForce;
97
99 c_vector<double,DIM> (*mpBodyForceFunction)(c_vector<double,DIM>& rX, double t);
100
102 // tractions
104
106 TractionBoundaryConditionType mTractionBoundaryConditionType;
107
110
112 std::vector<c_vector<double,DIM> > mElementwiseTractions;
113
117
122
124 c_vector<double,DIM> (*mpTractionBoundaryConditionFunction)(c_vector<double,DIM>& rX, double t);
125
128
129
131 // Dirichlet boundary conditions
133
137 std::vector<unsigned> mDirichletNodes;
138
140 std::vector<c_vector<double,DIM> > mDirichletNodeValues;
141
144
145public:
151
156
161 void SetDensity(double density);
162
166 double GetDensity();
167
172 void SetZeroDirichletNodes(std::vector<unsigned>& rZeroDirichletNodes);
173
174 // No method here for setting non-zero Dirichlet BCs - these are in the subclasses..
175
179 std::vector<unsigned>& rGetDirichletNodes();
180
184 std::vector<c_vector<double,DIM> >& rGetDirichletNodeValues();
185
186
191 void SetBodyForce(c_vector<double,DIM> bodyForce);
192
197 void SetBodyForce(c_vector<double,DIM> (*pFunction)(c_vector<double,DIM>& rX, double t));
198
207 c_vector<double,DIM> GetBodyForce(c_vector<double,DIM>& rX, double t = 0.0);
208
212 BodyForceType GetBodyForceType();
213
217 c_vector<double,DIM> GetConstantBodyForce();
218
225 c_vector<double,DIM> EvaluateBodyForceFunction(c_vector<double,DIM>& rX, double t);
226
230 TractionBoundaryConditionType GetTractionBoundaryConditionType();
231
238 void SetTractionBoundaryConditions(std::vector<BoundaryElement<DIM-1,DIM>*>& rTractionBoundaryElements,
239 std::vector<c_vector<double,DIM> >& rElementwiseTractions);
240
248 void SetTractionBoundaryConditions(std::vector<BoundaryElement<DIM-1,DIM>*>& rTractionBoundaryElements,
249 c_vector<double,DIM> (*pFunction)(c_vector<double,DIM>& rX, double t));
250
258 void SetApplyNormalPressureOnDeformedSurface(std::vector<BoundaryElement<DIM-1,DIM>*>& rTractionBoundaryElements,
259 double normalPressure);
260
269 void SetApplyNormalPressureOnDeformedSurface(std::vector<BoundaryElement<DIM-1,DIM>*>& rTractionBoundaryElements,
270 double (*pFunction)(double t));
271
275 std::vector<BoundaryElement<DIM-1,DIM>*>& rGetTractionBoundaryElements();
276
282 std::vector<c_vector<double,DIM> >& rGetElementwiseTractions();
283
289 double GetNormalPressure();
290
304 void SetPressureScaling(double scaleFactor);
305
312 c_vector<double,DIM> EvaluateTractionFunction(c_vector<double,DIM>& rX, double t);
313
319 double EvaluateNormalPressureFunction(double t);
320
321
326 virtual void Validate();
327
332 void SetVerboseDuringSolve(bool verboseDuringSolve = true)
333 {
334 mVerboseDuringSolve = verboseDuringSolve;
335 }
336
341 {
342 return mVerboseDuringSolve;
343 }
344};
345
346#endif // CONTINUUMMECHANICSPROBLEMDEFINITION_HPP_
std::vector< c_vector< double, DIM > > mDirichletNodeValues
std::vector< c_vector< double, DIM > > & rGetElementwiseTractions()
c_vector< double, DIM >(* mpBodyForceFunction)(c_vector< double, DIM > &rX, double t)
c_vector< double, DIM > EvaluateBodyForceFunction(c_vector< double, DIM > &rX, double t)
std::vector< BoundaryElement< DIM-1, DIM > * > mTractionBoundaryElements
TractionBoundaryConditionType GetTractionBoundaryConditionType()
void SetApplyNormalPressureOnDeformedSurface(std::vector< BoundaryElement< DIM-1, DIM > * > &rTractionBoundaryElements, double normalPressure)
std::vector< BoundaryElement< DIM-1, DIM > * > & rGetTractionBoundaryElements()
void SetTractionBoundaryConditions(std::vector< BoundaryElement< DIM-1, DIM > * > &rTractionBoundaryElements, std::vector< c_vector< double, DIM > > &rElementwiseTractions)
std::vector< c_vector< double, DIM > > mElementwiseTractions
std::vector< c_vector< double, DIM > > & rGetDirichletNodeValues()
c_vector< double, DIM > GetBodyForce(c_vector< double, DIM > &rX, double t=0.0)
c_vector< double, DIM > EvaluateTractionFunction(c_vector< double, DIM > &rX, double t)
void SetZeroDirichletNodes(std::vector< unsigned > &rZeroDirichletNodes)
c_vector< double, DIM >(* mpTractionBoundaryConditionFunction)(c_vector< double, DIM > &rX, double t)
void SetBodyForce(c_vector< double, DIM > bodyForce)