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

#include <valve.h>

Inheritance diagram for Pressure_flow_control_valve:
Collaboration diagram for Pressure_flow_control_valve:

Public Member Functions

 Pressure_flow_control_valve (unsigned int uL, const DofOwner *pD, HydraulicFluid *hf, const PressureNode *p1, const PressureNode *p2, const PressureNode *p3, const PressureNode *p4, const PressureNode *p5, const PressureNode *p6, const DriveCaller *pDC, doublereal s0, doublereal s_mx, doublereal W, doublereal Loss_A, doublereal Valve_d, doublereal Valve_rho, doublereal cs, doublereal cv, doublereal ca, flag fOut)
 
 ~Pressure_flow_control_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)
 
- Public Member Functions inherited from DriveOwner
 DriveOwner (const DriveCaller *pDC=0)
 
 DriveOwner (const DriveOwner &drive)
 
virtual ~DriveOwner (void)
 
void Set (const DriveCaller *pDC)
 
DriveCallerpGetDriveCaller (void) const
 
doublereal dGet (const doublereal &dVar) const
 
doublereal dGet (void) const
 
bool bIsDifferentiable (void) const
 
doublereal dGetP (const doublereal &dVar) const
 
doublereal dGetP (void) const
 

Private Attributes

const PressureNodepNode1
 
const PressureNodepNode2
 
const PressureNodepNode3
 
const PressureNodepNode4
 
const PressureNodepNode5
 
const PressureNodepNode6
 
doublereal start
 
doublereal c_spost
 
doublereal c_vel
 
doublereal c_acc
 
doublereal Force
 
doublereal Cd
 
doublereal width
 
doublereal loss_area
 
doublereal valve_diameter
 
doublereal valve_density
 
doublereal valve_area
 
doublereal s_max
 
doublereal A1
 
doublereal A2
 
doublereal A3
 
doublereal A4
 
doublereal Mass
 
doublereal flow1
 
doublereal flow2
 
doublereal flow3
 
doublereal flow4
 
doublereal flow5
 
doublereal flow6
 
doublereal s
 
doublereal v
 
doublereal sp
 
doublereal vp
 
doublereal c1
 
doublereal c2
 
doublereal c3
 
doublereal cf1
 
doublereal cf2
 
doublereal cf3
 
doublereal deltaP
 

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
 
- Protected Attributes inherited from DriveOwner
DriveCallerpDriveCaller
 

Detailed Description

Definition at line 324 of file valve.h.

Constructor & Destructor Documentation

Pressure_flow_control_valve::Pressure_flow_control_valve ( unsigned int  uL,
const DofOwner pD,
HydraulicFluid hf,
const PressureNode p1,
const PressureNode p2,
const PressureNode p3,
const PressureNode p4,
const PressureNode p5,
const PressureNode p6,
const DriveCaller pDC,
doublereal  s0,
doublereal  s_mx,
doublereal  W,
doublereal  Loss_A,
doublereal  Valve_d,
doublereal  Valve_rho,
doublereal  cs,
doublereal  cv,
doublereal  ca,
flag  fOut 
)

Definition at line 1072 of file valve.cc.

References ASSERT, Cd, PressureNode::GetNodeType(), Node::HYDRAULIC, M_PI, pNode1, pNode2, pNode3, pNode4, pNode5, pNode6, valve_area, valve_density, and valve_diameter.

