mbsimhydraulics 4.0.0 MBSim Hydraulics Module

dimensionless_line.h
1 /* Copyright (C) 2004-2009 MBSim Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 *
17 * Contact: markus.ms.schneider@gmail.com
18 */
19
20 #ifndef _DIMENSIONLESS_LINE_H_
21 #define _DIMENSIONLESS_LINE_H_
22
23 #include "mbsimHydraulics/hline.h"
24
25 namespace MBSimHydraulics {
26
28 class DimensionlessLine : public HLine {
29 public:
30 DimensionlessLine(const std::string &name) : HLine(name), length(0) {}
31
32 void calcSize() override { nu = 0; updSize = false; }
33 void setLength(double length_) {length=length_; }
34 double getLength() const {return length; }
35
36 fmatvec::VecV getInflowFactor() override {return fmatvec::VecV(1, fmatvec::INIT, -1.); }
37 fmatvec::VecV getOutflowFactor() override {return fmatvec::VecV(1, fmatvec::INIT, 1.); }
38 void calcqSize() override {qSize=0; }
39 void calcuSize(int j) override {uSize[j]=0; }
40
41 void initializeUsingXML(xercesc::DOMElement *element) override;
42 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
43 void plot() override;
44 protected:
45 double length;
46 };
47
48 class LeakagePressureLoss;
49 class PlaneLeakagePressureLoss;
50 class CircularLeakagePressureLoss;
51
52 class Leakage0DOF : public DimensionlessLine {
53 public:
54 Leakage0DOF(const std::string &name) : DimensionlessLine(name), lpl(nullptr), s1vFunction(nullptr), s2vFunction(nullptr), glFunction(nullptr) {}
55 ~Leakage0DOF() override;
56
57 void setGapLengthFunction(MBSim::Function<double(double)> * s) {
58 glFunction=s;
59 glFunction->setParent(this);
60 }
61 double evalGapLength() const;
62 void setSurface1VelocityFunction(MBSim::Function<double(double)> * s) {
63 s1vFunction=s;
64 s1vFunction->setParent(this);
65 }
66 double evalSurface1Velocity() const;
67 void setSurface2VelocityFunction(MBSim::Function<double(double)> * s) {
68 s2vFunction=s;
69 s2vFunction->setParent(this);
70 }
71 double evalSurface2Velocity() const;
72
73 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
74
75 void updateQ() override;
76
77 void initializeUsingXML(xercesc::DOMElement * element) override;
78 protected:
79 LeakagePressureLoss * lpl;
80 private:
81 MBSim::Function<double(double)> *s1vFunction, *s2vFunction, *glFunction;
82 };
83
84 class PlaneLeakage0DOF : public Leakage0DOF {
85 public:
86 PlaneLeakage0DOF(const std::string &name="") : Leakage0DOF(name) {}
87
88 void setGapWidth(double wGap_) {wGap=wGap_; }
89 double getGapWidth() const {return wGap; }
90 void setGapHeight(double hGap_) {hGap=hGap_; }
91 double getGapHeight() const {return hGap; }
92 void setPlaneLeakagePressureLoss(PlaneLeakagePressureLoss * plpl);
93
94 void initializeUsingXML(xercesc::DOMElement * element) override;
95 private:
96 double hGap{0}, wGap{0};
97 };
98
99 class CircularLeakage0DOF : public Leakage0DOF {
100 public:
101 CircularLeakage0DOF(const std::string &name="") : Leakage0DOF(name) {}
102
103 void setInnerRadius(double rI_) {rI=rI_; }
104 double getInnerRadius() const {return rI; }
105 void setGapHeight(double hGap_) {hGap=hGap_; }
106 double getGapHeight() const {return hGap; }
107 double getOuterRadius() const {return rO; }
108 void setCircularLeakagePressureLoss(CircularLeakagePressureLoss * clpl);
109
110 void init(InitStage stage, const MBSim::InitConfigSet &config) override;
111
112 void initializeUsingXML(xercesc::DOMElement * element) override;
113 private:
114 double rI{0}, rO{0}, hGap{0};
115 };
116
117 }
118
119 #endif /* ----- #ifndef _DIMENSIONLESS_LINE_H_ ----- */
120
MBSimHydraulics::HLine
Definition: hline.h:40
MBSim::Object::qSize
int qSize
MBSimHydraulics::CircularLeakage0DOF
Definition: dimensionless_line.h:99
MBSimHydraulics::LeakagePressureLoss
Definition: pressure_loss.h:274
MBSim::Element::InitStage
InitStage
MBSim::Function
MBSim::Element::name
std::string name
MBSim::Object::uSize
int uSize[2]
MBSimHydraulics::PlaneLeakagePressureLoss
Definition: pressure_loss.h:283
MBSimHydraulics::PlaneLeakage0DOF
Definition: dimensionless_line.h:84
MBSimHydraulics::Leakage0DOF
Definition: dimensionless_line.h:52
MBSimHydraulics::DimensionlessLine
Definition: dimensionless_line.h:28
MBSimHydraulics::CircularLeakagePressureLoss
Definition: pressure_loss.h:294