23 #include "mbsim/links/link.h"
24 #include <mbsim/functions/function.h>
26 #include <mbsim/utils/boost_parameters.h>
27 #include <mbsim/utils/openmbv_utils.h>
34 class GeneralizedForceLaw;
35 class GeneralizedImpactLaw;
38 namespace MBSimHydraulics {
40 BOOST_PARAMETER_NAME(size)
41 BOOST_PARAMETER_NAME(minimalPressure)
42 BOOST_PARAMETER_NAME(maximalPressure)
43 BOOST_PARAMETER_NAME(position)
58 HNode(
const std::string &name);
60 virtual std::string getType()
const {
return "HNode"; }
62 BOOST_PARAMETER_MEMBER_FUNCTION( (
void), enableOpenMBVSphere, tag, (optional (size,(
double),1)(minimalPressure,(
double),0e5)(maximalPressure,(
double),10e5)(position,(
const fmatvec::Vec3&),fmatvec::Vec3()))) {
63 enableOpenMBV(size,minimalPressure,maximalPressure,position);
65 virtual void enableOpenMBV(
double size,
double pMin,
double pMax,
const fmatvec::Vec3 &WrON);
67 void addInFlow(
HLine * in);
68 void addOutFlow(
HLine * out);
70 void calcgdSize(
int j) {gdSize=1; }
72 void init(InitStage stage);
78 void updatedhdqRef(
const fmatvec::Mat& dhdqRef,
int i=0);
80 void updatedhdtRef(
const fmatvec::Vec& dhdtRef,
int i=0);
82 double evalQHyd() {
if(updQHyd) updateQHyd();
return QHyd; }
83 double getQHyd(
bool check=
true)
const { assert((not check) or (not updQHyd));
return QHyd; }
84 virtual void updateQHyd();
86 void updateh(
int j=0);
89 bool isActive()
const {
return false; }
90 bool gActiveChanged() {
return false; }
94 void initializeUsingXML(xercesc::DOMElement *element);
96 void resetUpToDate() { MBSim::Link::resetUpToDate(); updQHyd =
true; }
99 std::vector<connectedLinesStruct> connectedLines;
100 std::vector<connectedLinesStruct> connected0DOFLines;
101 std::vector<std::string> refInflowString;
102 std::vector<std::string> refOutflowString;
106 std::shared_ptr<OpenMBV::Group> openMBVGrp;
107 std::shared_ptr<OpenMBV::Sphere> openMBVSphere;
117 virtual std::string getType()
const {
return "ConstrainedNode"; }
121 pFun->setParent(
this);
125 void updateGeneralizedForces();
126 void init(InitStage stage);
127 void initializeUsingXML(xercesc::DOMElement *element);
128 virtual bool isSingleValued()
const {
return true;}
139 virtual std::string getType()
const {
return "EnvironmentNode"; }
141 void init(InitStage stage);
143 virtual bool isSingleValued()
const {
return true;}
150 ElasticNode(
const std::string &name=
"") :
HNode(name), V(0), fracAir(0), p0(0), bulkModulus(NULL) {}
152 virtual std::string getType()
const {
return "ElasticNode"; }
154 void setVolume(
double V_) {V=V_; }
155 void setFracAir(
double fracAir_) {fracAir=fracAir_; }
156 void setp0(
double p0_) {p0=p0_; }
158 void calcxSize() {xSize=1; }
160 void init(InitStage stage);
161 void initializeUsingXML(xercesc::DOMElement *element);
163 void updateGeneralizedForces();
170 virtual bool isSingleValued()
const {
return true;}
185 virtual std::string getType()
const {
return "RigidNode"; }
187 bool isSetValued()
const {
return true; }
188 virtual bool isActive()
const {
return true; }
190 void init(InitStage stage);
192 void calclaSize(
int j) {laSize=1; }
194 void calcrFactorSize(
int j) {rFactorSize=1; }
196 void updateGeneralizedForces();
199 void updateW(
int j=0);
201 void updaterFactors();
202 void solveImpactsFixpointSingle();
203 void solveConstraintsFixpointSingle();
204 void solveImpactsGaussSeidel();
205 void solveConstraintsGaussSeidel();
206 void solveImpactsRootFinding();
207 void solveConstraintsRootFinding();
208 void jacobianImpacts();
209 void jacobianConstraints();
210 void checkImpactsForTermination();
211 void checkConstraintsForTermination();
212 const double& evalgdn();
213 const double& evalgdd();
226 virtual std::string getType()
const {
return "RigidCavitationNode"; }
228 void setCavitationPressure(
double pCav_) {pCav=pCav_; }
230 bool isSetValued()
const {
return true; }
231 bool hasSmoothPart()
const {
return true; }
232 virtual bool isActive()
const {
return active; }
234 void calcxSize() {xSize=1; }
235 void calcgSize(
int j) {gSize=1; }
237 void calclaSize(
int j) {laSize=1; }
239 void calcrFactorSize(
int j) {rFactorSize=1; }
240 void calcsvSize() {svSize=1; }
242 void init(InitStage stage);
243 void initializeUsingXML(xercesc::DOMElement *element);
246 void checkActive(
int j);
248 bool gActiveChanged();
250 void updateGeneralizedForces();
252 void updateW(
int j=0);
255 void updateStopVector();
258 void updaterFactors();
259 void solveImpactsFixpointSingle();
260 void solveConstraintsFixpointSingle();
261 void solveImpactsGaussSeidel();
262 void solveConstraintsGaussSeidel();
263 void solveImpactsRootFinding();
264 void solveConstraintsRootFinding();
265 void jacobianImpacts();
266 void jacobianConstraints();
267 void checkImpactsForTermination();
268 void checkConstraintsForTermination();
269 const double& evalgdn();
270 const double& evalgdd();
275 bool active, active0;
286 virtual std::string getType()
const {
return "PressurePump"; }
288 void setpFunction(
MBSim::Function<
double(
double)> *pFunction_) { pFunction=pFunction_; }
290 void init(InitStage stage);
292 void updateGeneralizedForces();
293 void initializeUsingXML(xercesc::DOMElement *element);
Definition: environment.h:98