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;
85 template<
unsigned DIM>
88 return mBodyForceType;
91 template<
unsigned DIM>
94 assert(mBodyForceType==CONSTANT_BODY_FORCE);
95 return mConstantBodyForce;
98 template<
unsigned DIM>
101 assert(mBodyForceType==FUNCTIONAL_BODY_FORCE);
102 return (*mpBodyForceFunction)(rX,t);
105 template<
unsigned DIM>
108 switch(mBodyForceType)
110 case CONSTANT_BODY_FORCE:
112 return mConstantBodyForce;
114 case FUNCTIONAL_BODY_FORCE:
116 return (*mpBodyForceFunction)(rX,t);
124 template<
unsigned DIM>
127 return mTractionBoundaryConditionType;
130 template<
unsigned DIM>
132 std::vector<c_vector<double,DIM> >& rElementwiseTractions)
135 assert(rTractionBoundaryElements.size()==rElementwiseTractions.size());
136 mTractionBoundaryConditionType = ELEMENTWISE_TRACTION;
137 mTractionBoundaryElements = rTractionBoundaryElements;
138 mElementwiseTractions = rElementwiseTractions;
141 template<
unsigned DIM>
143 c_vector<double,DIM> (*pFunction)(c_vector<double,DIM>& rX,
double t))
145 mTractionBoundaryConditionType=FUNCTIONAL_TRACTION;
146 mTractionBoundaryElements = rTractionBoundaryElements;
147 mpTractionBoundaryConditionFunction = pFunction;
151 template<
unsigned DIM>
153 double normalPressure)
155 mTractionBoundaryConditionType = PRESSURE_ON_DEFORMED;
156 mTractionBoundaryElements = rTractionBoundaryElements;
157 mNormalPressure = normalPressure;
158 mOriginalNormalPressure = normalPressure;
162 template<
unsigned DIM>
164 double (*pFunction)(
double t))
166 mTractionBoundaryConditionType = FUNCTIONAL_PRESSURE_ON_DEFORMED;
167 mTractionBoundaryElements = rTractionBoundaryElements;
168 mpNormalPressureFunction = pFunction;
174 template<
unsigned DIM>
177 mDirichletNodes = rZeroDirichletNodes;
179 for (
unsigned i=0; i<mDirichletNodes.size(); i++)
181 assert(mDirichletNodes[i] < mrMesh.GetNumNodes());
184 mDirichletNodeValues.clear();
185 for (
unsigned i=0; i<mDirichletNodes.size(); i++)
187 mDirichletNodeValues.push_back(zero_vector<double>(DIM));
191 template<
unsigned DIM>
194 return mDirichletNodes;
197 template<
unsigned DIM>
200 return mDirichletNodeValues;
203 template<
unsigned DIM>
206 return mTractionBoundaryElements;
210 template<
unsigned DIM>
213 assert(mTractionBoundaryConditionType==ELEMENTWISE_TRACTION);
214 return mElementwiseTractions;
218 template<
unsigned DIM>
221 assert(mTractionBoundaryConditionType==PRESSURE_ON_DEFORMED);
222 return mNormalPressure;
225 template<
unsigned DIM>
228 assert(mTractionBoundaryConditionType==FUNCTIONAL_TRACTION);
229 return (*mpTractionBoundaryConditionFunction)(rX,t);
232 template<
unsigned DIM>
235 assert(mTractionBoundaryConditionType==FUNCTIONAL_PRESSURE_ON_DEFORMED);
236 return (*mpNormalPressureFunction)(t);
239 template<
unsigned DIM>
242 assert(mTractionBoundaryConditionType==PRESSURE_ON_DEFORMED);
243 mNormalPressure = mOriginalNormalPressure*scaleFactor;
246 template<
unsigned DIM>
249 if(mDirichletNodes.size()==0)
251 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)