Go to the documentation of this file.
35 namespace sixDoFRigidBodyMotionRestraints
88 vector oldDir = refQ_ & refDir;
91 if (
mag(oldDir & axis_) > 0.95 ||
mag(newDir & axis_) > 0.95)
96 oldDir = refQ_ & refDir;
101 oldDir -= (axis_ & oldDir)*axis_;
102 oldDir /= (
mag(oldDir) + VSMALL);
104 newDir -= (axis_ & newDir)*axis_;
105 newDir /= (
mag(newDir) + VSMALL);
107 scalar theta =
mag(
acos(
min(oldDir & newDir, 1.0)));
110 vector a = (oldDir ^ newDir);
113 a = (a & axis_)*axis_;
115 scalar magA =
mag(a);
127 restraintMoment = -stiffness_*theta*a - damping_*(motion.
omega() & a)*a;
137 Info<<
" angle " << theta*
sign(a & axis_)
138 <<
" moment " << restraintMoment
151 refQ_ = sDoFRBMRCoeffs_.lookupOrDefault<
tensor>(
"referenceOrientation",
I);
156 <<
"referenceOrientation " << refQ_ <<
" is not a rotation tensor. "
157 <<
"mag(referenceOrientation) - sqrt(3) = "
162 axis_ = sDoFRBMRCoeffs_.lookup(
"axis");
164 scalar magAxis(
mag(axis_));
166 if (magAxis > VSMALL)
173 <<
"axis has zero length"
177 sDoFRBMRCoeffs_.lookup(
"stiffness") >> stiffness_;
178 sDoFRBMRCoeffs_.lookup(
"damping") >> damping_;
virtual bool read(const dictionary &sDoFRBMRDict)
Update properties from given dictionary.
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
A class for handling words, derived from string.
const tensor & orientation() const
Return the orientation tensor, Q.
bool read(const char *, int32_t &)
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.
dimensioned< scalar > mag(const dimensioned< Type > &)
dimensionedScalar sign(const dimensionedScalar &ds)
addToRunTimeSelectionTable(sixDoFRigidBodyMotionRestraint, linearAxialAngularSpring, dictionary)
Base class for defining restraints for sixDoF motions.
defineTypeNameAndDebug(linearAxialAngularSpring, 0)
static const sphericalTensor I(1)
A list of keyword definitions, which are a keyword followed by any number of values (e....
Macros for easy insertion into run-time selection tables.
errorManip< error > abort(error &err)
const double e
Elementary charge.
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)
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
virtual bool read(const dictionary &sDoFRBMRCoeff)
Update properties from given dictionary.
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)
vector omega() const
Return the angular velocity in the global frame.
const point & centreOfRotation() const
Return the current centre of rotation.
virtual ~linearAxialAngularSpring()
Destructor.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.
virtual void write(Ostream &) const
Write.