1085 : Elem(uL, fOut),
1086 HydraulicElem(uL, pDO, hf, fOut), DriveOwner(pDC),
1087 pNode1(p1), pNode2(p2), pNode3(p3), pNode4(p4), pNode5(p5), pNode6(p6),
1088 start(s0), s_max(s_mx), width(W), loss_area(Loss_A),
1089 valve_diameter(Valve_d), valve_density(Valve_rho),
1090 c_spost(cs), c_vel(cv), c_acc(ca)
1091 {
1092  ASSERT(pNode1 != NULL);
1094  ASSERT(pNode2 != NULL);
1096  ASSERT(pNode3 != NULL);
1098  ASSERT(pNode4 != NULL);
1100  ASSERT(pNode5 != NULL);
1102  ASSERT(pNode6 != NULL);
1104  ASSERT(s0 >= 0.);
1105  ASSERT(Valve_rho > std::numeric_limits<doublereal>::epsilon());
1106  ASSERT(Valve_d > std::numeric_limits<doublereal>::epsilon());
1107  ASSERT(W > std::numeric_limits<doublereal>::epsilon());
1108  ASSERT(Loss_A >= 0.);
1109  ASSERT(s_mx >= 0.);
1110 
1111  Cd = .611; /* coefficiente di perdita */
1112  Mass = 1.175*valve_diameter*valve_diameter*valve_diameter*valve_density*M_PI; // massa della valvola
1114 }
#define M_PI
Definition: gradienttest.cc:67
const PressureNode * pNode1
Definition: valve.h:326
const PressureNode * pNode4
Definition: valve.h:329
const PressureNode * pNode3
Definition: valve.h:328
const PressureNode * pNode6
Definition: valve.h:331
doublereal valve_density
Definition: valve.h:342
doublereal valve_diameter
Definition: valve.h:341
HydraulicElem(unsigned int uL, const DofOwner *pDO, HydraulicFluid *hf, flag fOut)
Definition: preselem.cc:54
const PressureNode * pNode5
Definition: valve.h:330
#define ASSERT(expression)
Definition: colamd.c:977
Definition: body.h:45
virtual Node::Type GetNodeType(void) const
Definition: presnode.h:54
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
const PressureNode * pNode2
Definition: valve.h:327
DriveOwner(const DriveCaller *pDC=0)
Definition: drive.cc:627

Here is the call graph for this function:

Pressure_flow_control_valve::~Pressure_flow_control_valve ( void  )

Definition at line 1117 of file valve.cc.

References NO_OP.

1118 {
1119  NO_OP;
1120 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

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

Implements Elem.

Definition at line 1154 of file valve.cc.

References A1, A2, A3, A4, c1, c2, c3, Cd, cf1, cf2, cf3, copysign(), DEBUGCOUT, deltaP, HydraulicFluid::dGetDensity(), ScalarAlgebraicNode::dGetX(), grad::fabs(), HydraulicElem::HF, Node::iGetFirstColIndex(), DofOwnerOwner::iGetFirstIndex(), Node::iGetFirstRowIndex(), pNode1, pNode2, pNode3, pNode4, pNode5, pNode6, FullSubMatrixHandler::PutCoef(), FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), FullSubMatrixHandler::ResizeReset(), s, VariableSubMatrixHandler::SetFull(), sp, grad::sqrt(), v, valve_area, valve_diameter, and width.

