38#include "ContinuumMechanicsProblemDefinition.hpp"
39#include "AbstractIncompressibleMaterialLaw.hpp"
40#include "AbstractCompressibleMaterialLaw.hpp"
50 mBodyForceType(CONSTANT_BODY_FORCE),
51 mConstantBodyForce(zero_vector<
double>(DIM)),
52 mTractionBoundaryConditionType(NO_TRACTIONS),
53 mVerboseDuringSolve(false)
73 mBodyForceType = CONSTANT_BODY_FORCE;
74 mConstantBodyForce = bodyForce;
80 mBodyForceType = FUNCTIONAL_BODY_FORCE;
81 mpBodyForceFunction = pFunction;
87 return mBodyForceType;
93 assert(mBodyForceType==CONSTANT_BODY_FORCE);
94 return mConstantBodyForce;
100 assert(mBodyForceType==FUNCTIONAL_BODY_FORCE);
101 return (*mpBodyForceFunction)(rX,t);
104template<
unsigned DIM>
107 switch(mBodyForceType)
109 case CONSTANT_BODY_FORCE:
111 return mConstantBodyForce;
113 case FUNCTIONAL_BODY_FORCE:
115 return (*mpBodyForceFunction)(rX,t);
122template<
unsigned DIM>
125 return mTractionBoundaryConditionType;
128template<
unsigned DIM>
130 std::vector<c_vector<double,DIM> >& rElementwiseTractions)
133 assert(rTractionBoundaryElements.size()==rElementwiseTractions.size());
134 mTractionBoundaryConditionType = ELEMENTWISE_TRACTION;
135 mTractionBoundaryElements = rTractionBoundaryElements;
136 mElementwiseTractions = rElementwiseTractions;
139template<
unsigned DIM>
141 c_vector<double,DIM> (*pFunction)(c_vector<double,DIM>& rX,
double t))
143 mTractionBoundaryConditionType=FUNCTIONAL_TRACTION;
144 mTractionBoundaryElements = rTractionBoundaryElements;
145 mpTractionBoundaryConditionFunction = pFunction;
148template<
unsigned DIM>
150 double normalPressure)
152 mTractionBoundaryConditionType = PRESSURE_ON_DEFORMED;
153 mTractionBoundaryElements = rTractionBoundaryElements;
154 mNormalPressure = normalPressure;
155 mOriginalNormalPressure = normalPressure;
159template<
unsigned DIM>
161 double (*pFunction)(
double t))
163 mTractionBoundaryConditionType = FUNCTIONAL_PRESSURE_ON_DEFORMED;
164 mTractionBoundaryElements = rTractionBoundaryElements;
165 mpNormalPressureFunction = pFunction;
168template<
unsigned DIM>
171 mDirichletNodes = rZeroDirichletNodes;
173 for (
unsigned i=0; i<mDirichletNodes.size(); i++)
175 assert(mDirichletNodes[i] < mrMesh.GetNumNodes());
178 mDirichletNodeValues.clear();
179 for (
unsigned i=0; i<mDirichletNodes.size(); i++)
181 mDirichletNodeValues.push_back(zero_vector<double>(DIM));
185template<
unsigned DIM>
188 return mDirichletNodes;
191template<
unsigned DIM>
194 return mDirichletNodeValues;
197template<
unsigned DIM>
200 return mTractionBoundaryElements;
203template<
unsigned DIM>
206 assert(mTractionBoundaryConditionType==ELEMENTWISE_TRACTION);
207 return mElementwiseTractions;
210template<
unsigned DIM>
213 assert(mTractionBoundaryConditionType==PRESSURE_ON_DEFORMED);
214 return mNormalPressure;
217template<
unsigned DIM>
220 assert(mTractionBoundaryConditionType==FUNCTIONAL_TRACTION);
221 return (*mpTractionBoundaryConditionFunction)(rX,t);
224template<
unsigned DIM>
227 assert(mTractionBoundaryConditionType==FUNCTIONAL_PRESSURE_ON_DEFORMED);
228 return (*mpNormalPressureFunction)(t);
231template<
unsigned DIM>
234 assert(mTractionBoundaryConditionType==PRESSURE_ON_DEFORMED);
235 mNormalPressure = mOriginalNormalPressure*scaleFactor;
238template<
unsigned DIM>
241 if (mDirichletNodes.size() == 0)
243 EXCEPTION(
"No Dirichlet boundary conditions (eg fixed displacement or fixed flow) have been set");
#define EXCEPTION(message)
c_vector< double, DIM > GetConstantBodyForce()
void SetDensity(double density)
std::vector< c_vector< double, DIM > > & rGetElementwiseTractions()
c_vector< double, DIM > EvaluateBodyForceFunction(c_vector< double, DIM > &rX, double t)
double EvaluateNormalPressureFunction(double t)
TractionBoundaryConditionType GetTractionBoundaryConditionType()
void SetApplyNormalPressureOnDeformedSurface(std::vector< BoundaryElement< DIM-1, DIM > * > &rTractionBoundaryElements, double normalPressure)
std::vector< BoundaryElement< DIM-1, DIM > * > & rGetTractionBoundaryElements()
std::vector< unsigned > & rGetDirichletNodes()
void SetTractionBoundaryConditions(std::vector< BoundaryElement< DIM-1, DIM > * > &rTractionBoundaryElements, std::vector< c_vector< double, DIM > > &rElementwiseTractions)
BodyForceType GetBodyForceType()
void SetPressureScaling(double scaleFactor)
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)
double GetNormalPressure()
void SetZeroDirichletNodes(std::vector< unsigned > &rZeroDirichletNodes)
ContinuumMechanicsProblemDefinition(AbstractTetrahedralMesh< DIM, DIM > &rMesh)
void SetBodyForce(c_vector< double, DIM > bodyForce)