86 restraintMoment =
Zero;
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) = "
151 os.writeEntry(
"referenceOrientation", refQ_);
152 os.writeEntry(
"stiffness", stiffness_);
153 os.writeEntry(
"damping", damping_);
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static constexpr direction nComponents
Number of components in this vector space.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Base class for defining restraints for sixDoF motions.
sixDoFRigidBodyMotionRestraint(const word &name, const dictionary &sDoFRBMRDict)
Construct from the sDoFRBMRDict dictionary and Time.
const word & name() const
Return the name.
virtual bool read(const dictionary &sDoFRBMRDict)
Update properties from given dictionary.
dictionary sDoFRBMRCoeffs_
Restraint model specific coefficient dictionary.
sixDoFRigidBodyMotionRestraints model. Spherical angular spring.
virtual void write(Ostream &) const
Write.
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.
virtual ~sphericalAngularSpring()
Destructor.
virtual bool read(const dictionary &sDoFRBMRCoeff)
Update properties from given dictionary.
Six degree of freedom motion for a rigid body.
bool report() const
Return the report Switch.
const tensor & orientation() const
Return the orientation tensor, Q.
vector omega() const
Return the angular velocity in the global frame.
const point & centreOfRotation() const
Return the current centre of rotation.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
Namespace for six DoF motion restraints.
messageStream Info
Information stream (stdout output on master, null elsewhere).
static const Identity< scalar > I
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).