1158 {
1159  DEBUGCOUT("Entering Control_valve::AssJac()" << std::endl);
1160 
1161  FullSubMatrixHandler& WM = WorkMat.SetFull();
1162  WM.ResizeReset(8, 8);
1163 
1164  integer iNode1RowIndex = pNode1->iGetFirstRowIndex()+1;
1165  integer iNode2RowIndex = pNode2->iGetFirstRowIndex()+1;
1166  integer iNode3RowIndex = pNode3->iGetFirstRowIndex()+1;
1167  integer iNode4RowIndex = pNode4->iGetFirstRowIndex()+1;
1168  integer iNode5RowIndex = pNode5->iGetFirstRowIndex()+1;
1169  integer iNode6RowIndex = pNode6->iGetFirstRowIndex()+1;
1170  integer iNode1ColIndex = pNode1->iGetFirstColIndex()+1;
1171  integer iNode2ColIndex = pNode2->iGetFirstColIndex()+1;
1172  integer iNode3ColIndex = pNode3->iGetFirstColIndex()+1;
1173  integer iNode4ColIndex = pNode4->iGetFirstColIndex()+1;
1174  integer iNode5ColIndex = pNode5->iGetFirstColIndex()+1;
1175  integer iNode6ColIndex = pNode6->iGetFirstColIndex()+1;
1176  integer iFirstIndex = iGetFirstIndex();
1177 
1178  WM.PutRowIndex(1, iNode1RowIndex);
1179  WM.PutRowIndex(2, iNode2RowIndex);
1180  WM.PutRowIndex(3, iNode3RowIndex);
1181  WM.PutRowIndex(4, iNode4RowIndex);
1182  WM.PutRowIndex(5, iNode5RowIndex);
1183  WM.PutRowIndex(6, iNode6RowIndex);
1184  WM.PutColIndex(1, iNode1ColIndex);
1185  WM.PutColIndex(2, iNode2ColIndex);
1186  WM.PutColIndex(3, iNode3ColIndex);
1187  WM.PutColIndex(4, iNode4ColIndex);
1188  WM.PutColIndex(5, iNode5ColIndex);
1189  WM.PutColIndex(6, iNode6ColIndex);
1190 
1191  WM.PutRowIndex(7, iFirstIndex+1);
1192  WM.PutColIndex(7, iFirstIndex+1);
1193  WM.PutRowIndex(8, iFirstIndex+2);
1194  WM.PutColIndex(8, iFirstIndex+2);
1195 
1196  doublereal p1 = pNode1->dGetX();
1197  doublereal p2 = pNode2->dGetX();
1198  doublereal p3 = pNode3->dGetX();
1199  doublereal p4 = pNode4->dGetX();
1200  doublereal p5 = pNode5->dGetX();
1201  doublereal p6 = pNode6->dGetX();
1202  doublereal density = HF->dGetDensity();
1203 
1204  s = XCurr(iFirstIndex+1); /* spostamento */
1205  v = XCurr(iFirstIndex+2); /* velocita' */
1206 
1207  doublereal jumpPres12 = fabs(p1-p2); /* salto di pressione nodo1 & nodo2 */
1208  doublereal jumpPres13 = fabs(p1-p3); /* salto di pressione nodo1 & nodo3 */
1209  doublereal jumpPres24 = fabs(p2-p4); /* salto di pressione nodo2 & nodo4 */
1210  doublereal jumpPres34 = fabs(p3-p4); /* salto di pressione nodo3 & nodo4 */
1211 
1212  if (jumpPres12 < 1.e8*std::numeric_limits<doublereal>::epsilon()) {
1213  jumpPres12 = 1.e8*std::numeric_limits<doublereal>::epsilon();
1214  }
1215  if (jumpPres13 < 1.e8*std::numeric_limits<doublereal>::epsilon()) {
1216  jumpPres13 = 1.e8*std::numeric_limits<doublereal>::epsilon();
1217  }
1218  if (jumpPres24 < 1.e8*std::numeric_limits<doublereal>::epsilon()) {
1219  jumpPres24 = 1.e8*std::numeric_limits<doublereal>::epsilon();
1220  }
1221  if (jumpPres34 < 1.e8*std::numeric_limits<doublereal>::epsilon()) {
1222  jumpPres34 = 1.e8*std::numeric_limits<doublereal>::epsilon();
1223  }
1224  doublereal Jac17;
1225  doublereal Jac27;
1226  doublereal Jac37;
1227  doublereal Jac47;
1228 
1229  doublereal primo = Cd*A1/sqrt(2.*jumpPres12/density);
1230  doublereal secondo = Cd*A2/sqrt(2.*jumpPres13/density);
1231  doublereal terzo = Cd*A4/sqrt(2.*jumpPres24/density);
1232  doublereal quarto = Cd*A3/sqrt(2.*jumpPres34/density);
1233 
1234  doublereal Jac11 = -primo-secondo;
1235  doublereal Jac12 = primo;
1236  doublereal Jac13 = secondo;
1237  doublereal Jac14 = 0.;
1238  doublereal Jac21 = primo;
1239  doublereal Jac22 = -primo-terzo;
1240  doublereal Jac23 = 0.;
1241  doublereal Jac24 = terzo;
1242  doublereal Jac31 = secondo;
1243  doublereal Jac32 = 0.;
1244  doublereal Jac33 = -secondo-quarto;
1245  doublereal Jac34 = quarto;
1246  doublereal Jac41 = 0.;
1247  doublereal Jac42 = terzo;
1248  doublereal Jac43 = quarto;
1249  doublereal Jac44 = -terzo-quarto;
1250 
1251  doublereal Jac57 = -valve_area;
1252  doublereal Jac67 = +valve_area;
1253 
1254  doublereal costante = density*Cd*width*valve_diameter;
1255 
1256  doublereal Jac71 = -.2*costante/sqrt(density*deltaP)*sp-.43*width*s;
1257  doublereal Jac72 = 0.;
1258  doublereal Jac73 = 0.;
1259  doublereal Jac74 = 0.;
1260  doublereal Jac77 = -.4*valve_diameter*Cd*width*sqrt(density*deltaP)-dCoef*.43*width*deltaP-dCoef*c1-c2-dCoef*cf1-cf2;
1261  doublereal Jac78 = -Mass-c3-cf3;
1262 
1263  if (s > 0.) { /* collegamento diretto 1->2 3->4 */
1264  Jac17 = dCoef*density*Cd*width*copysign(sqrt(2.*jumpPres12/density), p1-p2);
1265  Jac27 = -Jac17;
1266  Jac37 = dCoef*density*Cd*width*copysign(sqrt(2.*jumpPres34/density), p3-p4);
1267  Jac47 = -Jac37;
1268  } else { /* collegamento inverso 1->3 2->4 */
1269  Jac17 = -dCoef*density*Cd*width*copysign(sqrt(2.*jumpPres13/density), p1-p3);
1270  Jac27 = -dCoef*density*Cd*width*copysign(sqrt(2.*jumpPres24/density), p2-p4);
1271  Jac37 = -Jac17;
1272  Jac47 = -Jac27;
1273  }
1274 
1275  doublereal Jac87 = -1;
1276  doublereal Jac88 = dCoef;
1277 
1278  WM.PutCoef(1, 1, Jac11);
1279  WM.PutCoef(1, 2, Jac12);
1280  WM.PutCoef(1, 3, Jac13);
1281  WM.PutCoef(1, 4, Jac14);
1282  WM.PutCoef(1, 7, Jac17);
1283  WM.PutCoef(2, 1, Jac21);
1284  WM.PutCoef(2, 2, Jac22);
1285  WM.PutCoef(2, 3, Jac23);
1286  WM.PutCoef(2, 4, Jac24);
1287  WM.PutCoef(2, 7, Jac27);
1288  WM.PutCoef(3, 1, Jac31);
1289  WM.PutCoef(3, 2, Jac32);
1290  WM.PutCoef(3, 3, Jac33);
1291  WM.PutCoef(3, 4, Jac34);
1292  WM.PutCoef(3, 7, Jac37);
1293  WM.PutCoef(4, 1, Jac41);
1294  WM.PutCoef(4, 2, Jac42);
1295  WM.PutCoef(4, 3, Jac43);
1296  WM.PutCoef(4, 4, Jac44);
1297  WM.PutCoef(4, 7, Jac47);
1298  WM.PutCoef(5, 7, Jac67);
1299  WM.PutCoef(6, 7, Jac67);
1300  WM.PutCoef(7, 1, Jac71);
1301  WM.PutCoef(7, 2, Jac72);
1302  WM.PutCoef(7, 3, Jac73);
1303  WM.PutCoef(7, 7, Jac77);
1304  WM.PutCoef(7, 8, Jac78);
1305  WM.PutCoef(8, 7, Jac87);
1306  WM.PutCoef(8, 8, Jac88);
1307 
1308  return WorkMat;
1309 }
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
const PressureNode * pNode1
Definition: valve.h:326
const PressureNode * pNode4
Definition: valve.h:329
const PressureNode * pNode3
Definition: valve.h:328
void PutCoef(integer iRow, integer iCol, const doublereal &dCoef)
Definition: submat.h:672
const PressureNode * pNode6
Definition: valve.h:331
GradientExpression< UnaryExpr< FuncFabs, Expr > > fabs(const GradientExpression< Expr > &u)
Definition: gradient.h:2973
doublereal valve_diameter
Definition: valve.h:341
virtual doublereal dGetDensity(void) const =0
virtual const doublereal & dGetX(void) const
Definition: node.h:492
const PressureNode * pNode5
Definition: valve.h:330
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
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
Definition: gradient.h:2974
Definition: body.h:45
virtual void ResizeReset(integer, integer)
Definition: submat.cc:182
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
const PressureNode * pNode2
Definition: valve.h:327
virtual integer iGetFirstColIndex(void) const
Definition: node.cc:88

