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

#include <valve.h>

Inheritance diagram for Flow_valve:
Collaboration diagram for Flow_valve:

Public Member Functions

 Flow_valve (unsigned int uL, const DofOwner *pD, HydraulicFluid *hf, const PressureNode *p1, const PressureNode *p2, const PressureNode *p3, doublereal A_dia, doublereal mv, doublereal A_pipe, doublereal A_max, doublereal K, doublereal F0, doublereal w, doublereal s_mx, doublereal cs, doublereal cv, doublereal ca, flag fOut)
 
 ~Flow_valve (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 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)
 
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
 
const PressureNodepNode3
 
doublereal area_diaf
 
doublereal mass
 
doublereal area_pipe
 
doublereal area_max
 
doublereal Kappa
 
doublereal force0
 
doublereal width
 
doublereal s_max
 
doublereal c_spost
 
doublereal c_vel
 
doublereal c_acc
 
doublereal c1
 
doublereal c2
 
doublereal c3
 
doublereal c4
 
doublereal cf1
 
doublereal cf2
 
doublereal cf3
 
doublereal cf4
 
doublereal h
 
doublereal s
 
doublereal sp
 
doublereal v
 
doublereal vp
 
doublereal flow1
 
doublereal flow2
 
doublereal flow3
 

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 516 of file valve.h.

Constructor & Destructor Documentation

Flow_valve::Flow_valve ( unsigned int  uL,
const DofOwner pD,
HydraulicFluid hf,
const PressureNode p1,
const PressureNode p2,
const PressureNode p3,
doublereal  A_dia,
doublereal  mv,
doublereal  A_pipe,
doublereal  A_max,
doublereal  K,
doublereal  F0,
doublereal  w,
doublereal  s_mx,
doublereal  cs,
doublereal  cv,
doublereal  ca,
flag  fOut 
)

Definition at line 1840 of file valve.cc.

References ASSERT, PressureNode::GetNodeType(), h, Node::HYDRAULIC, pNode1, pNode2, pNode3, and s_max.

1850 : Elem(uL, fOut),
1851 HydraulicElem(uL, pDO, hf, fOut),
1852 pNode1(p1), pNode2(p2), pNode3(p3),
1853 area_diaf(A_dia), mass(mv), area_pipe(A_pipe), area_max(A_max),
1854 Kappa(K), force0(F0), width(w), s_max(s_mx), c_spost(cs), c_vel(cv), c_acc(ca)
1855 {
1856  ASSERT(pNode1 != NULL);
1858  ASSERT(pNode2 != NULL);
1860  ASSERT(pNode3 != NULL);
1862  ASSERT(A_dia > std::numeric_limits<doublereal>::epsilon());
1863  ASSERT(mv > std::numeric_limits<doublereal>::epsilon());
1864  ASSERT(A_pipe > std::numeric_limits<doublereal>::epsilon());
1865  ASSERT(A_max > std::numeric_limits<doublereal>::epsilon());
1866  ASSERT(K > std::numeric_limits<doublereal>::epsilon() );
1867  ASSERT(F0 >= 0.);
1868  ASSERT(w > std::numeric_limits<doublereal>::epsilon());
1869  ASSERT(s_max >= 0.);
1870 
1871  h = .02; /* coefficiente di perdita di carico concentrata tra i nodi 1 e 2 (smorza il moto della valvola) */
1872 }
const PressureNode * pNode1
Definition: valve.h:518
doublereal mass
Definition: valve.h:522
const PressureNode * pNode2
Definition: valve.h:519
doublereal c_acc
Definition: valve.h:531
doublereal h
Definition: valve.h:541
doublereal force0
Definition: valve.h:526
HydraulicElem(unsigned int uL, const DofOwner *pDO, HydraulicFluid *hf, flag fOut)
Definition: preselem.cc:54
doublereal width
Definition: valve.h:527
const PressureNode * pNode3
Definition: valve.h:520
#define ASSERT(expression)
Definition: colamd.c:977
virtual Node::Type GetNodeType(void) const
Definition: presnode.h:54
doublereal area_pipe
Definition: valve.h:523
doublereal c_spost
Definition: valve.h:529
doublereal s_max
Definition: valve.h:528
doublereal area_max
Definition: valve.h:524
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
doublereal Kappa
Definition: valve.h:525
doublereal c_vel
Definition: valve.h:530
doublereal area_diaf
Definition: valve.h:521

