37 namespace sixDoFRigidBodyMotionRestraints
43 sixDoFRigidBodyMotionRestraint,
44 sphericalAngularSpring,
86 restraintMoment =
Zero;
88 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
94 refDir[(cmpt + 1) % 3] = 1;
98 axis = (refQ_ & axis);
99 refDir = (refQ_ & refDir);
100 newDir -= (axis & newDir)*axis;
102 restraintMoment += -stiffness_*(refDir ^ newDir);
105 restraintMoment += -damping_*motion.
omega();
107 restraintForce =
Zero;
115 Info<<
" moment " << restraintMoment
128 refQ_ = sDoFRBMRCoeffs_.getOrDefault<
tensor>(
"referenceOrientation",
I);
133 <<
"referenceOrientation " << refQ_ <<
" is not a rotation tensor. " 134 <<
"mag(referenceOrientation) - sqrt(3) = " 139 sDoFRBMRCoeffs_.readEntry(
"stiffness", stiffness_);
140 sDoFRBMRCoeffs_.readEntry(
"damping", damping_);
151 os.writeEntry(
"referenceOrientation", refQ_);
152 os.writeEntry(
"stiffness", stiffness_);
153 os.writeEntry(
"damping", damping_);
Six degree of freedom motion for a rigid body.
bool report() const
Return the report Switch.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual void write(Ostream &) const
Write.
const point & centreOfRotation() const
Return the current centre of rotation.
constexpr char nl
The newline '\n' character (0x0a)
Base class for defining restraints for sixDoF motions.
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Macros for easy insertion into run-time selection tables.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
virtual bool read(const dictionary &sDoFRBMRCoeff)
Update properties from given dictionary.
static const Identity< scalar > I
vector omega() const
Return the angular velocity in the global frame.
A class for handling words, derived from Foam::string.
virtual bool read(const dictionary &sDoFRBMRDict)
Update properties from given dictionary.
defineTypeNameAndDebug(linearAxialAngularSpring, 0)
const tensor & orientation() const
Return the orientation tensor, Q.
virtual ~sphericalAngularSpring()
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)
sphericalAngularSpring(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.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Tensor of scalars, i.e. Tensor<scalar>.
static constexpr const zero Zero
Global zero (0)