37 namespace sixDoFRigidBodyMotionRestraints
43 sixDoFRigidBodyMotionRestraint,
97 restraintPosition = motion.
transform(refAttachmentPt_);
100 vector r = restraintPosition - anchor_->value(t);
105 scalar m = motion.
mass();
107 restraintMoment =
Zero;
119 if (
mag(r) > restLength_)
127 scalar damping = psi_*2*m*wn_/numberOfChains_;
128 scalar stiffness =
sqr(wn_)*m/numberOfChains_;
133 - damping*(rDir & v)*rDir
134 - stiffness*(
mag(r) - restLength_)*rDir
136 + (1-frelax_)*oldRestraintForce_;
138 oldRestraintForce_ = restraintForce;
142 restraintForce =
Zero;
143 oldRestraintForce_ =
Zero;
149 Info<< t <<
" " << restraintForce.x()
150 <<
" " << restraintForce.y()
151 <<
" " << restraintForce.z()
152 <<
" " <<
mag(r) - restLength_
165 sDoFRBMRCoeffs_.readEntry(
"refAttachmentPt", refAttachmentPt_);
166 psi_ = sDoFRBMRCoeffs_.getOrDefault<scalar>(
"psi", 1);
167 sDoFRBMRCoeffs_.readEntry(
"wn", wn_);
168 sDoFRBMRCoeffs_.readEntry(
"restLength", restLength_);
169 sDoFRBMRCoeffs_.readEntry(
"numberOfChains", numberOfChains_);
170 frelax_ = sDoFRBMRCoeffs_.getOrDefault<scalar>(
"frelax", 0.8);
181 os.writeEntry(
"refAttachmentPt", refAttachmentPt_);
182 os.writeEntry(
"psi", psi_);
183 os.writeEntry(
"wn", wn_);
184 os.writeEntry(
"restLength", restLength_);
185 os.writeEntry(
"numberOfChains", numberOfChains_);
186 os.writeEntryIfDifferent<scalar>(
"psi", 1, psi_);
187 os.writeEntryIfDifferent<scalar>(
"frelax", 0.8, frelax_);
Six degree of freedom motion for a rigid body.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
bool report() const
Return the report Switch.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
linearSpringDamper(const word &name, const dictionary &sDoFRBMRDict)
Construct from components.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Base class for defining restraints for sixDoF motions.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void restrain(const sixDoFRigidBodyMotion &motion, vector &restraintPosition, vector &restraintForce, vector &restraintMoment) const
Calculate the restraint position, force and moment.
point transform(const point &initialPoints) const
Transform the given initial state point by the current motion.
Macros for easy insertion into run-time selection tables.
virtual void write(Ostream &) const
Write.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
virtual bool read(const dictionary &sDoFRBMRDict)
Update properties from given dictionary.
defineTypeNameAndDebug(linearAxialAngularSpring, 0)
virtual ~linearSpringDamper()
Destructor.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
addToRunTimeSelectionTable(sixDoFRigidBodyMotionRestraint, linearAxialAngularSpring, dictionary)
point velocity(const point &pt) const
Return the velocity of a position.
virtual bool read(const dictionary &sDoFRBMRCoeff)
Update properties from given dictionary.
const Time & time() const
Return time.
scalar timeOutputValue() const
Return the current user-time value. (ie, after applying any timeToUserTime() conversion) ...
scalar mass() const
Return the mass.
messageStream Info
Information stream (stdout output on master, null elsewhere)
static constexpr const zero Zero
Global zero (0)