Here is the call graph for this function:

Flow_valve::~Flow_valve ( void  )

Definition at line 1875 of file valve.cc.

References NO_OP.

1876 {
1877  NO_OP;
1878 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

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

Implements Elem.

Definition at line 1916 of file valve.cc.

References area_diaf, area_max, area_pipe, c1, c2, c3, cf1, cf2, cf3, copysign(), DEBUGCOUT, HydraulicFluid::dGetDensity(), ScalarAlgebraicNode::dGetX(), grad::fabs(), h, HydraulicElem::HF, Node::iGetFirstColIndex(), DofOwnerOwner::iGetFirstIndex(), Node::iGetFirstRowIndex(), Kappa, mass, pNode1, pNode2, pNode3, grad::pow(), FullSubMatrixHandler::PutCoef(), FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), FullSubMatrixHandler::Resize(), s, VariableSubMatrixHandler::SetFull(), grad::sqrt(), v, and width.

1920 {
1921  DEBUGCOUT("Entering Flow_valve::AssJac()" << std::endl);
1922 
1923  FullSubMatrixHandler& WM = WorkMat.SetFull();
1924  WM.Resize(5, 5);
1925 
1926  integer iNode1RowIndex = pNode1->iGetFirstRowIndex()+1;
1927  integer iNode2RowIndex = pNode2->iGetFirstRowIndex()+1;
1928  integer iNode3RowIndex = pNode3->iGetFirstRowIndex()+1;
1929  integer iNode1ColIndex = pNode1->iGetFirstColIndex()+1;
1930  integer iNode2ColIndex = pNode2->iGetFirstColIndex()+1;
1931  integer iNode3ColIndex = pNode3->iGetFirstColIndex()+1;
1932  integer iFirstIndex = iGetFirstIndex();
1933 
1934  WM.PutRowIndex(1, iNode1RowIndex);
1935  WM.PutRowIndex(2, iNode2RowIndex);
1936  WM.PutRowIndex(3, iNode3RowIndex);
1937  WM.PutColIndex(1, iNode1ColIndex);
1938  WM.PutColIndex(2, iNode2ColIndex);
1939  WM.PutColIndex(3, iNode3ColIndex);
1940 
1941  WM.PutRowIndex(4, iFirstIndex+1);
1942  WM.PutColIndex(4, iFirstIndex+1);
1943  WM.PutRowIndex(5, iFirstIndex+2);
1944  WM.PutColIndex(5, iFirstIndex+2);
1945 
1946  doublereal p1 = pNode1->dGetX();
1947  doublereal p2 = pNode2->dGetX();
1948  doublereal p3 = pNode3->dGetX();
1949  s = XCurr(iFirstIndex+1); /* spostamento */
1950  v = XCurr(iFirstIndex+2); /* velocita' */
1951 
1952  doublereal Cd = .6; /* verificare */
1953  doublereal jumpPres12 = fabs(p1-p2);
1954  doublereal jumpPres23 = fabs(p2-p3);
1955  doublereal jumpPres13 = fabs(p1-p3);
1956  doublereal density = HF->dGetDensity();
1957 
1958  /* evito di dividere per un numero troppo piccolo */
1959  if (jumpPres12 < 1.e8*std::numeric_limits<doublereal>::epsilon()) {
1960  jumpPres12 = 1.e8*std::numeric_limits<doublereal>::epsilon();
1961  }
1962  if (jumpPres23 < 1.e8*std::numeric_limits<doublereal>::epsilon()) {
1963  jumpPres23 = 1.e8*std::numeric_limits<doublereal>::epsilon();
1964  }
1965  if (jumpPres13 < 1.e8*std::numeric_limits<doublereal>::epsilon()) {
1966  jumpPres13 = 1.e8*std::numeric_limits<doublereal>::epsilon();
1967  }
1968 
1969  doublereal Jac11 = 0.;
1970  doublereal Jac12 = 0.;
1971  doublereal Jac13 = 0.;
1972  doublereal Jac14 = 0.;
1973  doublereal Jac15 = 0.;
1974  doublereal Jac21 = 0.;
1975  doublereal Jac22 = 0.;
1976  doublereal Jac23 = 0.;
1977  doublereal Jac24 = 0.;
1978  doublereal Jac25 = 0.;
1979  doublereal Jac31 = 0.;
1980  doublereal Jac32 = 0.;
1981  doublereal Jac33 = 0.;
1982  doublereal Jac34 = 0.;
1983  doublereal Jac35 = 0.;
1984  doublereal Jac41 = 0.;
1985  doublereal Jac42 = 0.;
1986  doublereal Jac43 = 0.;
1987  doublereal Jac44 = 0.;
1988  doublereal Jac45 = 0.;
1989  doublereal Jac51 = 0.;
1990  doublereal Jac52 = 0.;
1991  doublereal Jac53 = 0.;
1992  doublereal Jac54 = 0.;
1993  doublereal Jac55 = 0.;
1994 
1995 #ifdef HYDR_DEVEL
1996  DEBUGCOUT("Valore di p1: " << p1 << std::endl);
1997  DEBUGCOUT("Valore di p2: " << p2 << std::endl);
1998  DEBUGCOUT("Valore di p3: " << p3 << std::endl);
1999  DEBUGCOUT("Valore di s: " << s << std::endl);
2000 #endif
2001 
2002  doublereal s12 = sqrt(2.*jumpPres12/density);
2003  doublereal s13 = sqrt(2.*jumpPres13/density);
2004 
2005  Jac11 = -width*s*Cd/s12-area_diaf*Cd/s13;
2006  Jac12 = width*s*Cd/s12;
2007  Jac13 = area_diaf*Cd/s13;
2008  Jac14 = -density*width*Cd*copysign(s12, p1-p2)*dCoef;
2009  Jac15 = 0.;
2010 
2011  Jac21 = width*s*Cd/s12;
2012  Jac22 = -width*s*Cd/s12;
2013  Jac23 = 0.;
2014  Jac24 = density*width*Cd*copysign(s12, p1-p2)*dCoef;
2015  Jac25 = 0.;
2016 
2017  Jac31 = area_diaf*Cd/s13;
2018  Jac32 = 0.;
2019  Jac33 = -area_diaf*Cd/s13;
2020  Jac34 = 0.;
2021  Jac35 = 0.;
2022 
2023  Jac41 = area_max;
2024  Jac42 = 0.;
2025  Jac43 =-area_max;
2026  Jac44 = -Kappa*dCoef-c1*dCoef-cf1*dCoef;
2027 
2028 
2029  doublereal Jac45old1;
2030  doublereal Jac45old2;
2031  Jac45old1 = -mass-c2*dCoef-c3-cf2*dCoef-cf3
2032  -density*area_max*pow(area_max/(area_diaf*Cd), 2.)*fabs(v)*dCoef;
2033  Jac45 = -mass-c2*dCoef-c3-cf2*dCoef-cf3
2034  -h*density*pow(area_max/area_pipe, 2.)*fabs(v)*dCoef;
2035  Jac45old2 = -mass-c2*dCoef-c3-cf2*dCoef-cf3-44.4*fabs(v)*dCoef;
2036 
2037  Jac51 = 0.;
2038  Jac52 = 0.;
2039  Jac53 = 0.;
2040  Jac54 = -1.;
2041  Jac55 = dCoef;
2042 
2043 #ifdef HYDR_DEVEL
2044  DEBUGCOUT("Jac smorzatore "
2045  << density*area_max*pow(area_max/(area_diaf*Cd), 2) << std::endl);
2046  DEBUGCOUT("Jac smorzatore " << h*density << std::endl);
2047  DEBUGCOUT("Jac smorzatore Jac45old1 " << Jac45old1 << std::endl);
2048  DEBUGCOUT("Jac smorzatore Jac45old2 " << Jac45old2 << std::endl);
2049  DEBUGCOUT("Jac smorzatore Jac45 " << Jac45 << std::endl);
2050 
2051  DEBUGCOUT("Jac11: " << Jac11 << std::endl);
2052  DEBUGCOUT("Jac12: " << Jac12 << std::endl);
2053  DEBUGCOUT("Jac13: " << Jac13 << std::endl);
2054  DEBUGCOUT("Jac14: " << Jac14 << std::endl);
2055  DEBUGCOUT("Jac15: " << Jac15 << std::endl);
2056  DEBUGCOUT("Jac21: " << Jac21 << std::endl);
2057  DEBUGCOUT("Jac22: " << Jac22 << std::endl);
2058  DEBUGCOUT("Jac23: " << Jac23 << std::endl);
2059  DEBUGCOUT("Jac24: " << Jac24 << std::endl);
2060  DEBUGCOUT("Jac25: " << Jac25 << std::endl);
2061  DEBUGCOUT("Jac31: " << Jac31 << std::endl);
2062  DEBUGCOUT("Jac32: " << Jac32 << std::endl);
2063  DEBUGCOUT("Jac33: " << Jac33 << std::endl);
2064  DEBUGCOUT("Jac34: " << Jac34 << std::endl);
2065  DEBUGCOUT("Jac35: " << Jac35 << std::endl);
2066  DEBUGCOUT("Jac41: " << Jac41 << std::endl);
2067  DEBUGCOUT("Jac42: " << Jac42 << std::endl);
2068  DEBUGCOUT("Jac43: " << Jac43 << std::endl);
2069  DEBUGCOUT("Jac44: " << Jac44 << std::endl);
2070  DEBUGCOUT("Jac45: " << Jac45 << std::endl);
2071  DEBUGCOUT("Jac51: " << Jac51 << std::endl);
2072  DEBUGCOUT("Jac52: " << Jac52 << std::endl);
2073  DEBUGCOUT("Jac53: " << Jac53 << std::endl);
2074  DEBUGCOUT("Jac54: " << Jac54 << std::endl);
2075  DEBUGCOUT("Jac55: " << Jac55 << std::endl);
2076 #endif
2077 
2078  WM.PutCoef(1, 1, Jac11);
2079  WM.PutCoef(1, 2, Jac12);
2080  WM.PutCoef(1, 3, Jac13);
2081  WM.PutCoef(1, 4, Jac14);
2082  WM.PutCoef(1, 5, Jac15);
2083  WM.PutCoef(2, 1, Jac21);
2084  WM.PutCoef(2, 2, Jac22);
2085  WM.PutCoef(2, 3, Jac23);
2086  WM.PutCoef(2, 4, Jac24);
2087  WM.PutCoef(2, 5, Jac25);
2088  WM.PutCoef(3, 1, Jac31);
2089  WM.PutCoef(3, 2, Jac32);
2090  WM.PutCoef(3, 3, Jac33);
2091  WM.PutCoef(3, 4, Jac34);
2092  WM.PutCoef(3, 5, Jac35);
2093  WM.PutCoef(4, 1, Jac41);
2094  WM.PutCoef(4, 2, Jac42);
2095  WM.PutCoef(4, 3, Jac43);
2096  WM.PutCoef(4, 4, Jac44);
2097  WM.PutCoef(4, 5, Jac45);
2098  WM.PutCoef(5, 1, Jac51);
2099  WM.PutCoef(5, 2, Jac52);
2100  WM.PutCoef(5, 3, Jac53);
2101  WM.PutCoef(5, 4, Jac54);
2102  WM.PutCoef(5, 5, Jac55);
2103 
2104  return WorkMat;
2105 }
doublereal s
Definition: valve.h:542
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
doublereal c1
Definition: valve.h:532
doublereal cf2
Definition: valve.h:537
const PressureNode * pNode1
Definition: valve.h:518
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
doublereal mass
Definition: valve.h:522
const PressureNode * pNode2
Definition: valve.h:519
doublereal c2
Definition: valve.h:533
doublereal v
Definition: valve.h:544
void Resize(integer iNewRow, integer iNewCol)
Definition: submat.cc:138
void PutCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:672
GradientExpression< UnaryExpr< FuncFabs, Expr > > fabs(const GradientExpression< Expr > &u)
Definition: gradient.h:2973
doublereal cf3
Definition: valve.h:538
doublereal h
Definition: valve.h:541
doublereal cf1
Definition: valve.h:536
virtual doublereal dGetDensity(void) const =0
virtual const doublereal & dGetX(void) const
Definition: node.h:492
doublereal width
Definition: valve.h:527
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
const PressureNode * pNode3
Definition: valve.h:520
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
Definition: gradient.h:2974
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
doublereal area_pipe
Definition: valve.h:523
doublereal area_max
Definition: valve.h:524
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
doublereal Kappa
Definition: valve.h:525
doublereal area_diaf
Definition: valve.h:521
doublereal c3
Definition: valve.h:534
virtual integer iGetFirstColIndex(void) const
Definition: node.cc:88

