39 void Foam::sixDoFRigidBodyMotion::applyRestraints()
41 if (restraints_.empty())
52 Info<<
"Restraint " << restraints_[rI].name() <<
": ";
65 restraints_[rI].restrain(*
this, rP, rF, rM);
72 tau() += Q().T() & (rM + ((rP - centreOfRotation()) ^ rF));
88 initialCentreOfMass_(
Zero),
89 initialCentreOfRotation_(
Zero),
106 motionState_(stateDict),
116 "initialCentreOfMass",
120 initialCentreOfRotation_(initialCentreOfMass_),
125 "initialOrientation",
129 mass_(dict.
lookup<scalar>(
"mass")),
130 momentOfInertia_(dict.
lookup(
"momentOfInertia")),
143 vector R(initialCentreOfMass_ - initialCentreOfRotation_);
151 if (!stateDict.
found(
"centreOfRotation"))
158 motionState0_ = motionState_;
167 motionState_(sDoFRBM.motionState_),
168 motionState0_(sDoFRBM.motionState0_),
169 restraints_(sDoFRBM.restraints_),
170 constraints_(sDoFRBM.constraints_),
171 tConstraints_(sDoFRBM.tConstraints_),
172 rConstraints_(sDoFRBM.rConstraints_),
173 initialCentreOfMass_(sDoFRBM.initialCentreOfMass_),
174 initialCentreOfRotation_(sDoFRBM.initialCentreOfRotation_),
175 initialQ_(sDoFRBM.initialQ_),
176 mass_(sDoFRBM.mass_),
177 momentOfInertia_(sDoFRBM.momentOfInertia_),
178 aRelax_(sDoFRBM.aRelax_),
179 aDamp_(sDoFRBM.aDamp_),
180 report_(sDoFRBM.report_)
197 if (dict.
found(
"restraints"))
203 restraints_.setSize(restraintDict.size());
221 restraints_.setSize(i);
231 if (dict.
found(
"constraints"))
237 constraints_.setSize(constraintDict.size());
257 constraints_[i].setCentreOfRotation(initialCentreOfRotation_);
258 constraints_[i].constrainTranslation(pct);
259 constraints_[i].constrainRotation(pcr);
265 constraints_.setSize(i);
270 Info<<
"Translational constraint tensor " << tConstraints_ <<
nl 271 <<
"Rotational constraint tensor " << rConstraints_ <<
endl;
276 void Foam::sixDoFRigidBodyMotion::updateAcceleration
282 static bool first =
true;
286 vector tauPrevIter = tau();
290 tau() = (Q().
T() & tauGlobal);
296 a() = aRelax_*a() + (1 - aRelax_)*aPrevIter;
297 tau() = aRelax_*tau() + (1 - aRelax_)*tauPrevIter;
317 solver_->solve(firstIter, fGlobal, tauGlobal, deltaT, deltaT0);
331 Info<<
"6-DoF rigid body motion" <<
nl 335 <<
" Linear velocity: " << v() <<
nl 336 <<
" Angular velocity: " <<
omega()
349 + (Q() & initialQ_.
T() & (initialPoints - initialCentreOfRotation_))
373 if (scale[pointi] > small)
376 if (scale[pointi] > 1 - small)
378 points[pointi] =
transform(initialPoints[pointi]);
386 initialCentreOfRotation()
389 initialPoints[pointi]
390 - initialCentreOfRotation()
Six degree of freedom motion for a rigid body.
Template class for intrusive linked lists.
virtual ~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/any.
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.
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 > &)
defineTypeNameAndDebug(combustionModel, 0)
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...