Here is the call graph for this function:

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

Implements Elem.

Definition at line 1312 of file valve.cc.

References A1, A2, A3, A4, c1, c2, c3, Cd, cf1, cf2, cf3, copysign(), DEBUGCOUT, deltaP, DriveCaller::dGet(), HydraulicFluid::dGetDensity(), ScalarAlgebraicNode::dGetX(), grad::fabs(), flow1, flow2, flow3, flow4, flow5, flow6, HydraulicElem::HF, DofOwnerOwner::iGetFirstIndex(), Node::iGetFirstRowIndex(), loss_area, DriveOwner::pGetDriveCaller(), pNode1, pNode2, pNode3, pNode4, pNode5, pNode6, SubVectorHandler::PutItem(), VectorHandler::Resize(), s, s_max, sp, grad::sqrt(), v, valve_area, valve_density, valve_diameter, vp, and width.

1316 {
1317  DEBUGCOUT("Entering Pressure_flow_control_valve::AssRes()" << std::endl);
1318 
1319  WorkVec.Resize(8);
1320 
1321  integer iNode1RowIndex = pNode1->iGetFirstRowIndex()+1;
1322  integer iNode2RowIndex = pNode2->iGetFirstRowIndex()+1;
1323  integer iNode3RowIndex = pNode3->iGetFirstRowIndex()+1;
1324  integer iNode4RowIndex = pNode4->iGetFirstRowIndex()+1;
1325  integer iNode5RowIndex = pNode5->iGetFirstRowIndex()+1;
1326  integer iNode6RowIndex = pNode6->iGetFirstRowIndex()+1;
1327  integer iFirstIndex = iGetFirstIndex();
1328 
1329  doublereal p1 = pNode1->dGetX();
1330  doublereal p2 = pNode2->dGetX();
1331  doublereal p3 = pNode3->dGetX();
1332  doublereal p4 = pNode4->dGetX();
1333  doublereal p5 = pNode5->dGetX();
1334  doublereal p6 = pNode6->dGetX();
1335  doublereal density = HF->dGetDensity();
1336 
1337  Force = pGetDriveCaller()->dGet();
1338 
1339  s = XCurr(iFirstIndex+1); /* spostamento */
1340  v = XCurr(iFirstIndex+2); /* velocita' */
1341  sp = XPrimeCurr(iFirstIndex+1); /* velocita' */
1342  vp = XPrimeCurr(iFirstIndex+2); /* accelerazione */
1343 
1344  doublereal jumpPres12 = fabs(p1-p2); /* salto di pressione nodo1 & nodo2 */
1345  doublereal jumpPres13 = fabs(p1-p3); /* salto di pressione nodo1 & nodo3 */
1346  doublereal jumpPres24 = fabs(p2-p4); /* salto di pressione nodo2 & nodo4 */
1347  doublereal jumpPres34 = fabs(p3-p4); /* salto di pressione nodo3 & nodo4 */
1348 
1349  /* qui decido se sono a fondo od ad inizio corsa e di conseguenza calcolo
1350  * i giusti coefficienti */
1351 
1352  doublereal x = s; /* usato per calcolare le aree */
1353 
1354  doublereal area_max = width*s_max; // Area massima
1355  doublereal area_min = area_max*loss_area; // Area minimo
1356  doublereal deltaA = x*width;
1357 
1358  if (x > 0.) {
1359  A1 = area_min+deltaA;
1360  A2 = area_min;
1361  A3 = area_min+deltaA;
1362  A4 = area_min;
1363  } else { /* ho deltaA negativo */
1364  A1 = area_min;
1365  A2 = area_min-deltaA;
1366  A3 = area_min;
1367  A4 = area_min-deltaA;
1368  }
1369 
1370  doublereal Q12 = density*Cd*A1*copysign(sqrt(2.*jumpPres12/density), p1-p2);
1371  doublereal Q13 = density*Cd*A2*copysign(sqrt(2.*jumpPres13/density), p1-p3);
1372  doublereal Q24 = density*Cd*A4*copysign(sqrt(2.*jumpPres24/density), p2-p4);
1373  doublereal Q34 = density*Cd*A3*copysign(sqrt(2.*jumpPres34/density), p3-p4);
1374 
1375  doublereal Res_1 = Q12+Q13;
1376  doublereal Res_2 = -Q12+Q24;
1377  doublereal Res_3 = -Q13+Q34;
1378  doublereal Res_4 = -Q34-Q24;
1379  doublereal Res_5 = valve_area*sp;
1380 #warning "????????????? Res_6 = -Res_6 ?"
1381  doublereal Res_6 = -Res_6;
1382 
1383  deltaP = p1;
1384  if (deltaP == 0.) {
1385  deltaP = 10.; /* evito di dividere per zero nello jacobiano */
1386  }
1387  doublereal C = .4*valve_diameter*Cd*width*sqrt(density*deltaP);
1388  doublereal K = .43*width*deltaP;
1389  doublereal Res_7 = -Force+Mass*vp+C*sp+K*s+c1*s+c2*sp+c3*vp+cf1*(s-s_max)+cf2*sp+cf3*vp;
1390  doublereal Res_8 = sp-v;
1391 
1392  flow1 = -Res_1;
1393  flow2 = -Res_2;
1394  flow3 = -Res_3;
1395  flow4 = -Res_4;
1396  flow5 = -Res_5;
1397  flow6 = -Res_6;
1398 
1399 #ifdef HYDR_DEVEL
1400  DEBUGCOUT("Force: " << Force << std::endl);
1401  DEBUGCOUT("X equilibrio: " << Force/K << std::endl);
1402  DEBUGCOUT("A1: " << A1 << std::endl);
1403  DEBUGCOUT("A2: " << A2 << std::endl);
1404  DEBUGCOUT("A3: " << A3 << std::endl);
1405  DEBUGCOUT("A4: " << A4 << std::endl);
1406  DEBUGCOUT("p1: " << p1 << std::endl);
1407  DEBUGCOUT("p2: " << p2 << std::endl);
1408  DEBUGCOUT("p3: " << p3 << std::endl);
1409  DEBUGCOUT("p4: " << p4 << std::endl);
1410  DEBUGCOUT("Cd: " << Cd << std::endl);
1411  DEBUGCOUT("s_max : " << s_max << std::endl);
1412  DEBUGCOUT("x : " << x << std::endl);
1413  DEBUGCOUT("s : " << s << std::endl);
1414  DEBUGCOUT("sp: " << sp << std::endl);
1415  DEBUGCOUT("v : " << v << std::endl);
1416  DEBUGCOUT("vp: " << vp << std::endl);
1417  DEBUGCOUT("Valve_diameter:" << valve_diameter << std::endl);
1418  DEBUGCOUT("massa: " << Mass << std::endl);
1419  DEBUGCOUT("smorzatore: " << C << std::endl);
1420  DEBUGCOUT("molla: " << K << std::endl);
1421  DEBUGCOUT("density: " << density << std::endl);
1422  DEBUGCOUT("Valve_density: " << valve_density << std::endl);
1423  DEBUGCOUT("Area_max: " << area_max << std::endl);
1424  DEBUGCOUT("Width: " << width << std::endl);
1425  DEBUGCOUT("Loss_area: " << loss_area << std::endl);
1426  DEBUGCOUT("c1: " << c1 << std::endl);
1427  DEBUGCOUT("c2: " << c2 << std::endl);
1428  DEBUGCOUT("c3: " << c3 << std::endl);
1429  DEBUGCOUT("cf1: " << cf1 << std::endl);
1430  DEBUGCOUT("cf2: " << cf2 << std::endl);
1431  DEBUGCOUT("cf3: " << cf3 << std::endl);
1432  DEBUGCOUT("Q12: " << Q12 << std::endl);
1433  DEBUGCOUT("Q13: " << Q13 << std::endl);
1434  DEBUGCOUT("Q24: " << Q24 << std::endl);
1435  DEBUGCOUT("Q34: " << Q34 << std::endl);
1436  DEBUGCOUT("PORTATE AI VARI NODI (positive se entranti)"<< std::endl);
1437  DEBUGCOUT("-Res_1 (portata nodo1): " << -Res_1 << std::endl);
1438  DEBUGCOUT("-Res_2 (portata nodo2): " << -Res_2 << std::endl);
1439  DEBUGCOUT("-Res_3 (portata nodo3): " << -Res_3 << std::endl);
1440  DEBUGCOUT("-Res_4 (portata nodo4): " << -Res_4 << std::endl);
1441  DEBUGCOUT("-Res_5 (portata nodo3): " << -Res_5 << std::endl);
1442  DEBUGCOUT("-Res_6 (portata nodo4): " << -Res_6 << std::endl);
1443  DEBUGCOUT("-Res_6 eq dinamica : " << -Res_7 << std::endl);
1444  DEBUGCOUT("-Res_7 sp-v : " << -Res_8 << std::endl);
1445 #endif
1446 
1447  WorkVec.PutItem(1, iNode1RowIndex, Res_1);
1448  WorkVec.PutItem(2, iNode2RowIndex, Res_2);
1449  WorkVec.PutItem(3, iNode3RowIndex, Res_3);
1450  WorkVec.PutItem(4, iNode4RowIndex, Res_4);
1451  WorkVec.PutItem(5, iNode5RowIndex, Res_5);
1452  WorkVec.PutItem(6, iNode6RowIndex, Res_6);
1453  WorkVec.PutItem(7, iFirstIndex+1, Res_7);
1454  WorkVec.PutItem(8, iFirstIndex+2, Res_8);
1455 
1456  return WorkVec;
1457 }
const PressureNode * pNode1
Definition: valve.h:326
const PressureNode * pNode4
Definition: valve.h:329
const PressureNode * pNode3
Definition: valve.h:328
const PressureNode * pNode6
Definition: valve.h:331
Definition: force.h:46
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 valve_density
Definition: valve.h:342
doublereal valve_diameter
Definition: valve.h:341
virtual doublereal dGetDensity(void) const =0
virtual const doublereal & dGetX(void) const
Definition: node.h:492
const PressureNode * pNode5
Definition: valve.h:330
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
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
Definition: gradient.h:2974
DriveCaller * pGetDriveCaller(void) const
Definition: drive.cc:658
Definition: body.h:45
virtual doublereal dGet(const doublereal &dVar) const =0
virtual integer iGetFirstIndex(void) const
Definition: dofown.h:127
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
const PressureNode * pNode2
Definition: valve.h:327
virtual void Resize(integer iNewSize)=0

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 414 of file valve.h.