Here is the call graph for this function:

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

Implements Elem.

Definition at line 2108 of file valve.cc.

References area_diaf, area_max, area_pipe, c1, c2, c3, c4, c_acc, c_spost, c_vel, cf1, cf2, cf3, cf4, copysign(), DEBUGCOUT, HydraulicFluid::dGetDensity(), ScalarAlgebraicNode::dGetX(), grad::fabs(), flow1, flow2, flow3, force0, h, HydraulicElem::HF, DofOwnerOwner::iGetFirstIndex(), Node::iGetFirstRowIndex(), Kappa, mass, pNode1, pNode2, pNode3, grad::pow(), SubVectorHandler::PutItem(), VectorHandler::Resize(), s, s_max, sp, grad::sqrt(), v, vp, and width.

2112 {
2113  DEBUGCOUT("Entering Flow_valve::AssRes()" << std::endl);
2114 
2115  WorkVec.Resize(5);
2116 
2117  integer iNode1RowIndex = pNode1->iGetFirstRowIndex()+1;
2118  integer iNode2RowIndex = pNode2->iGetFirstRowIndex()+1;
2119  integer iNode3RowIndex = pNode3->iGetFirstRowIndex()+1;
2120 
2121  doublereal p1 = pNode1->dGetX();
2122  doublereal p2 = pNode2->dGetX();
2123  doublereal p3 = pNode3->dGetX();
2124  integer iFirstIndex = iGetFirstIndex();
2125 
2126  s = XCurr(iFirstIndex+1); /* spostamento */
2127  v = XCurr(iFirstIndex+2); /* velocita' */
2128  sp = XPrimeCurr(iFirstIndex+1); /* velocita' */
2129  vp = XPrimeCurr(iFirstIndex+2); /* accelerazione */
2130 
2131  doublereal Cd = .6;
2132  doublereal jumpPres12 = fabs(p1-p2);
2133  doublereal jumpPres23 = fabs(p2-p3);
2134  doublereal jumpPres13 = fabs(p1-p3);
2135 
2136  doublereal Res_1 = 0.;
2137  doublereal Res_2 = 0.;
2138  doublereal Res_3 = 0.;
2139  doublereal Res_4 = 0.;
2140  doublereal Res_5 = 0.;
2141  doublereal density = HF->dGetDensity();
2142 
2143  doublereal x0 = ((p1-p3)*area_max-force0)/Kappa;
2144 
2145  if (s <= 0.) {
2146  c1 = c_spost;
2147 
2148  if (sp < 0.) {
2149  c2 = c_vel; /* ho v negativa devo smorzare */
2150  } else {
2151  c2 = 0.;
2152  }
2153 
2154  if (vp < 0.) {
2155  c3 = c_acc; /* ho acc negativa devo smorzare */
2156  } else {
2157  c3 = 0.;
2158  }
2159 
2160  c4 = 0.; /* (force0-p1*area_max); */
2161  } else {
2162  c1 = 0.;
2163  c2 = 0.;
2164  c3 = 0.;
2165  c4 = 0.;
2166  }
2167 
2168  if (s >= s_max) {
2169  cf1 = c_spost;
2170 
2171  if (sp > 0.) {
2172  cf2 = c_vel; /* ho v positiva devo smorzare */
2173  } else {
2174  cf2 = 0.;
2175  }
2176 
2177  if (vp > 0.) {
2178  cf3 = c_acc; /* ho acc positiva devo smorzare */
2179  } else {
2180  cf3 = 0.;
2181  }
2182 
2183  cf4 = 0.; /* (force0-p1*area_max); */
2184  } else {
2185  cf1 = 0.;
2186  cf2 = 0.;
2187  cf3 = 0.;
2188  cf4 = 0.;
2189  }
2190 
2191  doublereal s12 = sqrt(2.*jumpPres12/density);
2192  doublereal s13 = sqrt(2.*jumpPres13/density);
2193 
2194  Res_1 = density*width*s*Cd*copysign(s12, p1-p2)+
2195  density*area_diaf*Cd*copysign(s13, p1-p3);
2196  Res_2 = -density*width*s*Cd*copysign(s12, p1-p2);
2197  Res_3 = -density*area_diaf*Cd*copysign(s13, p1-p3);
2198 
2199  doublereal Res_4old;
2200  Res_4old = mass*vp-area_max*p1+force0+Kappa*s+area_max*p3+c1*s+c2*sp+c3*vp
2201  +c4+cf1*(s-s_max)+cf2*sp+cf3*vp+cf4
2202  +copysign(.5*density*area_max*pow(sp*area_max/(area_diaf*Cd), 2), sp);
2203 
2204  Res_4 = mass*vp-area_max*p1+force0+Kappa*s+area_max*p3+c1*s+c2*sp+c3*vp
2205  +c4+cf1*(s-s_max)+cf2*sp+cf3*vp+cf4
2206  +copysign(.5*h*density*pow(sp*area_max/area_pipe, 2), sp);
2207 
2208  Res_5 =sp-v;
2209 
2210  flow1=-Res_1; /* per l'output */
2211  flow2=-Res_2; /* per l'output */
2212  flow3=-Res_3; /* per l'output */
2213 
2214 #ifdef HYDR_DEVEL
2215  DEBUGCOUT("Res_4: " << Res_4 << std::endl);
2216  DEBUGCOUT("Res_4old: " << Res_4old << std::endl);
2217  DEBUGCOUT("smorazatore: "
2218  << copysign(.5*density*area_max*pow(sp*area_max/(area_diaf*Cd), 2), sp) << std::endl);
2219  DEBUGCOUT("smorzatoreold: "
2220  << copysign(.5*h*density*pow(sp*area_max/area_pipe, 2), sp) << std::endl);
2221 
2222  DEBUGCOUT("width: " << width << std::endl);
2223  DEBUGCOUT("Cd: " << Cd << std::endl);
2224  DEBUGCOUT("jumpPres12: " << jumpPres12 << std::endl);
2225  DEBUGCOUT("jumpPres23: " << jumpPres23 << std::endl);
2226  DEBUGCOUT("jumpPres13: " << jumpPres13 << std::endl);
2227  DEBUGCOUT("density: " << density << std::endl);
2228  DEBUGCOUT("p1: " << p1 << std::endl);
2229  DEBUGCOUT("p2: " << p2 << std::endl);
2230  DEBUGCOUT("p3: " << p3 << std::endl);
2231  DEBUGCOUT("s: " << s << std::endl);
2232  DEBUGCOUT("sp: " << sp << std::endl);
2233  DEBUGCOUT("v: " << v << std::endl);
2234  DEBUGCOUT("vp: " << vp << std::endl);
2235  DEBUGCOUT("area_max: " << area_max << std::endl);
2236  DEBUGCOUT("Kappa: " << Kappa << std::endl);
2237  DEBUGCOUT("force0: " << force0 << std::endl);
2238  DEBUGCOUT("mass: " << mass << std::endl);
2239  DEBUGCOUT("s_max: " << s_max << std::endl);
2240  DEBUGCOUT("x0: " << x0 << std::endl);
2241  DEBUGCOUT("c1: " << c1 << std::endl);
2242  DEBUGCOUT("c2: " << c2 << std::endl);
2243  DEBUGCOUT("c3: " << c3 << std::endl);
2244  DEBUGCOUT("c4: " << c4 << std::endl);
2245  DEBUGCOUT("cf1: " << cf1 << std::endl);
2246  DEBUGCOUT("cf2: " << cf2 << std::endl);
2247  DEBUGCOUT("cf3: " << cf3 << std::endl);
2248  DEBUGCOUT("cf4: " << cf4 << std::endl);
2249  DEBUGCOUT("PORTATE AI VARI NODI (positive se entranti)" << std::endl);
2250  DEBUGCOUT("-Res_1 (portata nodo1): " << -Res_1 << std::endl);
2251  DEBUGCOUT("-Res_2 (portata nodo2): " << -Res_2 << std::endl);
2252  DEBUGCOUT("-Res_3:(portata nodo3): " << -Res_3 << std::endl);
2253  DEBUGCOUT("-Res_4: " << -Res_4 << std::endl);
2254  DEBUGCOUT("-Res_5: " << -Res_5 << std::endl);
2255 #endif
2256 
2257  WorkVec.PutItem(1, iNode1RowIndex, Res_1);
2258  WorkVec.PutItem(2, iNode2RowIndex, Res_2);
2259  WorkVec.PutItem(3, iNode3RowIndex, Res_3);
2260  WorkVec.PutItem(4, iFirstIndex+1, Res_4);
2261  WorkVec.PutItem(5, iFirstIndex+2, Res_5);
2262 
2263  return WorkVec;
2264 }
doublereal s
Definition: valve.h:542
GradientExpression< BinaryExpr< FuncPow, LhsExpr, RhsExpr > > pow(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
Definition: gradient.h:2961
doublereal c1
Definition: valve.h:532
doublereal cf2
Definition: valve.h:537
const PressureNode * pNode1
Definition: valve.h:518
doublereal mass
Definition: valve.h:522
const PressureNode * pNode2
Definition: valve.h:519
doublereal c2
Definition: valve.h:533
doublereal flow2
Definition: valve.h:547
doublereal v
Definition: valve.h:544
doublereal sp
Definition: valve.h:543
doublereal flow1
Definition: valve.h:546
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 c_acc
Definition: valve.h:531
doublereal cf3
Definition: valve.h:538
doublereal h
Definition: valve.h:541
doublereal cf1
Definition: valve.h:536
virtual doublereal dGetDensity(void) const =0
doublereal force0
Definition: valve.h:526
virtual const doublereal & dGetX(void) const
Definition: node.h:492
doublereal c4
Definition: valve.h:535
doublereal flow3
Definition: valve.h:548
doublereal width
Definition: valve.h:527
HydraulicFluid * HF
Definition: preselem.h:79
doublereal cf4
Definition: valve.h:539
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 vp
Definition: valve.h:545
const PressureNode * pNode3
Definition: valve.h:520
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
Definition: gradient.h:2974
doublereal area_pipe
Definition: valve.h:523
doublereal c_spost
Definition: valve.h:529
doublereal s_max
Definition: valve.h:528
doublereal area_max
Definition: valve.h:524
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
doublereal Kappa
Definition: valve.h:525
doublereal c_vel
Definition: valve.h:530
virtual void Resize(integer iNewSize)=0
doublereal area_diaf
Definition: valve.h:521
doublereal c3
Definition: valve.h:534

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 590 of file valve.h.

References pNode1, pNode2, and pNode3.

590  {
591  connectedNodes.resize(3);
592  connectedNodes[0] = pNode1;
593  connectedNodes[1] = pNode2;
594  connectedNodes[2] = pNode3;
595  };
const PressureNode * pNode1
Definition: valve.h:518
const PressureNode * pNode2
Definition: valve.h:519
const PressureNode * pNode3
Definition: valve.h:520
DofOrder::Order Flow_valve::GetDofType ( unsigned int  i) const
virtual

Reimplemented from Elem.

Definition at line 1901 of file valve.cc.

References ASSERT, and DofOrder::DIFFERENTIAL.

1902 {
1903  ASSERT(i >= 0 && i <= 1);
1904  return DofOrder::DIFFERENTIAL;
1905 }
#define ASSERT(expression)
Definition: colamd.c:977
HydraulicElem::Type Flow_valve::GetHydraulicType ( void  ) const
virtual

Implements HydraulicElem.

Definition at line 1882 of file valve.cc.

References HydraulicElem::FLOW_VALVE.

1883 {
1885 }
unsigned int Flow_valve::iGetNumDof ( void  ) const
virtual

Reimplemented from Elem.

Definition at line 1895 of file valve.cc.

1896 {
1897  return 2;
1898 }
void Flow_valve::Output ( OutputHandler OH) const
virtual

Reimplemented from ToBeOutput.

Definition at line 2266 of file valve.cc.

References ToBeOutput::bToBeOutput(), flow1, flow2, flow3, WithLabel::GetLabel(), OutputHandler::Hydraulic(), s, v, and vp.

2267 {
2268  if (bToBeOutput()) {
2269  std::ostream& out = OH.Hydraulic();
2270  out << std::setw(8) << GetLabel()
2271  << " " << s << " " << v << " "<< vp
2272  << " " << flow1 << " "<< flow2 << " "<< flow3 << std::endl;
2273  }
2274 }
doublereal s
Definition: valve.h:542
virtual bool bToBeOutput(void) const
Definition: output.cc:890
doublereal flow2
Definition: valve.h:547
doublereal v
Definition: valve.h:544
doublereal flow1
Definition: valve.h:546
doublereal flow3
Definition: valve.h:548
doublereal vp
Definition: valve.h:545
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 & Flow_valve::Restart ( std::ostream &  out) const
virtual

Implements Elem.

Definition at line 1889 of file valve.cc.

1890 {
1891  return out << " Flow_valve not implemented yet!" << std::endl;
1892 }
void Flow_valve::SetValue ( DataManager pDM,
VectorHandler X,
VectorHandler XP,
SimulationEntity::Hints ph = 0 
)
virtual

Reimplemented from SimulationEntity.

Definition at line 2276 of file valve.cc.

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

2279 {
2280  integer i = iGetFirstIndex();
2281  X.PutCoef(i+1, 0.);
2282  X.PutCoef(i+2, 0.);
2283  XP.PutCoef(i+1, 0.);
2284  XP.PutCoef(i+2, 0.);
2285 }
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 Flow_valve::WorkSpaceDim ( integer piNumRows,
integer piNumCols 
) const
virtual

Implements Elem.

Definition at line 1909 of file valve.cc.

1910 {
1911  *piNumRows = 5;
1912  *piNumCols = 5;
1913 }

Member Data Documentation

doublereal Flow_valve::area_diaf
private

Definition at line 521 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Flow_valve::area_max
private

Definition at line 524 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Flow_valve::area_pipe
private

Definition at line 523 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Flow_valve::c1
private

Definition at line 532 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Flow_valve::c2
private

Definition at line 533 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Flow_valve::c3
private

Definition at line 534 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Flow_valve::c4
private

Definition at line 535 of file valve.h.

Referenced by AssRes().

doublereal Flow_valve::c_acc
private

Definition at line 531 of file valve.h.

Referenced by AssRes().

doublereal Flow_valve::c_spost
private

Definition at line 529 of file valve.h.

Referenced by AssRes().

doublereal Flow_valve::c_vel
private

Definition at line 530 of file valve.h.

Referenced by AssRes().

doublereal Flow_valve::cf1
private

Definition at line 536 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Flow_valve::cf2
private

Definition at line 537 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Flow_valve::cf3
private

Definition at line 538 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Flow_valve::cf4
private

Definition at line 539 of file valve.h.

Referenced by AssRes().

doublereal Flow_valve::flow1
private

Definition at line 546 of file valve.h.

Referenced by AssRes(), and Output().

doublereal Flow_valve::flow2
private

Definition at line 547 of file valve.h.

Referenced by AssRes(), and Output().

doublereal Flow_valve::flow3
private

Definition at line 548 of file valve.h.

Referenced by AssRes(), and Output().

doublereal Flow_valve::force0
private

Definition at line 526 of file valve.h.

Referenced by AssRes().

doublereal Flow_valve::h
private

Definition at line 541 of file valve.h.

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

doublereal Flow_valve::Kappa
private

Definition at line 525 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Flow_valve::mass
private

Definition at line 522 of file valve.h.

Referenced by AssJac(), and AssRes().

const PressureNode* Flow_valve::pNode1
private

Definition at line 518 of file valve.h.

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

const PressureNode* Flow_valve::pNode2
private

Definition at line 519 of file valve.h.

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

const PressureNode* Flow_valve::pNode3
private

Definition at line 520 of file valve.h.

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

doublereal Flow_valve::s
private

Definition at line 542 of file valve.h.

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

doublereal Flow_valve::s_max
private

Definition at line 528 of file valve.h.

Referenced by AssRes(), and Flow_valve().

doublereal Flow_valve::sp
private

Definition at line 543 of file valve.h.

Referenced by AssRes().

doublereal Flow_valve::v
private

Definition at line 544 of file valve.h.

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

doublereal Flow_valve::vp
private

Definition at line 545 of file valve.h.

Referenced by AssRes(), and Output().

doublereal Flow_valve::width
private

Definition at line 527 of file valve.h.

Referenced by AssJac(), and AssRes().


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