32 void Foam::sixDoFRigidBodyMotion::applyRestraints()
34 if (restraints_.empty())
45 Info<<
"Restraint " << restraints_[rI].name() <<
": ";
58 restraints_[rI].restrain(*
this, rP, rF, rM);
81 initialCentreOfMass_(
Zero),
82 initialCentreOfRotation_(
Zero),
99 motionState_(stateDict),
109 "initialCentreOfMass",
113 initialCentreOfRotation_(initialCentreOfMass_),
118 "initialOrientation",
123 momentOfInertia_(dict.
lookup(
"momentOfInertia")),
136 vector R(initialCentreOfMass_ - initialCentreOfRotation_);
144 if (!stateDict.
found(
"centreOfRotation"))
151 motionState0_ = motionState_;
160 motionState_(sDoFRBM.motionState_),
161 motionState0_(sDoFRBM.motionState0_),
162 restraints_(sDoFRBM.restraints_),
163 constraints_(sDoFRBM.constraints_),
164 tConstraints_(sDoFRBM.tConstraints_),
165 rConstraints_(sDoFRBM.rConstraints_),
166 initialCentreOfMass_(sDoFRBM.initialCentreOfMass_),
167 initialCentreOfRotation_(sDoFRBM.initialCentreOfRotation_),
168 initialQ_(sDoFRBM.initialQ_),
169 mass_(sDoFRBM.mass_),
170 momentOfInertia_(sDoFRBM.momentOfInertia_),
171 aRelax_(sDoFRBM.aRelax_),
172 aDamp_(sDoFRBM.aDamp_),
173 report_(sDoFRBM.report_)
190 if (dict.
found(
"restraints"))
196 restraints_.setSize(restraintDict.size());
214 restraints_.setSize(i);
224 if (dict.
found(
"constraints"))
230 constraints_.setSize(constraintDict.size());
250 constraints_[i].setCentreOfRotation(initialCentreOfRotation_);
251 constraints_[i].constrainTranslation(pct);
252 constraints_[i].constrainRotation(pcr);
258 constraints_.setSize(i);
263 Info<<
"Translational constraint tensor " << tConstraints_ <<
nl 264 <<
"Rotational constraint tensor " << rConstraints_ <<
endl;
269 void Foam::sixDoFRigidBodyMotion::updateAcceleration
275 static bool first =
true;
279 vector tauPrevIter = tau();
283 tau() = (Q().
T() & tauGlobal);
289 a() = aRelax_*a() + (1 - aRelax_)*aPrevIter;
290 tau() = aRelax_*tau() + (1 - aRelax_)*tauPrevIter;
310 solver_->solve(firstIter, fGlobal, tauGlobal, deltaT, deltaT0);
324 Info<<
"6-DoF rigid body motion" <<
nl 328 <<
" Linear velocity: " << v() <<
nl 329 <<
" Angular velocity: " <<
omega()
342 + (Q() & initialQ_.
T() & (initialPoints - initialCentreOfRotation_))
366 if (scale[pointi] > small)
369 if (scale[pointi] > 1 - small)
371 points[pointi] =
transform(initialPoints[pointi]);
379 initialCentreOfRotation()
382 initialPoints[pointi]
383 - initialCentreOfRotation()
Six degree of freedom motion for a rigid body.
Template class for intrusive linked lists.
~sixDoFRigidBodyMotion()
Destructor.
void addConstraints(const dictionary &dict)
Add restraints to the motion, public to allow external.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A list of keyword definitions, which are a keyword followed by any number of values (e...
point centreOfMass() const
Return the current centre of mass.
const point & centreOfRotation() const
Return the current centre of rotation.
T & ref() const
Return non-const reference or generate a fatal error.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Tensor< Cmpt > T() const
Return transpose.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none.
static bool master(const label communicator=0)
Am I the master process.
point transform(const point &initialPoints) const
Transform the given initial state point by the current motion.
Vector< scalar > vector
A scalar version of the templated Vector.
Septernion class used to perform translations and rotations in 3D space.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
vectorField pointField
pointField is a vectorField.
const point & centreOfRotation() const
Return access to the centre of mass.
static const Identity< scalar > I
vector omega() const
Return the angular velocity in the global frame.
sixDoFRigidBodyMotion()
Construct null.
const tensor & orientation() const
Return the orientation tensor, Q.
Quaternion class used to perform rotations in 3D space.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
static const septernion I
void status() const
Report the status of the motion.
Accumulates point constraints through successive applications of the applyConstraint function...
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
tensor constraintTransformation() const
Return the accumulated constraint transformation tensor.
vector invTransformPoint(const vector &v) const
Inverse Transform the given coordinate point.
static autoPtr< sixDoFRigidBodyMotionRestraint > New(const word &name, const dictionary &sDoFRBMRDict)
Select constructed from the sDoFRBMRDict dictionary and Time.
vector point
Point is a vector.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
#define R(A, B, C, D, E, F, K, M)
quaternion slerp(const quaternion &qa, const quaternion &qb, const scalar t)
Spherical linear interpolation of quaternions.
static autoPtr< sixDoFRigidBodyMotionConstraint > New(const word &name, const dictionary &sDoFRBMCDict, const sixDoFRigidBodyMotion &motion)
Select constructed from the sDoFRBMCDict dictionary and Time.
A class for managing temporary objects.
static autoPtr< sixDoFSolver > New(const dictionary &dict, sixDoFRigidBodyMotion &body)
void update(bool firstIter, const vector &fGlobal, const vector &tauGlobal, scalar deltaT, scalar deltaT0)
Symplectic integration of velocities, orientation and position.
void addRestraints(const dictionary &dict)
Add restraints to the motion, public to allow external.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
A class representing the concept of 1 (scalar(1)) used to avoid unnecessary manipulations for objects...