References pNode1, pNode2, pNode3, pNode4, pNode5, and pNode6.

414  {
415  connectedNodes.resize(6);
416  connectedNodes[0] = pNode1;
417  connectedNodes[1] = pNode2;
418  connectedNodes[2] = pNode3;
419  connectedNodes[3] = pNode4;
420  connectedNodes[4] = pNode5;
421  connectedNodes[5] = pNode6;
422  };
const PressureNode * pNode1
Definition: valve.h:326
const PressureNode * pNode4
Definition: valve.h:329
const PressureNode * pNode3
Definition: valve.h:328
const PressureNode * pNode6
Definition: valve.h:331
const PressureNode * pNode5
Definition: valve.h:330
const PressureNode * pNode2
Definition: valve.h:327
DofOrder::Order Pressure_flow_control_valve::GetDofType ( unsigned int  i) const
virtual

Reimplemented from Elem.

Definition at line 1139 of file valve.cc.

References ASSERT, and DofOrder::DIFFERENTIAL.

1140 {
1141  ASSERT(i >= 0 && i <= 1);
1142  return DofOrder::DIFFERENTIAL;
1143 }
#define ASSERT(expression)
Definition: colamd.c:977
HydraulicElem::Type Pressure_flow_control_valve::GetHydraulicType ( void  ) const
virtual
unsigned int Pressure_flow_control_valve::iGetNumDof ( void  ) const
virtual

