Go to the documentation of this file.
38 namespace sixDoFRigidBodyMotionRestraints
91 vector oldDir = refQ_ & refDir;
94 if (
mag(oldDir & axis_) > 0.95 ||
mag(newDir & axis_) > 0.95)
99 oldDir = refQ_ & refDir;
104 oldDir -= (axis_ & oldDir)*axis_;
105 oldDir /= (
mag(oldDir) + VSMALL);
107 newDir -= (axis_ & newDir)*axis_;
108 newDir /= (
mag(newDir) + VSMALL);
110 scalar theta =
mag(
acos(
min(oldDir & newDir, 1.0)));
113 vector a = (oldDir ^ newDir);
116 a = (a & axis_)*axis_;
118 scalar magA =
mag(a);
130 restraintMoment = -stiffness_*theta*a - damping_*(motion.
omega() & a)*a;
132 restraintForce =
Zero;
140 Info<<
" angle " << theta*
sign(a & axis_)
141 <<
" moment " << restraintMoment
154 refQ_ = sDoFRBMRCoeffs_.getOrDefault<
tensor>(
"referenceOrientation",
I);
159 <<
"referenceOrientation " << refQ_ <<
" is not a rotation tensor. "
160 <<
"mag(referenceOrientation) - sqrt(3) = "
165 sDoFRBMRCoeffs_.readEntry(
"axis", axis_);
167 const scalar magAxis(
mag(axis_));
169 if (magAxis > VSMALL)
176 <<
"axis has zero length"
180 sDoFRBMRCoeffs_.readEntry(
"stiffness", stiffness_);
181 sDoFRBMRCoeffs_.readEntry(
"damping", damping_);
virtual bool read(const dictionary &sDoFRBMRDict)
Update properties from given dictionary.
A class for handling words, derived from Foam::string.
static constexpr const zero Zero
Global zero (0)
const tensor & orientation() const
Return the orientation tensor, Q.
linearAxialAngularSpring(const word &name, const dictionary &sDoFRBMRDict)
Construct from components.
virtual void restrain(const sixDoFRigidBodyMotion &motion, vector &restraintPosition, vector &restraintForce, vector &restraintMoment) const
Calculate the restraint position, force and moment.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar sign(const dimensionedScalar &ds)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
addToRunTimeSelectionTable(sixDoFRigidBodyMotionRestraint, linearAxialAngularSpring, dictionary)
const point & centreOfRotation() const
Return the current centre of rotation.
messageStream Info
Information stream (uses stdout - output is on the master only)
word name(const complex &c)
Return string representation of complex.
Base class for defining restraints for sixDoF motions.
defineTypeNameAndDebug(linearAxialAngularSpring, 0)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
errorManip< error > abort(error &err)
Vector< scalar > vector
A scalar version of the templated Vector.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Six degree of freedom motion for a rigid body.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensionedScalar acos(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
virtual bool read(const dictionary &sDoFRBMRCoeff)
Update properties from given dictionary.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
bool report() const
Return the report Switch.
sixDoFRigidBodyMotionRestraints model. Linear axial angular spring.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
tensor rotationTensor(const vector &n1, const vector &n2)
Rotational transformation tensor from vector n1 to n2.
vector omega() const
Return the angular velocity in the global frame.
virtual ~linearAxialAngularSpring()
Destructor.
static const Identity< scalar > I
virtual void write(Ostream &) const
Write.