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 calclaSize(int j) override;
56  void calccorrSize(int j) override;
57  void calcrFactorSize(int j) override {rFactorSize=active?1:0; }
58  //void calcgdSizeActive() {gdSize=1; }
59  //void calclaSizeForActiveg() {laSize=0; } // event-driven
60  void updatehRef(fmatvec::Vec& hRef, int i=0) override;
61  void updaterRef(fmatvec::Vec& rRef, int i=0) override;
62  void updatedhdqRef(fmatvec::Mat& dhdqRef, int i=0) {};
63  void updatedhduRef(fmatvec::SqrMat& dhduRef, int i=0);
64  void updatedhdtRef(fmatvec::Vec& dhdtRef, int i=0);
65  void updaterRef(fmatvec::Vec& rRef);
66  void updateWRef(fmatvec::Mat& WRef, int i=0) override;
67  void updateVRef(fmatvec::Mat& VRef, int i=0) override;
68  // ==== END Methods for init-Process ===
69 
70  // ================================
71  // Methods for update-Process
72  // ================================
73  void checkActive(int j) override; /* update */
74  //void checkActivegdn(); // event-driven
75  bool gActiveChanged() override; /* update */
76  bool isActive() const override {return active; }
77  void updateGeneralizedForces() override;
78  void updategd() override; /* zdotStandard */
79  void updateStopVector() override; // event-driven
80  void updateh(int j) override; /* zdotStandard */
81  void updateW(int j) override; /* zdotStandard */
82  void updatedhdz();
83  // ==== END Methods for update-Process ===
84 
85  // ================================
86  // Methods for solve-Process
87  // ================================
88  void checkRoot() override;
89  void updaterFactors() override;
90  void solveImpactsFixpointSingle() override;
91  void solveConstraintsFixpointSingle() override;
92  void solveImpactsGaussSeidel() override;
93  void solveConstraintsGaussSeidel() override;
94  void solveImpactsRootFinding() override;
95  void solveConstraintsRootFinding() override;
96  void jacobianImpacts() override;
97  void jacobianConstraints() override;
98  void checkImpactsForTermination() override;
99  void checkConstraintsForTermination() override;
100  // ==== END Methods for solve-Process ===
101 
102 
103  private:
104  RigidHLine * line;
105  bool active, active0;
106  bool unilateral, bilateral;
107  double gdn, gdd;
108  double dpMin;
109 
110  LinePressureLoss * linePressureLoss;
111  ClosablePressureLoss * closablePressureLoss;
112  LeakagePressureLoss * leakagePressureLoss;
113  UnidirectionalPressureLoss * unidirectionalPressureLoss;
114 
117  };
118 
119 }
120 
121 #endif /* ----- #ifndef _HYDLINE_PRESSURELOSS_H_ ----- */
122 
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