81 point attachmentPt = bodyPoint(refAttachmentPt_);
84 vector r = attachmentPt - anchor_;
89 vector v = bodyPointVelocity(refAttachmentPt_).l();
94 (allowSlack_ && magR < restLength_)
96 : (-stiffness_*(magR - restLength_) - damping_*(r & v))*r
99 vector moment(attachmentPt ^ force);
103 Info<<
" attachmentPt " << attachmentPt
104 <<
" attachmentPt - anchor " << r*magR
105 <<
" spring length " << magR
106 <<
" allow slack " << allowSlack_
107 <<
" force " << force
108 <<
" moment " << moment
124 coeffs_.lookup(
"anchor") >> anchor_;
125 coeffs_.lookup(
"refAttachmentPt") >> refAttachmentPt_;
126 coeffs_.lookup(
"stiffness") >> stiffness_;
127 coeffs_.lookup(
"damping") >> damping_;
128 coeffs_.lookup(
"restLength") >> restLength_;
129 allowSlack_ = coeffs_.lookupOrDefault<
Switch>(
"allowSlack",
false);
144 writeEntry(os,
"refAttachmentPt", refAttachmentPt_);
addToRunTimeSelectionTable(restraint, externalForce, dictionary)
defineTypeNameAndDebug(externalForce, 0)
A list of keyword definitions, which are a keyword followed by any number of values (e...
linearSpring(const word &name, const dictionary &dict, const rigidBodyModel &model)
Construct from components.
Base class for defining restraints for rigid-body dynamics.
virtual void write(Ostream &) const
Write.
virtual bool read(const dictionary &dict)
Update properties from given dictionary.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Macros for easy insertion into run-time selection tables.
Holds the motion state of rigid-body model.
bool read(const char *, int32_t &)
virtual bool read(const dictionary &dict)
Update properties from given dictionary.
A class for handling words, derived from string.
SpatialVector< scalar > spatialVector
SpatialVector of scalars.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
virtual void restrain(scalarField &tau, Field< spatialVector > &fx, const rigidBodyModelState &state) const
Accumulate the retraint internal joint forces into the tau field and.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
virtual ~linearSpring()
Destructor.
dimensioned< scalar > mag(const dimensioned< Type > &)
Basic rigid-body model representing a system of rigid-bodies connected by 1-6 DoF joints...
virtual void write(Ostream &) const =0
Write.