mbsimhydraulics  4.0.0
MBSim Hydraulics Module
rigid_line_pressureloss.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 _RIGID_LINE_PRESSURELOSS_H_
21 #define _RIGID_LINE_PRESSURELOSS_H_
22 
23 #include "mbsim/links/link.h"
24 
25 namespace MBSim {
26  class GeneralizedForceLaw;
27  class GeneralizedImpactLaw;
28 }
29 
30 namespace MBSimHydraulics {
31 
32  class RigidHLine;
33  class PressureLoss;
34  class LinePressureLoss;
35  class ClosablePressureLoss;
36  class LeakagePressureLoss;
37  class UnidirectionalPressureLoss;
38 
41  public:
42  RigidLinePressureLoss(const std::string &name, RigidHLine * line_, PressureLoss * pressureLoss, bool bilateral_=false, bool unilateral_=false);
43  ~RigidLinePressureLoss() override;
44  void calcSize() override { nla = 1; updSize = false; }
45  void plot() override;
46 
47  void init(InitStage stage, const MBSim::InitConfigSet &config) override;
48  // ================================
49  // Methods from init-Process
50  // ================================
51  bool isSetValued() const override {return (unilateral or bilateral); }
52  bool isSingleValued() const override { return (not isSetValued()) or (bilateral or (unilateral and (fabs(dpMin)>1e-6))); }
53  void calcgdSize(int j) override {gdSize=active?1:0; }
54  void calcsvSize() override {svSize=isSetValued()?1:0; }
55  void updatehRef(fmatvec::Vec& hRef, int i=0) override;
56  void updaterRef(fmatvec::Vec& rRef, int i=0) override;
57  void updatedhdqRef(fmatvec::Mat& dhdqRef, int i=0) {};
58  void updatedhduRef(fmatvec::SqrMat& dhduRef, int i=0);
59  void updatedhdtRef(fmatvec::Vec& dhdtRef, int i=0);
60  void updaterRef(fmatvec::Vec& rRef);
61  void updateWRef(fmatvec::Mat& WRef, int i=0) override;
62  void updateVRef(fmatvec::Mat& VRef, int i=0) override;
63  // ==== END Methods for init-Process ===
64 
65  // ================================
66  // Methods for update-Process
67  // ================================
68  void checkActive(int j) override; /* update */
69  //void checkActivegdn(); // event-driven
70  bool gActiveChanged() override; /* update */
71  bool isActive() const override {return active; }
72  //void calcgdSizeActive() {gdSize=1; }
73  void calclaSize(int j) override {laSize=active?1:0; }
74  //void calclaSizeForActiveg() {laSize=0; } // event-driven
75  void calcrFactorSize(int j) override {rFactorSize=active?1:0; }
76  void updateGeneralizedForces() override;
77  void updategd() override; /* zdotStandard */
78  void updateStopVector() override; // event-driven
79  void updateh(int j) override; /* zdotStandard */
80  void updateW(int j) override; /* zdotStandard */
81  void updatedhdz();
82  // ==== END Methods for update-Process ===
83 
84  // ================================
85  // Methods for solve-Process
86  // ================================
87  void checkRoot() override;
88  void updaterFactors() override;
89  void solveImpactsFixpointSingle() override;
90  void solveConstraintsFixpointSingle() override;
91  void solveImpactsGaussSeidel() override;
92  void solveConstraintsGaussSeidel() override;
93  void solveImpactsRootFinding() override;
94  void solveConstraintsRootFinding() override;
95  void jacobianImpacts() override;
96  void jacobianConstraints() override;
97  void checkImpactsForTermination() override;
98  void checkConstraintsForTermination() override;
99  // ==== END Methods for solve-Process ===
100 
101 
102  private:
103  RigidHLine * line;
104  bool active, active0;
105  bool unilateral, bilateral;
106  double gdn, gdd;
107  double dpMin;
108 
109  LinePressureLoss * linePressureLoss;
110  ClosablePressureLoss * closablePressureLoss;
111  LeakagePressureLoss * leakagePressureLoss;
112  UnidirectionalPressureLoss * unidirectionalPressureLoss;
113 
116  };
117 
118 }
119 
120 #endif /* ----- #ifndef _HYDLINE_PRESSURELOSS_H_ ----- */
121 
Definition: pressure_loss.h:322
Definition: pressure_loss.h:47
Definition: hline.h:97
Definition: pressure_loss.h:168
Definition: pressure_loss.h:35
Definition: pressure_loss.h:273
std::string name
Definition: rigid_line_pressureloss.h:40