Go to the documentation of this file.
36 namespace sixDoFRigidBodyMotionRestraints
42 sixDoFRigidBodyMotionRestraint,
43 tabulatedAxialAngularSpring,
90 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)));
114 theta *=
sign((oldDir ^ newDir) & axis_);
118 if (convertToDegrees_)
124 moment = moment_(theta);
128 restraintMoment = moment*axis_ - damping_*(motion.
omega() & axis_)*axis_;
138 Info<<
" angle " << theta
139 <<
" moment " << restraintMoment
152 refQ_ = sDoFRBMRCoeffs_.lookupOrDefault<
tensor>(
"referenceOrientation",
I);
157 <<
"referenceOrientation " << refQ_ <<
" is not a rotation tensor. "
158 <<
"mag(referenceOrientation) - sqrt(3) = "
163 axis_ = sDoFRBMRCoeffs_.lookup(
"axis");
165 scalar magAxis(
mag(axis_));
167 if (magAxis > VSMALL)
174 <<
"axis has zero length"
180 const word angleFormat = sDoFRBMRCoeffs_.lookup(
"angleFormat");
182 if (angleFormat ==
"degrees" || angleFormat ==
"degree")
184 convertToDegrees_ =
true;
186 else if (angleFormat ==
"radians" || angleFormat ==
"radian")
188 convertToDegrees_ =
false;
193 <<
"angleFormat must be degree, degrees, radian or radians"
197 sDoFRBMRCoeffs_.lookup(
"damping") >> damping_;
218 if (convertToDegrees_)
virtual bool read(const dictionary &sDoFRBMRDict)
Update properties from given dictionary.
virtual void write(Ostream &) const
Write.
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 &)
virtual ~tabulatedAxialAngularSpring()
Destructor.
Unit conversion functions.
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.
scalar radToDeg(const scalar rad)
Conversion from radians to degrees.
bool report() const
Return the report Switch.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
tensor rotationTensor(const vector &n1, const vector &n2)
virtual bool read(const dictionary &sDoFRBMRCoeff)
Update properties from given dictionary.
vector omega() const
Return the angular velocity in the global frame.
const point & centreOfRotation() const
Return the current centre of rotation.
virtual void restrain(const sixDoFRigidBodyMotion &motion, vector &restraintPosition, vector &restraintForce, vector &restraintMoment) const
Calculate the restraint position, force and moment.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.
tabulatedAxialAngularSpring(const word &name, const dictionary &sDoFRBMRDict)
Construct from components.