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