Reimplemented from Elem.

Definition at line 1134 of file valve.cc.

1135 {
1136  return 2;
1137 }
void Pressure_flow_control_valve::Output ( OutputHandler OH) const
virtual

Reimplemented from ToBeOutput.

Definition at line 1460 of file valve.cc.

References A1, A2, A3, A4, ToBeOutput::bToBeOutput(), flow1, flow2, flow3, flow4, flow5, flow6, WithLabel::GetLabel(), OutputHandler::Hydraulic(), s, sp, and vp.

1461 {
1462  if (bToBeOutput()) {
1463  std::ostream& out = OH.Hydraulic();
1464  out << std::setw(8) << GetLabel()
1465  << " " << s << " " << sp << " " << vp
1466  << " " << flow1 << " " << flow2 << " " << flow3 << " " << flow4
1467  << " " << flow5 << " " << flow6
1468  << " " << A1 << " " << A2 << " " << A3 << " " << A4 << " " << std::endl;
1469  }
1470 }
virtual bool bToBeOutput(void) const
Definition: output.cc:890
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 & Pressure_flow_control_valve::Restart ( std::ostream &  out) const
virtual

Implements Elem.

Definition at line 1129 of file valve.cc.

1130 {
1131  return out << "Pressure_flow_control_valve not implemented yet!" << std::endl;
1132 }
void Pressure_flow_control_valve::SetValue ( DataManager pDM,
VectorHandler X,
VectorHandler XP,
SimulationEntity::Hints ph = 0 
)
virtual

