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

#include <hminor.h>

Inheritance diagram for MinorLoss:
Collaboration diagram for MinorLoss:

Public Member Functions

 MinorLoss (unsigned int uL, const DofOwner *pD, HydraulicFluid *hf, const PressureNode *p1, const PressureNode *p2, doublereal dK12, doublereal dK21, doublereal A, flag fOut)
 
 ~MinorLoss (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 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 void SetValue (DataManager *pDM, VectorHandler &X, VectorHandler &XP, SimulationEntity::Hints *h=0)
 
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 PressureNodem_pNode1
 
const PressureNodem_pNode2
 
doublereal m_dKappa12
 
doublereal m_dKappa21
 
doublereal m_Area
 
doublereal flow
 
doublereal vel
 
doublereal m_dKappa
 

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 44 of file hminor.h.

Constructor & Destructor Documentation

MinorLoss::MinorLoss ( unsigned int  uL,
const DofOwner pD,
HydraulicFluid hf,
const PressureNode p1,
const PressureNode p2,
doublereal  dK12,
doublereal  dK21,
doublereal  A,
flag  fOut 
)

Definition at line 46 of file hminor.cc.

References ASSERT, PressureNode::GetNodeType(), Node::HYDRAULIC, m_dKappa12, m_dKappa21, m_pNode1, and m_pNode2.

51 : Elem(uL, fOut),
52 HydraulicElem(uL, pDO, hf, fOut),
53 m_pNode1(p1), m_pNode2(p2),
54 m_dKappa12(dK12), m_dKappa21(dK21), m_Area(A),
55 flow(0.),
56 vel(0.),
57 m_dKappa(0.)
58 {
59  ASSERT(m_pNode1 != NULL);
61  ASSERT(m_pNode2 != NULL);
63  ASSERT(m_dKappa12 >= 0.);
64  ASSERT(m_dKappa21 >= 0.);
65  ASSERT(A > std::numeric_limits<doublereal>::epsilon());
66 }
const PressureNode * m_pNode2
Definition: hminor.h:47
doublereal flow
Definition: hminor.h:53
doublereal m_dKappa21
Definition: hminor.h:50
doublereal m_dKappa12
Definition: hminor.h:49
doublereal m_dKappa
Definition: hminor.h:55
doublereal m_Area
Definition: hminor.h:51
HydraulicElem(unsigned int uL, const DofOwner *pDO, HydraulicFluid *hf, flag fOut)
Definition: preselem.cc:54
const PressureNode * m_pNode1
Definition: hminor.h:46
#define ASSERT(expression)
Definition: colamd.c:977
virtual Node::Type GetNodeType(void) const
Definition: presnode.h:54
Elem(unsigned int uL, flag fOut)
Definition: elem.cc:41
doublereal vel
Definition: hminor.h:54

Here is the call graph for this function:

MinorLoss::~MinorLoss ( void  )

Definition at line 68 of file hminor.cc.

References NO_OP.

69 {
70  NO_OP;
71 }
#define NO_OP
Definition: myassert.h:74

Member Function Documentation

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

Implements Elem.

Definition at line 108 of file hminor.cc.

References DEBUGCOUT, HydraulicFluid::dGetDensity(), ScalarAlgebraicNode::dGetX(), grad::fabs(), HydraulicElem::HF, Node::iGetFirstColIndex(), Node::iGetFirstRowIndex(), m_Area, m_dKappa, m_pNode1, m_pNode2, FullSubMatrixHandler::PutCoef(), FullSubMatrixHandler::PutColIndex(), FullSubMatrixHandler::PutRowIndex(), FullSubMatrixHandler::Resize(), VariableSubMatrixHandler::SetFull(), and grad::sqrt().

112 {
113  DEBUGCOUT("Entering MinorLoss::AssJac()" << std::endl);
114 
115  FullSubMatrixHandler& WM = WorkMat.SetFull();
116  WM.Resize(2, 2);
117 
118  integer iNode1RowIndex = m_pNode1->iGetFirstRowIndex() + 1;
119  integer iNode2RowIndex = m_pNode2->iGetFirstRowIndex() + 1;
120  integer iNode1ColIndex = m_pNode1->iGetFirstColIndex() + 1;
121  integer iNode2ColIndex = m_pNode2->iGetFirstColIndex() + 1;
122 
123  WM.PutRowIndex(1, iNode1RowIndex);
124  WM.PutRowIndex(2, iNode2RowIndex);
125  WM.PutColIndex(1, iNode1ColIndex);
126  WM.PutColIndex(2, iNode2ColIndex);
127 
128  doublereal p1 = m_pNode1->dGetX();
129  doublereal p2 = m_pNode2->dGetX();
130 
131  doublereal jumpPres = fabs(p1-p2);
132 
133  /* evito di dividere per un numero troppo piccolo */
134  if (jumpPres < 1.e8*std::numeric_limits<doublereal>::epsilon()) {
135  jumpPres = 1.e8*std::numeric_limits<doublereal>::epsilon();
136  }
137 
138  /*
139  * se voglio usare un fluido comprimibile, metto la pressione
140  * media nel condotto:
141  */
142 
143  doublereal density = HF->dGetDensity((p1 + p2)/2.);
144 
145  /* altrimenti lascio la densita' di riferimento
146  * doublereal density = HF->dGetDensity();
147  */
148 
149  doublereal Jac = -density*.5*m_Area*sqrt(2./(m_dKappa*density*jumpPres));
150 
151  WM.PutCoef(1, 1, Jac);
152  WM.PutCoef(1, 2, -Jac);
153  WM.PutCoef(2, 1, -Jac);
154  WM.PutCoef(2, 2, Jac);
155 
156  return WorkMat;
157 }
void PutColIndex(integer iSubCol, integer iCol)
Definition: submat.h:325
const PressureNode * m_pNode2
Definition: hminor.h:47
FullSubMatrixHandler & SetFull(void)
Definition: submat.h:1168
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 m_dKappa
Definition: hminor.h:55
virtual doublereal dGetDensity(void) const =0
doublereal m_Area
Definition: hminor.h:51
virtual const doublereal & dGetX(void) const
Definition: node.h:492
HydraulicFluid * HF
Definition: preselem.h:79
const PressureNode * m_pNode1
Definition: hminor.h:46
#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
void PutRowIndex(integer iSubRow, integer iRow)
Definition: submat.h:311
double doublereal
Definition: colamd.c:52
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 & MinorLoss::AssRes ( SubVectorHandler WorkVec,
doublereal  dCoef,
const VectorHandler XCurr,
const VectorHandler XPrimeCurr 
)
virtual

Implements Elem.

Definition at line 160 of file hminor.cc.

References copysign(), DEBUGCOUT, HydraulicFluid::dGetDensity(), ScalarAlgebraicNode::dGetX(), grad::fabs(), flow, HydraulicElem::HF, Node::iGetFirstRowIndex(), m_Area, m_dKappa, m_dKappa12, m_dKappa21, m_pNode1, m_pNode2, SubVectorHandler::PutItem(), VectorHandler::Resize(), grad::sqrt(), and vel.

164 {
165  DEBUGCOUT("Entering MinorLoss::AssRes()" << std::endl);
166 
167  WorkVec.Resize(2);
168 
169  integer iNode1RowIndex = m_pNode1->iGetFirstRowIndex() + 1;
170  integer iNode2RowIndex = m_pNode2->iGetFirstRowIndex() + 1;
171 
172  doublereal p1 = m_pNode1->dGetX();
173  doublereal p2 = m_pNode2->dGetX();
174 
175  doublereal jumpPres = fabs(p1-p2);
176 
177  if (p1 > p2) {
178  m_dKappa = m_dKappa12; /* flusso diretto da 1 a 2 */
179  } else {
180  m_dKappa = m_dKappa21; /* flusso diretto da 2 a 1 */
181  }
182 
183  doublereal density = HF->dGetDensity((p1 + p2)/2.);
184  flow = density*m_Area*sqrt(2./(m_dKappa*density))*copysign(sqrt(jumpPres), p1 - p2);
185  vel = flow/(density*m_Area);
186 
187 #ifdef HYDR_DEVEL
188  DEBUGCOUT("RES area : " << m_Area << std::endl);
189  DEBUGCOUT("RES flow: " << flow << std::endl);
190  DEBUGCOUT("RES p1: " << p1 << std::endl);
191  DEBUGCOUT("RES p2: " << p2 << std::endl);
192  DEBUGCOUT("RES dKappa: " << m_dKappa << std::endl);
193  DEBUGCOUT("****************************************************" << std::endl);
194  DEBUGCOUT("RES velocita': " << vel << std::endl);
195  DEBUGCOUT(" se positiva il fluido va dal nodo 1 al nodo 2 " << std::endl);
196  DEBUGCOUT("RES portata (nodo2): " << flow << std::endl);
197  DEBUGCOUT("****************************************************" << std::endl);
198 #endif
199 
200  WorkVec.PutItem(1, iNode1RowIndex, flow);
201  WorkVec.PutItem(2, iNode2RowIndex, -flow);
202 
203  return WorkVec;
204 }
const PressureNode * m_pNode2
Definition: hminor.h:47
doublereal flow
Definition: hminor.h:53
doublereal m_dKappa21
Definition: hminor.h:50
GradientExpression< UnaryExpr< FuncFabs, Expr > > fabs(const GradientExpression< Expr > &u)
Definition: gradient.h:2973
doublereal m_dKappa12
Definition: hminor.h:49
virtual void PutItem(integer iSubRow, integer iRow, const doublereal &dCoef)
Definition: submat.h:1445
doublereal m_dKappa
Definition: hminor.h:55
virtual doublereal dGetDensity(void) const =0
doublereal m_Area
Definition: hminor.h:51
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
const PressureNode * m_pNode1
Definition: hminor.h:46
#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
double doublereal
Definition: colamd.c:52
long int integer
Definition: colamd.c:51
virtual void Resize(integer iNewSize)=0
doublereal vel
Definition: hminor.h:54

Here is the call graph for this function:

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

Reimplemented from Elem.

Definition at line 91 of file hminor.h.

References m_pNode1, and m_pNode2.

91  {
92  connectedNodes.resize(2);
93  connectedNodes[0] = m_pNode1;
94  connectedNodes[1] = m_pNode2;
95  };
const PressureNode * m_pNode2
Definition: hminor.h:47
const PressureNode * m_pNode1
Definition: hminor.h:46
DofOrder::Order MinorLoss::GetDofType ( unsigned int  i) const
virtual

Reimplemented from Elem.

Definition at line 94 of file hminor.cc.

References MBDYN_EXCEPT_ARGS.

95 {
96  silent_cerr("MinorLoss has no dofs!" << std::endl);
98 }
#define MBDYN_EXCEPT_ARGS
Definition: except.h:63
HydraulicElem::Type MinorLoss::GetHydraulicType ( void  ) const
virtual

Implements HydraulicElem.

Definition at line 75 of file hminor.cc.

References HydraulicElem::MINOR_LOSS.

unsigned int MinorLoss::iGetNumDof ( void  ) const
virtual

Reimplemented from Elem.

Definition at line 88 of file hminor.cc.

89 {
90  return 0;
91 }
void MinorLoss::Output ( OutputHandler OH) const
virtual

Reimplemented from ToBeOutput.

Definition at line 207 of file hminor.cc.

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

208 {
209  if (bToBeOutput()) {
210  std::ostream& out = OH.Hydraulic();
211  out << std::setw(8) << GetLabel()
212  << " " << vel << " " << flow << std::endl;
213  }
214 }
virtual bool bToBeOutput(void) const
Definition: output.cc:890
doublereal flow
Definition: hminor.h:53
std::ostream & Hydraulic(void) const
Definition: output.h:492
unsigned int GetLabel(void) const
Definition: withlab.cc:62
doublereal vel
Definition: hminor.h:54

Here is the call graph for this function:

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

Implements Elem.

Definition at line 82 of file hminor.cc.

83 {
84  return out << "MinorLoss not implemented yet!" << std::endl;
85 }
void MinorLoss::WorkSpaceDim ( integer piNumRows,
integer piNumCols 
) const
virtual

Implements Elem.

Definition at line 101 of file hminor.cc.

102 {
103  *piNumRows = 2;
104  *piNumCols = 2;
105 }

Member Data Documentation

doublereal MinorLoss::flow
private

Definition at line 53 of file hminor.h.

Referenced by AssRes(), and Output().

doublereal MinorLoss::m_Area
private

Definition at line 51 of file hminor.h.

Referenced by AssJac(), and AssRes().

doublereal MinorLoss::m_dKappa
private

Definition at line 55 of file hminor.h.

Referenced by AssJac(), and AssRes().

doublereal MinorLoss::m_dKappa12
private

Definition at line 49 of file hminor.h.

Referenced by AssRes(), and MinorLoss().

doublereal MinorLoss::m_dKappa21
private

Definition at line 50 of file hminor.h.

Referenced by AssRes(), and MinorLoss().

const PressureNode* MinorLoss::m_pNode1
private

Definition at line 46 of file hminor.h.

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

const PressureNode* MinorLoss::m_pNode2
private

Definition at line 47 of file hminor.h.

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

doublereal MinorLoss::vel
private

Definition at line 54 of file hminor.h.

Referenced by AssRes(), and Output().


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