rigidBodyDynamics::restraints::linearSpring: Added switch "allowSlack" to allow no restraint when line is shorter than restLength
Based on patch contributed by SeongMo Yeon Resolved contribution https://bugs.openfoam.org/view.php?id=3352
This commit is contained in:
@ -90,7 +90,9 @@ void Foam::RBD::restraints::linearSpring::restrain
|
||||
// Force and moment on the master body including optional damping
|
||||
vector force
|
||||
(
|
||||
(-stiffness_*(magR - restLength_) - damping_*(r & v))*r
|
||||
(allowSlack_ && magR < restLength_)
|
||||
? -damping_*(r & v)*r
|
||||
: (-stiffness_*(magR - restLength_) - damping_*(r & v))*r
|
||||
);
|
||||
|
||||
vector moment(attachmentPt ^ force);
|
||||
@ -100,6 +102,7 @@ void Foam::RBD::restraints::linearSpring::restrain
|
||||
Info<< " attachmentPt " << attachmentPt
|
||||
<< " attachmentPt - anchor " << r*magR
|
||||
<< " spring length " << magR
|
||||
<< " allow slack " << allowSlack_
|
||||
<< " force " << force
|
||||
<< " moment " << moment
|
||||
<< endl;
|
||||
@ -122,6 +125,7 @@ bool Foam::RBD::restraints::linearSpring::read
|
||||
coeffs_.lookup("stiffness") >> stiffness_;
|
||||
coeffs_.lookup("damping") >> damping_;
|
||||
coeffs_.lookup("restLength") >> restLength_;
|
||||
allowSlack_ = coeffs_.lookupOrDefault<Switch>("allowSlack", false);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -143,6 +147,8 @@ void Foam::RBD::restraints::linearSpring::write
|
||||
writeEntry(os, "damping", damping_);
|
||||
|
||||
writeEntry(os, "restLength", restLength_);
|
||||
|
||||
writeEntry(os, "allowSlack", allowSlack_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -36,6 +36,7 @@ SourceFiles
|
||||
#define RBD_restraints_linearSpring_H
|
||||
|
||||
#include "rigidBodyRestraint.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -72,6 +73,9 @@ class linearSpring
|
||||
//- Rest length - length of spring when no forces are applied to it
|
||||
scalar restLength_;
|
||||
|
||||
//- Switch to allow no restraint when line is shorter than restLength
|
||||
Switch allowSlack_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user