41 #ifndef SHOCKABSORBER_H
42 #define SHOCKABSORBER_H
53 template <
class T,
class Tder>
80 <<
"/* Shock absorber, not implemented yet */"
184 Penalty = p->Penalty;
185 PenaltyPrime = p->PenaltyPrime;
191 pAreaPinPlus = p->pAreaPinPlus->
pCopy();
192 pAreaPinMinus = p->pAreaPinMinus->
pCopy();
193 pAreaOrifices = p->pAreaOrifices->
pCopy();
195 AreaFluid = p->AreaFluid;
196 RhoFluid = p->RhoFluid;
199 EpsPrimeRef = p->EpsPrimeRef;
200 FrictionAmpl = p->FrictionAmpl;
212 pAreaPinPlus(NULL), pAreaPinMinus(NULL), pAreaOrifices(NULL),
213 EpsPrimeRef(1.), FrictionAmpl(0.), dPressure(0.) {
218 "this help refers to the specific \"shock absorber\" constitutive\n"
219 "law input data. The prestrain value, if required, must be inserted\n"
220 "at the beginning of the data. The syntax is:\n"
222 "\t[ prestrain , <value> , ]\n"
223 "\t<reference pressure> ,\n"
224 "\t<reference area for force computation> ,\n"
225 "\t<interaction coefficient (kinematic scale * ( L * A / V0 ) )> ,\n"
226 "\t<gamma (polytropic exponent)> ,\n"
227 "\t[ epsilon max , <upper strain bound, > prestrain; defaults to " <<
defaultEpsMax <<
")> , ]\n"
228 "\t[ epsilon min , <lower strain bound, < prestrain; defaults to " <<
defaultEpsMin <<
")> , ]\n"
229 "\t[ penalty , <penalty factor for strain bound enforcement, defaults to " <<
defaultPenalty <<
"> ,\n"
230 "\t\t<penalty factor for strain rate, active only when strain bounds are violated; defaults to " <<
defaultPenaltyPrime <<
"> ]\n"
231 "\t[ metering , <metering area (drive, strain dependent)> ,\n"
232 "\t\t[ negative , <metering area for negative strain rate (drive, strain dependent); same as above if not given> , ] ]\n"
233 "\t[ orifice , <orifice area (drive, strain rate dependent)> , ]\n"
235 "\t<fluid density> ,\n"
236 "\t<drag coefficient / reference length (scales strain rate to velocity)>\n"
237 "\t[ , friction, <reference epsilon prime> ,\n"
238 "\t\t <friction amplitude coefficient> ] ;\n"
240 "Note: at least one of \"metering\" and \"orifice\" must be defined.\n"
241 "Note: if 'friction' is enabled, the elastic force is multiplied\n"
244 "\t\t1. - <friction amplitude coefficient> * tanh( <epsilon prime> / <reference epsilon prime> )\n"
246 "\toutput appended to output from element;\n"
248 "\t\t\tcolumn 19: gas pressure\n"
249 "\t\t\tcolumn 20: metering area\n"
250 "\t\t\tcolumn 21: elastic force\n"
251 "\t\t\tcolumn 22: viscous force\n"
253 "\toutput available as element private data; syntax:\n"
255 "\t\t# in nodes data block\n"
256 "\t\tparameter: <parameter node label> , element ;\n"
257 "\t\t# in elements data block\n"
258 "\t\tbind: <rod label> , joint , <parameter node label> ,\n"
259 "\t\t\tstring , \"constitutiveLaw.<X>\" ;\n"
261 "\twhere \"<X>\" can be:\n"
262 "\t\t\"p\": gas pressure\n"
263 "\t\t\"A\": metering area\n"
264 "\t\t\"Fe\": elastic force\n"
265 "\t\t\"Fv\": viscous force\n"
289 if (EpsMin >= EpsMax) {
291 <<
": epsilon min must be less"
292 " than epsilon max" << std::endl);
307 pAreaPinMinus = pAreaPinPlus->
pCopy();
315 if (pAreaPinPlus == NULL && pAreaOrifices == NULL) {
317 <<
": at least one area (metering or orifice)"
318 " must be defined" << std::endl);
328 if (EpsPrimeRef <= 0.) {
329 silent_cerr(
"Illegal Reference "
330 "Epsilon Prime " << EpsPrimeRef
337 if (FrictionAmpl < 0. || FrictionAmpl > 1.) {
338 silent_cerr(
"Illegal Friction "
339 "Amplitude Coefficient " << FrictionAmpl
368 virtual std::ostream&
377 <<
", prestrain, single, ",
390 <<
"epsilon max, " << EpsMax <<
", "
391 <<
"epsilon min, " << EpsMin <<
", "
392 <<
"penalty, " << Penalty <<
", " << PenaltyPrime;
400 pAreaPinPlus->Restart(out)
402 pAreaPinMinus->Restart(out);
408 pAreaOrifices->Restart(out);
438 dPressure = P0*Adiab;
445 if (FrictionAmpl != 0.) {
446 F *= (1.-FrictionAmpl*
tanh(EpsPrime/EpsPrimeRef));
449 FDE = Gamma*Cint*VRatio*
F;
451 bool ChangeJac(
false);
453 if (CurrEpsilon > EpsMax) {
457 + PenaltyPrime*EpsPrime;
460 doublereal dFP = Penalty*(CurrEpsilon-EpsMax);
462 FDEPrime = PenaltyPrime;
463 dFP += PenaltyPrime*EpsPrime;
474 }
else if (CurrEpsilon < EpsMin) {
478 + PenaltyPrime*EpsPrime;
481 doublereal dFP = Penalty*(CurrEpsilon-EpsMin);
483 FDEPrime = PenaltyPrime;
484 dFP += PenaltyPrime*EpsPrime;
495 }
else if (bPenalty) {
508 if (pAreaPinPlus != NULL) {
510 dArea += pAreaPinPlus->dGet(CurrEpsilon);
512 dArea += pAreaPinMinus->dGet(CurrEpsilon);
516 if (pAreaOrifices != NULL) {
517 dArea += pAreaOrifices->dGet(EpsPrime);
521 silent_cerr(
"ShockAbsorberConstitutiveLaw::Update:"
522 " null or negative area" << std::endl);
526 doublereal d = .5*RhoFluid*AreaFluid*
pow(AreaFluid/(dArea*Cd), 2);
528 dFviscous = d*EpsPrime*
fabs(EpsPrime);
559 if (strcmp(s,
"p") == 0) {
563 if (strcmp(s,
"A") == 0) {
567 if (strcmp(s,
"Fe") == 0) {
571 if (strcmp(s,
"Fv") == 0) {
610 return out <<
" " << dPressure <<
" " << dArea
611 <<
" " << dFelastic <<
" " << dFviscous;
GradientExpression< UnaryExpr< FuncTanh, Expr > > tanh(const GradientExpression< Expr > &u)
virtual std::ostream & Restart(std::ostream &out) const
virtual std::ostream & Restart(std::ostream &out) const
const doublereal defaultPenalty
const doublereal defaultPenaltyPrime
GradientExpression< BinaryExpr< FuncPow, LhsExpr, RhsExpr > > pow(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
#define MBDYN_EXCEPT_ARGS
const doublereal defaultEpsMin
std::ostream & Write(std::ostream &out, const FullMatrixHandler &m, const char *s, const char *s2)
GradientExpression< UnaryExpr< FuncFabs, Expr > > fabs(const GradientExpression< Expr > &u)
virtual unsigned int iGetPrivDataIdx(const char *s) const
virtual ConstitutiveLaw< T, Tder > * pCopy(void) const
TplDriveCaller< T > * pGetDriveCaller(void) const
virtual ~ShockAbsorberConstitutiveLaw(void)
DriveCaller * pAreaOrifices
virtual void Update(const doublereal &Eps, const doublereal &EpsPrime=0.)
DriveCaller * pAreaPinMinus
virtual std::ostream & OutputAppend(std::ostream &out) const
virtual bool IsKeyWord(const char *sKeyWord)
ShockAbsorberConstitutiveLaw(const ShockAbsorberConstitutiveLaw *p)
doublereal copysign(doublereal x, doublereal y)
DriveCaller * pAreaPinPlus
#define ASSERT(expression)
virtual void Update(const T &, const T &=0.)
virtual unsigned int iGetNumPrivData(void) const
#define SAFENEWWITHCONSTRUCTOR(pnt, item, constructor)
const doublereal defaultEpsMax
virtual DriveCaller * pCopy(void) const =0
virtual unsigned int iGetNumPrivData(void) const
ShockAbsorberConstitutiveLaw(const DataManager *pDM, TplDriveCaller< doublereal > *pDC, MBDynParser &HP)
virtual ConstitutiveLaw< doublereal, doublereal > * pCopy(void) const
ShockAbsorberConstitutiveLaw(const DataManager *pDM, TplDriveCaller< T > *pDC, MBDynParser &HP)
virtual doublereal dGetPrivData(unsigned int i) const
DriveCaller * GetDriveCaller(bool bDeferred=false)
virtual ~ShockAbsorberConstitutiveLaw(void)
virtual HighParser::ErrOut GetLineData(void) const
virtual doublereal GetReal(const doublereal &dDefval=0.0)