Reimplemented from SimulationEntity.

Definition at line 1474 of file valve.cc.

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

1477 {
1478  integer i = iGetFirstIndex();
1479 
1480  X.PutCoef(i+1, start);
1481  X.PutCoef(i+2, 0.);
1482  XP.PutCoef(i+1, 0.);
1483  XP.PutCoef(i+2, 0.);
1484 }
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 Pressure_flow_control_valve::WorkSpaceDim ( integer piNumRows,
integer piNumCols 
) const
virtual

Implements Elem.

Definition at line 1147 of file valve.cc.

1148 {
1149  *piNumRows = 8;
1150  *piNumCols = 8;
1151 }

Member Data Documentation

doublereal Pressure_flow_control_valve::A1
private

Definition at line 346 of file valve.h.

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

doublereal Pressure_flow_control_valve::A2
private

Definition at line 347 of file valve.h.

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

doublereal Pressure_flow_control_valve::A3
private

Definition at line 348 of file valve.h.

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

doublereal Pressure_flow_control_valve::A4
private

Definition at line 349 of file valve.h.

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

doublereal Pressure_flow_control_valve::c1
private

Definition at line 363 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Pressure_flow_control_valve::c2
private

Definition at line 364 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Pressure_flow_control_valve::c3
private

Definition at line 365 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Pressure_flow_control_valve::c_acc
private

Definition at line 335 of file valve.h.

doublereal Pressure_flow_control_valve::c_spost
private

Definition at line 333 of file valve.h.

doublereal Pressure_flow_control_valve::c_vel
private

Definition at line 334 of file valve.h.

doublereal Pressure_flow_control_valve::Cd
private

Definition at line 338 of file valve.h.

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

doublereal Pressure_flow_control_valve::cf1
private

Definition at line 366 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Pressure_flow_control_valve::cf2
private

Definition at line 367 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Pressure_flow_control_valve::cf3
private

Definition at line 368 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Pressure_flow_control_valve::deltaP
private

Definition at line 369 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Pressure_flow_control_valve::flow1
private

Definition at line 352 of file valve.h.

Referenced by AssRes(), and Output().

doublereal Pressure_flow_control_valve::flow2
private

Definition at line 353 of file valve.h.

Referenced by AssRes(), and Output().

doublereal Pressure_flow_control_valve::flow3
private

Definition at line 354 of file valve.h.

Referenced by AssRes(), and Output().

doublereal Pressure_flow_control_valve::flow4
private

Definition at line 355 of file valve.h.

Referenced by AssRes(), and Output().

doublereal Pressure_flow_control_valve::flow5
private

Definition at line 356 of file valve.h.

Referenced by AssRes(), and Output().

doublereal Pressure_flow_control_valve::flow6
private

Definition at line 357 of file valve.h.

Referenced by AssRes(), and Output().

doublereal Pressure_flow_control_valve::Force
private

Definition at line 336 of file valve.h.

doublereal Pressure_flow_control_valve::loss_area
private

Definition at line 340 of file valve.h.

Referenced by AssRes().

doublereal Pressure_flow_control_valve::Mass
private

Definition at line 351 of file valve.h.

const PressureNode* Pressure_flow_control_valve::pNode1
private

Definition at line 326 of file valve.h.

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

const PressureNode* Pressure_flow_control_valve::pNode2
private

Definition at line 327 of file valve.h.

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

const PressureNode* Pressure_flow_control_valve::pNode3
private

Definition at line 328 of file valve.h.

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

const PressureNode* Pressure_flow_control_valve::pNode4
private

Definition at line 329 of file valve.h.

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

const PressureNode* Pressure_flow_control_valve::pNode5
private

Definition at line 330 of file valve.h.

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

const PressureNode* Pressure_flow_control_valve::pNode6
private

Definition at line 331 of file valve.h.

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

doublereal Pressure_flow_control_valve::s
private

Definition at line 359 of file valve.h.

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

doublereal Pressure_flow_control_valve::s_max
private

Definition at line 344 of file valve.h.

Referenced by AssRes().

doublereal Pressure_flow_control_valve::sp
private

Definition at line 361 of file valve.h.

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

doublereal Pressure_flow_control_valve::start
private

Definition at line 332 of file valve.h.

Referenced by SetValue().

doublereal Pressure_flow_control_valve::v
private

Definition at line 360 of file valve.h.

Referenced by AssJac(), and AssRes().

doublereal Pressure_flow_control_valve::valve_area
private

Definition at line 343 of file valve.h.

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

doublereal Pressure_flow_control_valve::valve_density
private

Definition at line 342 of file valve.h.

Referenced by AssRes(), and Pressure_flow_control_valve().

doublereal Pressure_flow_control_valve::valve_diameter
private

Definition at line 341 of file valve.h.

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

doublereal Pressure_flow_control_valve::vp
private

Definition at line 362 of file valve.h.

Referenced by AssRes(), and Output().

doublereal Pressure_flow_control_valve::width
private

Definition at line 339 of file valve.h.

Referenced by AssJac(), and AssRes().


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