MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
Pipe Class Reference

#include <pipe.h>

Inheritance diagram for Pipe:
Collaboration diagram for Pipe:

Public Member Functions

 Pipe (unsigned int uL, const DofOwner *pD, HydraulicFluid *hf, const PressureNode *p1, const PressureNode *p2, doublereal Dh, doublereal A, doublereal L, flag transition, doublereal q0, flag fOut)
 
 ~Pipe (void)
 
virtual HydraulicElem::Type GetHydraulicType (void) const
 
virtual std::ostream & Restart (std::ostream &out) const
 
virtual unsigned int iGetNumDof (void) const
 
virtual DofOrder::Order GetDofType (unsigned int i) const
 
virtual void WorkSpaceDim (integer *piNumRows, integer *piNumCols) const
 
VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
SubVectorHandlerAssRes (SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP)
 
virtual void Output (OutputHandler &OH) const
 
virtual void SetValue (DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *ph=0)
 
virtual void GetConnectedNodes (std::vector< const Node * > &connectedNodes) const
 
- Public Member Functions inherited from Elem
 Elem (unsigned int uL, flag fOut)
 
virtual ~Elem (void)
 
virtual std::ostream & DescribeDof (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeDof (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual std::ostream & DescribeEq (std::ostream &out, const char *prefix="", bool bInitial=false) const
 
virtual void DescribeEq (std::vector< std::string > &desc, bool bInitial=false, int i=-1) const
 
virtual void AssMats (VariableSubMatrixHandler &WorkMatA, VariableSubMatrixHandler &WorkMatB, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual bool bInverseDynamics (void) const
 
void SetInverseDynamicsFlags (unsigned uIDF)
 
unsigned GetInverseDynamicsFlags (void) const
 
bool bIsErgonomy (void) const
 
bool bIsRightHandSide (void) const
 
virtual VariableSubMatrixHandlerAssJac (VariableSubMatrixHandler &WorkMat, const VectorHandler &XCurr)
 
virtual SubVectorHandlerAssRes (SubVectorHandler &WorkVec, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr, const VectorHandler &XPrimePrimeCurr, InverseDynamics::Order iOrder=InverseDynamics::INVERSE_DYNAMICS)
 
virtual int GetNumConnectedNodes (void) const
 
- Public Member Functions inherited from WithLabel
 WithLabel (unsigned int uL=0, const std::string &sN="")
 
virtual ~WithLabel (void)
 
void PutLabel (unsigned int uL)
 
void PutName (const std::string &sN)
 
unsigned int GetLabel (void) const
 
const std::string & GetName (void) const
 
- Public Member Functions inherited from SimulationEntity
 SimulationEntity (void)
 
virtual ~SimulationEntity (void)
 
virtual bool bIsValidIndex (unsigned int i) const
 
virtual DofOrder::Order GetEqType (unsigned int i) const
 
virtual HintParseHint (DataManager *pDM, const char *s) const
 
virtual void BeforePredict (VectorHandler &, VectorHandler &, VectorHandler &, VectorHandler &) const
 
virtual void AfterPredict (VectorHandler &X, VectorHandler &XP)
 
virtual void Update (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void DerivativesUpdate (const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
 
virtual void Update (const VectorHandler &XCurr, InverseDynamics::Order iOrder)
 
virtual void AfterConvergence (const VectorHandler &X, const VectorHandler &XP, const VectorHandler &XPP)
 
virtual unsigned int iGetNumPrivData (void) const
 
virtual unsigned int iGetPrivDataIdx (const char *s) const
 
virtual doublereal dGetPrivData (unsigned int i) const
 
virtual std::ostream & OutputAppend (std::ostream &out) const
 
virtual void ReadInitialState (MBDynParser &HP)
 
- Public Member Functions inherited from ToBeOutput
 ToBeOutput (flag fOut=fDefaultOut)
 
virtual ~ToBeOutput (void)
 
virtual void OutputPrepare (OutputHandler &OH)
 
virtual void Output (OutputHandler &OH, const VectorHandler &X, const VectorHandler &XP) const
 
virtual flag fToBeOutput (void) const
 
virtual bool bToBeOutput (void) const
 
virtual void SetOutputFlag (flag f=flag(1))
 
- Public Member Functions inherited from HydraulicElem
 HydraulicElem (unsigned int uL, const DofOwner *pDO, HydraulicFluid *hf, flag fOut)
 
virtual ~HydraulicElem (void)
 
virtual Elem::Type GetElemType (void) const
 
- Public Member Functions inherited from ElemWithDofs
 ElemWithDofs (unsigned int uL, const DofOwner *pDO, flag fOut)
 
virtual ~ElemWithDofs (void)
 
- Public Member Functions inherited from DofOwnerOwner
 DofOwnerOwner (const DofOwner *pDO)
 
virtual ~DofOwnerOwner ()
 
virtual const DofOwnerpGetDofOwner (void) const
 
virtual integer iGetFirstIndex (void) const
 
virtual void SetInitialValue (VectorHandler &X)
 

Private Attributes

const PressureNodepNode1
 
const PressureNodepNode2
 
doublereal diameter
 
doublereal viscosity
 
doublereal area
 
doublereal length
 
flag turbulent
 
doublereal q0
 
doublereal vel
 
doublereal flow
 
doublereal Re
 
doublereal ktrb
 
doublereal klam
 
doublereal ktra
 

Additional Inherited Members

- Public Types inherited from Elem
enum  Type {
  UNKNOWN = -1, AIRPROPERTIES = 0, INDUCEDVELOCITY, AUTOMATICSTRUCTURAL,
  GRAVITY, BODY, JOINT, JOINT_REGULARIZATION,
  BEAM, PLATE, FORCE, INERTIA,
  ELECTRICBULK, ELECTRIC, THERMAL, HYDRAULIC,
  BULK, LOADABLE, DRIVEN, EXTERNAL,
  AEROMODAL, AERODYNAMIC, GENEL, SOCKETSTREAM_OUTPUT,
  RTAI_OUTPUT = SOCKETSTREAM_OUTPUT, LASTELEMTYPE
}
 
- Public Types inherited from SimulationEntity
typedef std::vector< Hint * > Hints
 
- Public Types inherited from ToBeOutput
enum  { OUTPUT = 0x1U, OUTPUT_MASK = 0xFU, OUTPUT_PRIVATE = 0x10U, OUTPUT_PRIVATE_MASK = ~OUTPUT_MASK }
 
- Public Types inherited from HydraulicElem
enum  Type {
  UNKNOWN = -1, MINOR_LOSS = 0, THREEWAYMINORLOSS, CONTROL_VALVE,
  DYNAMIC_CONTROL_VALVE, PRESSURE_FLOW_CONTROL_VALVE, PRESSURE_VALVE, FLOW_VALVE,
  ORIFICE, ACCUMULATOR, TANK, PIPE,
  DYNAMIC_PIPE, HYDRAULIC_ACTUATOR, ACTUATOR, LASTHYDRAULICTYPE
}
 
- Protected Attributes inherited from WithLabel
unsigned int uLabel
 
std::string sName
 
- Protected Attributes inherited from ToBeOutput
flag fOutput
 
- Protected Attributes inherited from HydraulicElem
HydraulicFluidHF
 

Detailed Description

Definition at line 45 of file pipe.h.

Constructor & Destructor Documentation

Pipe::Pipe ( unsigned int  uL,
const DofOwner pD,
HydraulicFluid hf,
const PressureNode p1,
const PressureNode p2,
doublereal  Dh,
doublereal  A,
doublereal  L,
flag  transition,
doublereal  q0,
flag  fOut 
)

Definition at line 46 of file pipe.cc.

References area, ASSERT, DEBUGCOUT, HydraulicFluid::dGetDensity(), HydraulicFluid::dGetViscosity(), ScalarAlgebraicNode::dGetX(), diameter, PressureNode::GetNodeType(), HydraulicElem::HF, Node::HYDRAULIC, klam, ktra, ktrb, length, pNode1, pNode2, grad::pow(), and viscosity.

50 : Elem(uL, fOut),
51 HydraulicElem(uL, pDO, hf, fOut),
52 pNode1(p1), pNode2(p2),
53 diameter(Dh), area(A),
54 length(L), turbulent(transition), q0(q0)
55 {
56  ASSERT(pNode1 != NULL);
58  ASSERT(pNode2 != NULL);
60  ASSERT(Dh > std::numeric_limits<doublereal>::epsilon());
61  ASSERT(A > std::numeric_limits<doublereal>::epsilon());
62  ASSERT(L> std::numeric_limits<doublereal>::epsilon());
64 
65  doublereal density = HF->dGetDensity((pNode1->dGetX()+pNode2->dGetX())/2.);
66 
67  klam = 32.*length*viscosity/((diameter*diameter)*area*density);
68  ktra = .5*length/(diameter*density*area*area);
69  doublereal den = pow(diameter, 1.25)*pow(area, 1.75)*density;
70  doublereal num = .1582*pow(viscosity, .25)*length;
71  ktrb = num/den;
72 
73 #ifdef HYDR_DEVEL
74  DEBUGCOUT("Costruttore Laminare: klam: " << klam <<std::endl);
75  DEBUGCOUT("Costruttore Transizione: ktra: " << ktra <<std::endl);
76  DEBUGCOUT("Costruttore Turbolento: ktrb: " << ktrb <<std::endl);
77 #endif /* HYDR_DEVEL */
78 }
const PressureNode * pNode1
Definition: pipe.h:47
GradientExpression< BinaryExpr< FuncPow, LhsExpr, RhsExpr > > pow(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
Definition: gradient.h:2961
flag turbulent
Definition: pipe.h:53
doublereal area
Definition: pipe.h:51
doublereal ktra
Definition: pipe.h:61
virtual doublereal dGetDensity(void) const =0
virtual const doublereal & dGetX(void) const
Definition: node.h:492
HydraulicElem(unsigned int uL, const DofOwner *pDO, HydraulicFluid *hf, flag fOut)
Definition: preselem.cc:54
doublereal q0
Definition: pipe.h:54
HydraulicFluid * HF
Definition: preselem.h:79
#define DEBUGCOUT(msg)
Definition: myassert.h:232
doublereal length
Definition: pipe.h:52
doublereal ktrb
Definition: pipe.h:59
#define ASSERT(expression)
Definition: colamd.c:977
const PressureNode * pNode2
Definition: pipe.h:48
virtual doublereal dGetViscosity(void) const =0
doublereal diameter
Definition: pipe.h:49
doublereal viscosity
Definition: pipe.h:50
virtual Node::Type GetNodeType(void) const
Definition: presnode.h:54
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
double doublereal
Definition: colamd.c:52
doublereal klam
Definition: pipe.h:60

Here is the call graph for this function:

Pipe::~Pipe ( void  )

Definition at line 80 of file pipe.cc.

References NO_OP.

81 {
82  NO_OP;
83 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

void Pipe::AfterConvergence ( const VectorHandler X,
const VectorHandler XP 
)
virtual

Reimplemented from SimulationEntity.

Definition at line 426 of file pipe.cc.

References DEBUGCOUT, HydraulicFluid::dGetRe(), WithLabel::GetLabel(), HydraulicElem::HF, HydraulicFluid::LOWER, Re, turbulent, and HydraulicFluid::UPPER.

427 {
428  if (Re < HF->dGetRe(HydraulicFluid::LOWER)) {
429 #ifdef HYDR_DEVEL
430  DEBUGCOUT("Pipe(" << GetLabel() << "): laminar" << std::endl);
431 #endif /* HYDR_DEVEL */
432  turbulent = 0;
433  } else if (Re > HF->dGetRe(HydraulicFluid::UPPER)) {
434 #ifdef HYDR_DEVEL
435  DEBUGCOUT("Pipe(" << GetLabel() << "): turbulent" << std::endl);
436 #endif /* HYDR_DEVEL */
437  turbulent = 1;
438 #ifdef HYDR_DEVEL
439  } else {
440  DEBUGCOUT("Pipe(" << GetLabel() << "): transition ("
441  << turbulent << ")" << std::endl);
442 #endif /* HYDR_DEVEL */
443  }
444 }
flag turbulent
Definition: pipe.h:53
virtual doublereal dGetRe(Re which)
Definition: hfluid.h:95
HydraulicFluid * HF
Definition: preselem.h:79
#define DEBUGCOUT(msg)
Definition: myassert.h:232
doublereal Re
Definition: pipe.h:58
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

VariableSubMatrixHandler & Pipe::AssJac ( VariableSubMatrixHandler WorkMat,
doublereal  dCoef,
const VectorHandler XCurr,
const VectorHandler XPrimeCurr 
)
virtual

Implements Elem.

Definition at line 112 of file pipe.cc.

References a, area, c, DEBUGCOUT, HydraulicFluid::dGetDensity(), HydraulicFluid::dGetRe(), ScalarAlgebraicNode::dGetX(), diameter, grad::fabs(), HydraulicElem::HF, Node::iGetFirstColIndex(), DofOwnerOwner::iGetFirstIndex(), Node::iGetFirstRowIndex(), klam, ktra, ktrb, length, HydraulicFluid::LOWER, pNode1, pNode2, grad::pow(), FullSubMatrixHandler::PutCoef(), FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), Re, FullSubMatrixHandler::ResizeReset(), VariableSubMatrixHandler::SetFull(), turbulent, HydraulicFluid::UPPER, and viscosity.

116 {
117  DEBUGCOUT("Entering Pipe::AssJac()" << std::endl);
118 #ifdef HYDR_DEVEL
119  DEBUGCOUT("dblepsilon INIZIO: " << std::numeric_limits<doublereal>::epsilon() << std::endl);
120 #endif /* HYDR_DEVEL */
121 
122  FullSubMatrixHandler& WM = WorkMat.SetFull();
123  WM.ResizeReset(3, 3);
124 
125  integer iNode1RowIndex = pNode1->iGetFirstRowIndex()+1;
126  integer iNode2RowIndex = pNode2->iGetFirstRowIndex()+1;
127  integer iNode1ColIndex = pNode1->iGetFirstColIndex()+1;
128  integer iNode2ColIndex = pNode2->iGetFirstColIndex()+1;
129  integer iFirstIndex = iGetFirstIndex()+1;
130 
131  WM.PutRowIndex(1, iNode1RowIndex);
132  WM.PutRowIndex(2, iNode2RowIndex);
133  WM.PutColIndex(1, iNode1ColIndex);
134  WM.PutColIndex(2, iNode2ColIndex);
135  WM.PutRowIndex(3, iFirstIndex);
136  WM.PutColIndex(3, iFirstIndex);
137 
138  doublereal p1 = pNode1->dGetX();
139  doublereal p2 = pNode2->dGetX();
140  doublereal jumpPres = fabs(p1-p2);
141  doublereal q = XCurr(iFirstIndex); /* portata */
142  doublereal Jac13 = -1.;
143  doublereal Jac23 = 1.;
144  doublereal Jac31 = 1.;
145  doublereal Jac32 = -1.;
146  doublereal Jac33;
147 
148  if (Re < HF->dGetRe(HydraulicFluid::LOWER)) {
149  /****************************************
150  * moto sicuramente laminare (jacobiano)
151  ***************************************/
152 #ifdef HYDR_DEVEL
153  DEBUGCOUT("Entering Pipe::AssJac() sono laminare" << std::endl);
154 #endif /* HYDR_DEVEL */
155  Jac33 = -klam;
156  } else if (Re > HF->dGetRe(HydraulicFluid::UPPER)) {
157  /*******************************************
158  * moto sicuramente turbolento (jacobiano)
159  ******************************************/
160 #ifdef HYDR_DEVEL
161  DEBUGCOUT("Entering Pipe::AssJac() sono turbolento" << std::endl);
162 #endif /* HYDR_DEVEL */
163  /* evito di dividere per un numero troppo piccolo */
164  if (jumpPres < 1.e8*std::numeric_limits<doublereal>::epsilon()) {
165  jumpPres = 1.e8*std::numeric_limits<doublereal>::epsilon();
166  }
167 #ifdef HYDR_DEVEL
168  DEBUGCOUT("AssJac() JUMPPRES dopo: " << jumpPres << std::endl);
169 #endif /* HYDR_DEVEL */
170 
171  Jac33 = -7./4.*ktrb*pow(fabs(q),3./4.);
172 
173  } else {
174  /***********************************
175  * moto di transizione (jacobiano)
176  **********************************/
177 #ifdef HYDR_DEVEL
178  DEBUGCOUT("Entering Pipe::AssJac() sono in transizione" << std::endl);
179 #endif /* HYDR_DEVEL */
180  if (turbulent == 0) {
181  /*******************************************************
182  * moto di transizione laminare-turbolento (jacobiano)
183  ******************************************************/
184 #ifdef HYDR_DEVEL
185  DEBUGCOUT("Sono in transizione lam->turb" << std::endl);
186 #endif /* HYDR_DEVEL */
187  if (Re < HF->dGetRe(HydraulicFluid::LOWER)*1.25) {
188  /* uso lo jacobiano laminare */
189  Jac33 = -klam;
190  } else {
192  doublereal c = -1.8e-5*dva;
193  doublereal dva2 = dva*dva;
194  doublereal b = 8.e-10*dva2;
195  doublereal dva3 = dva2*dva;
196  doublereal a = 7.e-13*dva3;
197  doublereal d = .0542;
198 
199  doublereal aq = fabs(q);
200  doublereal aq2 = aq*aq;
201  doublereal aq3 = aq2*aq;
202  doublereal aq4 = aq3*aq;
203 
204  Jac33 = -5.*ktra*a*aq4-4.*ktra*b*aq3-3.*ktra*c*aq2-2.*ktra*d*aq;
205  }
206  } else {
207  /*******************************************************
208  * moto di transizione turbolento-laminare (jacobiano)
209  ******************************************************/
210 #ifdef HYDR_DEVEL
211  DEBUGCOUT("Sono in transizione turb->lam" << std::endl);
212 #endif /* HYDR_DEVEL */
213  if (Re > HF->dGetRe(HydraulicFluid::UPPER)*.775) {
214  /* uso lo jacobiano turbolento per la parte finale */
215  /* evito di dividere per un numero troppo piccolo */
216  if (jumpPres < 1.e8*std::numeric_limits<doublereal>::epsilon()) {
217  jumpPres = 1.e8*std::numeric_limits<doublereal>::epsilon();
218  }
219 #ifdef HYDR_DEVEL
220  DEBUGCOUT("AssJac() JUMPPRES dopo: " << jumpPres << std::endl);
221 #endif /* HYDR_DEVEL */
222 
223  Jac33 = -7./4.*ktrb*pow(fabs(q),3./4.);
224 
225  } else {
226 #ifdef HYDR_DEVEL
227  DEBUGCOUT("Jac turb->lam: TRATTO DI INTERPOLAZIONE" << std::endl);
228 #endif /* HYDR_DEVEL */
230  doublereal c = -1.8e-5*dva;
231  doublereal dva2 = dva*dva;
232  doublereal b = 2.e-9*dva2;
233  doublereal dva3 = dva2*dva;
234  doublereal a = 9.e-13*dva3;
235  doublereal d = .0528;
236 
237  doublereal aq = fabs(q);
238  doublereal aq2 = aq*aq;
239  doublereal aq3 = aq2*aq;
240  doublereal aq4 = aq3*aq;
241 
242  Jac33 = -5.*ktra*a*aq4-4.*ktra*b*aq3-3.*ktra*c*aq2-2.*ktra*d*aq;
243  }
244  }
245  }
246 
247 #ifdef HYDR_DEVEL
248  DEBUGCOUT("JAC Re: " << Re << std::endl);
249  DEBUGCOUT("JAC density: " << HF->dGetDensity((p1+p2)/2.) << std::endl);
250  DEBUGCOUT("JAC p1: " << p1 << std::endl);
251  DEBUGCOUT("JAC p2: " << p2 << std::endl);
252  DEBUGCOUT("JAC jumpPres: " << jumpPres << std::endl);
253  DEBUGCOUT("JAC length: " << length << std::endl);
254  DEBUGCOUT("JAC diameter: " << diameter << std::endl);
255  DEBUGCOUT("JAC viscosity: " << viscosity << std::endl);
256  DEBUGCOUT("JAC turbulent: " << turbulent << std::endl);
257  DEBUGCOUT("JAC q: " << q << std::endl);
258  DEBUGCOUT("JAC Jac13: " << Jac13 << std::endl);
259  DEBUGCOUT("JAC Jac23: " << Jac23 << std::endl);
260  DEBUGCOUT("JAC Jac31: " << Jac31 << std::endl);
261  DEBUGCOUT("JAC Jac32: " << Jac32 << std::endl);
262  DEBUGCOUT("JAC Jac33: " << Jac33 << std::endl);
263 #endif /* HYDR_DEVEL */
264 
265  WM.PutCoef(1, 3, Jac13);
266  WM.PutCoef(2, 3, Jac23);
267  WM.PutCoef(3, 1, Jac31);
268  WM.PutCoef(3, 2, Jac32);
269  WM.PutCoef(3, 3, Jac33);
270 
271  return WorkMat;
272 }
const PressureNode * pNode1
Definition: pipe.h:47
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
GradientExpression< BinaryExpr< FuncPow, LhsExpr, RhsExpr > > pow(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
Definition: gradient.h:2961
flag turbulent
Definition: pipe.h:53
virtual doublereal dGetRe(Re which)
Definition: hfluid.h:95
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
void PutCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:672
doublereal area
Definition: pipe.h:51
GradientExpression< UnaryExpr< FuncFabs, Expr > > fabs(const GradientExpression< Expr > &u)
Definition: gradient.h:2973
doublereal ktra
Definition: pipe.h:61
virtual doublereal dGetDensity(void) const =0
virtual const doublereal & dGetX(void) const
Definition: node.h:492
HydraulicFluid * HF
Definition: preselem.h:79
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual integer iGetFirstRowIndex(void) const
Definition: node.cc:82
doublereal length
Definition: pipe.h:52
doublereal ktrb
Definition: pipe.h:59
const PressureNode * pNode2
Definition: pipe.h:48
doublereal diameter
Definition: pipe.h:49
doublereal viscosity
Definition: pipe.h:50
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
static std::stack< cleanup * > c
Definition: cleanup.cc:59
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
doublereal Re
Definition: pipe.h:58
static const doublereal a
Definition: hfluid_.h:289
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
doublereal klam
Definition: pipe.h:60
long int integer
Definition: colamd.c:51
virtual integer iGetFirstColIndex(void) const
Definition: node.cc:88

Here is the call graph for this function:

SubVectorHandler & Pipe::AssRes ( SubVectorHandler WorkVec,
doublereal  dCoef,
const VectorHandler XCurr,
const VectorHandler XPrimeCurr 
)
virtual

Implements Elem.

Definition at line 275 of file pipe.cc.

References a, area, c, copysign(), DEBUGCOUT, HydraulicFluid::dGetDensity(), HydraulicFluid::dGetRe(), ScalarAlgebraicNode::dGetX(), diameter, grad::fabs(), flow, HydraulicElem::HF, DofOwnerOwner::iGetFirstIndex(), Node::iGetFirstRowIndex(), klam, ktra, ktrb, length, HydraulicFluid::LOWER, pNode1, pNode2, grad::pow(), SubVectorHandler::PutItem(), Re, VectorHandler::Resize(), turbulent, HydraulicFluid::UPPER, vel, and viscosity.

279 {
280  DEBUGCOUT("Entering Pipe::AssRes()" << std::endl);
281  WorkVec.Resize(3);
282 
283  integer iNode1RowIndex = pNode1->iGetFirstRowIndex()+1;
284  integer iNode2RowIndex = pNode2->iGetFirstRowIndex()+1;
285  integer iFirstIndex = iGetFirstIndex()+1;
286 
287  doublereal q = XCurr(iFirstIndex); /* portata q */
288  doublereal p1 = pNode1->dGetX();
289  doublereal p2 = pNode2->dGetX();
290  doublereal density = HF->dGetDensity((p1+p2)/2.);
291 
292  doublereal Res_1 = q;
293  doublereal Res_2 = -q;
294  doublereal Res_3 = 0.;
295 
296  flow = q;
297  vel = flow/(density*area);
298  Re = density*fabs(vel)*diameter/viscosity;
299  if (Re < HF->dGetRe(HydraulicFluid::LOWER)) {
300  /**************************************
301  * moto sicuramente laminare (residuo)
302  *************************************/
303 #ifdef HYDR_DEVEL
304  DEBUGCOUT("Entering Pipe::AssRes() SONO LAMINARE" << std::endl);
305 #endif /* HYDR_DEVEL */
306  Res_3 = klam*q-p1+p2;
307  } else if (Re > HF->dGetRe(HydraulicFluid::UPPER)) {
308  /*****************************************
309  * moto sicuramente turbolento (residuo)
310  ****************************************/
311 #ifdef HYDR_DEVEL
312  DEBUGCOUT("Entering Pipe::AssRes() SONO TURBOLENTO" << std::endl);
313 #endif /* HYDR_DEVEL */
314  Res_3= ktrb*copysign(pow(fabs(q),7./4.),q)-p1+p2;
315  } else {
316  /*********************************
317  * moto di transizione (residuo)
318  ********************************/
319 #ifdef HYDR_DEVEL
320  DEBUGCOUT("SONO IN TRANSIZIONE " << std::endl);
321  DEBUGCOUT("Re: " << Re << std::endl);
322  DEBUGCOUT("q: " << q << std::endl);
323  DEBUGCOUT("vel: " << vel << std::endl);
324 #endif /* HYDR_DEVEL */
325  if (turbulent == 0) {
326  /*****************************************************
327  * moto di transizione laminare-turbolento (residuo)
328  ****************************************************/
329 #ifdef HYDR_DEVEL
330  DEBUGCOUT("SONO IN TRANSIZIONE lam->turb" << std::endl);
331 #endif /* HYDR_DEVEL */
332  if (Re < HF->dGetRe(HydraulicFluid::LOWER)*1.25) {
333  /* uso il residuo laminare */
334  Res_3 = klam*q-p1+p2;
335 #ifdef HYDR_DEVEL
336  DEBUGCOUT("RES lam->turb: TRATTO 64/RE" << std::endl);
337  DEBUGCOUT("Re: " << Re << std::endl);
338 #endif /* HYDR_DEVEL */
339  } else {
340 #ifdef HYDR_DEVEL
341  DEBUGCOUT("RES lam->turb:TRATTO DI INTERPOLAZIONE"<< std::endl);
342 #endif /* HYDR_DEVEL */
344  doublereal c = -1.8e-5*dva;
345  doublereal dva2 = dva*dva;
346  doublereal b = 8.e-10*dva2;
347  doublereal dva3 = dva2*dva;
348  doublereal a = 7.e-13*dva3;
349  doublereal d = .0542;
350 
351 #ifdef HYDR_DEVEL
352  doublereal fa = ((a*q+b)*q+c)*q+d;
353  DEBUGCOUT("fa lam->turb: " << fa << std::endl);
354 #endif /* HYDR_DEVEL */
355  doublereal aq = fabs(q);
356  doublereal aq2 = aq*aq;
357  doublereal aq3 = aq2*aq;
358  doublereal aq4 = aq3*aq;
359 
360  Res_3 = -p1+p2+q*(ktra*a*aq4+ktra*b*aq3+ktra*c*aq2+ktra*d*aq);
361  }
362  } else {
363  /****************************************************
364  * moto di transizione turbolento-laminare (residuo)
365  ***************************************************/
366 #ifdef HYDR_DEVEL
367  DEBUGCOUT("SONO IN TRANSIZIONE turb->lam" << std::endl);
368 #endif /* HYDR_DEVEL */
369  if (Re > HF->dGetRe(HydraulicFluid::UPPER)*.775) {
370  /* utilizzo il residuo turbolento */
371  Res_3= ktrb*copysign(pow(fabs(q),7./4.),q)-p1+p2;
372 
373 #ifdef HYDR_DEVEL
374  DEBUGCOUT("RES turb->lam:TRATTO 0.3164/Re^0.25" << std::endl);
375 #endif /* HYDR_DEVEL */
376  } else {
377 #ifdef HYDR_DEVEL
378  DEBUGCOUT("RES turb->lam:TRATTO DI INTERPOLAZIONE"<< std::endl);
379 #endif /* HYDR_DEVEL */
381  doublereal c = -1.8e-5*dva;
382  doublereal dva2 = dva*dva;
383  doublereal b = 2.e-9*dva2;
384  doublereal dva3 = dva2*dva;
385  doublereal a = 9.e-13*dva3;
386  doublereal d = .0528;
387 
388  doublereal aq = fabs(q);
389  doublereal aq2 = aq*aq;
390  doublereal aq3 = aq2*aq;
391  doublereal aq4 = aq3*aq;
392 
393  Res_3 = -p1+p2+q*(ktra*a*aq4+ktra*b*aq3+ktra*c*aq2+ktra*d*aq);
394  }
395  }
396  }
397 
398 #ifdef HYDR_DEVEL
399  DEBUGCOUT("RES density: " << density << std::endl);
400  DEBUGCOUT("RES p1: " << p1 << std::endl);
401  DEBUGCOUT("RES p2: " << p2 << std::endl);
402  DEBUGCOUT("RES jumpPres: " << fabs(p1-p2) << std::endl);
403  DEBUGCOUT("RES length: " << length << std::endl);
404  DEBUGCOUT("RES diameter: " << diameter << std::endl);
405  DEBUGCOUT("RES viscosity: " << viscosity << std::endl);
406  DEBUGCOUT("RES area : " << area << std::endl);
407  DEBUGCOUT("RES q: " << q << std::endl);
408  DEBUGCOUT("***********************************************" << std::endl);
409  DEBUGCOUT("RES velocita': " << vel << std::endl);
410  DEBUGCOUT(" se positiva il fluido va dal nodo 1 al nodo 2" << std::endl);
411  DEBUGCOUT("***********************************************" << std::endl);
412  DEBUGCOUT("RES Re: " << Re << std::endl);
413  DEBUGCOUT("RES Res_1: " << Res_1 << std::endl);
414  DEBUGCOUT("RES Res_2: " << Res_2 << std::endl);
415  DEBUGCOUT("RES Res_3: " << Res_3 << std::endl);
416 #endif /* HYDR_DEVEL */
417 
418  WorkVec.PutItem(1, iNode1RowIndex, Res_1);
419  WorkVec.PutItem(2, iNode2RowIndex, Res_2);
420  WorkVec.PutItem(3, iFirstIndex, Res_3);
421 
422  return WorkVec;
423 }
const PressureNode * pNode1
Definition: pipe.h:47
GradientExpression< BinaryExpr< FuncPow, LhsExpr, RhsExpr > > pow(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
Definition: gradient.h:2961
doublereal vel
Definition: pipe.h:56
flag turbulent
Definition: pipe.h:53
virtual doublereal dGetRe(Re which)
Definition: hfluid.h:95
doublereal area
Definition: pipe.h:51
GradientExpression< UnaryExpr< FuncFabs, Expr > > fabs(const GradientExpression< Expr > &u)
Definition: gradient.h:2973
virtual void PutItem(integer iSubRow, integer iRow, const doublereal &dCoef)
Definition: submat.h:1445
doublereal ktra
Definition: pipe.h:61
virtual doublereal dGetDensity(void) const =0
virtual const doublereal & dGetX(void) const
Definition: node.h:492
HydraulicFluid * HF
Definition: preselem.h:79
doublereal copysign(doublereal x, doublereal y)
Definition: gradient.h:97
#define DEBUGCOUT(msg)
Definition: myassert.h:232
virtual integer iGetFirstRowIndex(void) const
Definition: node.cc:82
doublereal length
Definition: pipe.h:52
doublereal ktrb
Definition: pipe.h:59
const PressureNode * pNode2
Definition: pipe.h:48
doublereal diameter
Definition: pipe.h:49
doublereal flow
Definition: pipe.h:57
doublereal viscosity
Definition: pipe.h:50
static std::stack< cleanup * > c
Definition: cleanup.cc:59
doublereal Re
Definition: pipe.h:58
static const doublereal a
Definition: hfluid_.h:289
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
doublereal klam
Definition: pipe.h:60
long int integer
Definition: colamd.c:51
virtual void Resize(integer iNewSize)=0

Here is the call graph for this function:

virtual void Pipe::GetConnectedNodes ( std::vector< const Node * > &  connectedNodes) const
inlinevirtual

Reimplemented from Elem.

Definition at line 104 of file pipe.h.

References pNode1, and pNode2.

104  {
105  connectedNodes.resize(2);
106  connectedNodes[0] = pNode1;
107  connectedNodes[1] = pNode2;
108  };
const PressureNode * pNode1
Definition: pipe.h:47
const PressureNode * pNode2
Definition: pipe.h:48
DofOrder::Order Pipe::GetDofType ( unsigned int  i) const
virtual

Reimplemented from Elem.

Definition at line 100 of file pipe.cc.

References DofOrder::ALGEBRAIC, and ASSERT.

100  {
101  ASSERT(i == 0);
102  return DofOrder::ALGEBRAIC;
103 }
#define ASSERT(expression)
Definition: colamd.c:977
HydraulicElem::Type Pipe::GetHydraulicType ( void  ) const
virtual

Implements HydraulicElem.

Definition at line 86 of file pipe.cc.

References HydraulicElem::PIPE.

86  {
87  return HydraulicElem::PIPE;
88 }
unsigned int Pipe::iGetNumDof ( void  ) const
virtual

Reimplemented from Elem.

Definition at line 96 of file pipe.cc.

96  {
97  return 1;
98 }
void Pipe::Output ( OutputHandler OH) const
virtual

Reimplemented from ToBeOutput.

Definition at line 446 of file pipe.cc.

References ToBeOutput::bToBeOutput(), flow, WithLabel::GetLabel(), OutputHandler::Hydraulic(), Re, and vel.

447 {
448  if (bToBeOutput()) {
449  OH.Hydraulic()
450  << std::setw(8) << GetLabel()
451  << " " << vel << " " << flow << " " << Re << std::endl;
452  }
453 }
virtual bool bToBeOutput(void) const
Definition: output.cc:890
doublereal vel
Definition: pipe.h:56
doublereal flow
Definition: pipe.h:57
doublereal Re
Definition: pipe.h:58
std::ostream & Hydraulic(void) const
Definition: output.h:492
unsigned int GetLabel(void) const
Definition: withlab.cc:62

Here is the call graph for this function:

std::ostream & Pipe::Restart ( std::ostream &  out) const
virtual

Implements Elem.

Definition at line 91 of file pipe.cc.

92 {
93  return out << "Pipe not implemented yet!" << std::endl;
94 }
void Pipe::SetValue ( DataManager pDM,
VectorHandler X,
VectorHandler XP,
SimulationEntity::Hints ph = 0 
)
virtual

Reimplemented from SimulationEntity.

Definition at line 456 of file pipe.cc.

References DofOwnerOwner::iGetFirstIndex(), VectorHandler::PutCoef(), and q0.

459 {
460  integer i = iGetFirstIndex();
461  X.PutCoef(i+1, q0); /* portata iniziale nodo 2 */
462 }
doublereal q0
Definition: pipe.h:54
virtual void PutCoef(integer iRow, const doublereal &dCoef)=0
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
long int integer
Definition: colamd.c:51

Here is the call graph for this function:

void Pipe::WorkSpaceDim ( integer piNumRows,
integer piNumCols 
) const
virtual

Implements Elem.

Definition at line 106 of file pipe.cc.

106  {
107  *piNumRows = 3;
108  *piNumCols = 3;
109 }

Member Data Documentation

doublereal Pipe::area
private

Definition at line 51 of file pipe.h.

Referenced by AssJac(), AssRes(), and Pipe().

doublereal Pipe::diameter
private

Definition at line 49 of file pipe.h.

Referenced by AssJac(), AssRes(), and Pipe().

doublereal Pipe::flow
private

Definition at line 57 of file pipe.h.

Referenced by AssRes(), and Output().

doublereal Pipe::klam
private

Definition at line 60 of file pipe.h.

Referenced by AssJac(), AssRes(), and Pipe().

doublereal Pipe::ktra
private

Definition at line 61 of file pipe.h.

Referenced by AssJac(), AssRes(), and Pipe().

doublereal Pipe::ktrb
private

Definition at line 59 of file pipe.h.

Referenced by AssJac(), AssRes(), and Pipe().

doublereal Pipe::length
private

Definition at line 52 of file pipe.h.

Referenced by AssJac(), AssRes(), and Pipe().

const PressureNode* Pipe::pNode1
private

Definition at line 47 of file pipe.h.

Referenced by AssJac(), AssRes(), GetConnectedNodes(), and Pipe().

const PressureNode* Pipe::pNode2
private

Definition at line 48 of file pipe.h.

Referenced by AssJac(), AssRes(), GetConnectedNodes(), and Pipe().

doublereal Pipe::q0
private

Definition at line 54 of file pipe.h.

Referenced by SetValue().

doublereal Pipe::Re
private

Definition at line 58 of file pipe.h.

Referenced by AfterConvergence(), AssJac(), AssRes(), and Output().

flag Pipe::turbulent
private

Definition at line 53 of file pipe.h.

Referenced by AfterConvergence(), AssJac(), and AssRes().

doublereal Pipe::vel
private

Definition at line 56 of file pipe.h.

Referenced by AssRes(), and Output().

doublereal Pipe::viscosity
private

Definition at line 50 of file pipe.h.

Referenced by AssJac(), AssRes(), and Pipe().


The documentation for this class was generated from the following files: