Go to the documentation of this file.
35 void Foam::sixDoFRigidBodyMotion::applyRestraints()
37 if (restraints_.empty())
48 Info<<
"Restraint " << restraints_[rI].name() <<
": ";
61 restraints_[rI].restrain(*
this, rP, rF, rM);
85 initialCentreOfMass_(
Zero),
86 initialCentreOfRotation_(
Zero),
105 motionState_(stateDict),
115 "initialCentreOfMass",
119 initialCentreOfRotation_(initialCentreOfMass_),
124 "initialOrientation",
128 mass_(
dict.
get<scalar>(
"mass")),
139 addConstraints(
dict);
142 vector R(initialCentreOfMass_ - initialCentreOfRotation_);
150 if (!stateDict.
found(
"centreOfRotation"))
152 motionState_.centreOfRotation() = initialCentreOfRotation_;
157 motionState0_ = motionState_;
166 time_(sDoFRBM.time_),
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_),
181 solver_(sDoFRBM.solver_.clone())
204 restraints_.setSize(restraintDict.size());
206 for (
const entry& dEntry : restraintDict)
222 restraints_.setSize(i);
238 constraints_.setSize(constraintDict.size());
243 for (
const entry& dEntry : constraintDict)
258 constraints_[i].setCentreOfRotation(initialCentreOfRotation_);
259 constraints_[i].constrainTranslation(pct);
260 constraints_[i].constrainRotation(pcr);
266 constraints_.setSize(i);
271 Info<<
"Translational constraint tensor " << tConstraints_ <<
nl
272 <<
"Rotational constraint tensor " << rConstraints_ <<
endl;
277 void Foam::sixDoFRigidBodyMotion::updateAcceleration
283 static bool first =
true;
287 vector tauPrevIter = tau();
291 tau() = (Q().T() & tauGlobal);
297 a() = aRelax_*a() + (1 - aRelax_)*aPrevIter;
298 tau() = aRelax_*tau() + (1 - aRelax_)*tauPrevIter;
318 solver_->solve(firstIter, fGlobal, tauGlobal, deltaT, deltaT0);
332 Info<<
"6-DoF rigid body motion" <<
nl
333 <<
" Centre of rotation: " << centreOfRotation() <<
nl
334 <<
" Centre of mass: " << centreOfMass() <<
nl
335 <<
" Orientation: " << orientation() <<
nl
336 <<
" Linear velocity: " << v() <<
nl
337 <<
" Angular velocity: " << omega()
350 + (Q() & initialQ_.T() & (initialPoints - initialCentreOfRotation_))
364 centreOfRotation() - initialCentreOfRotation(),
374 if (scale[pointi] > SMALL)
377 if (scale[pointi] > 1 - SMALL)
387 initialCentreOfRotation()
390 initialPoints[pointi]
391 - initialCentreOfRotation()
A keyword and a list of tokens is an 'entry'.
vectorField pointField
pointField is a vectorField.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Septernion class used to perform translations and rotations in 3D space.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
quaternion slerp(const quaternion &qa, const quaternion &qb, const scalar t)
Spherical linear interpolation of quaternions.
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
static autoPtr< sixDoFSolver > New(const dictionary &dict, sixDoFRigidBodyMotion &body)
Accumulates point constraints through successive applications of the applyConstraint function.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
static bool master(const label communicator=worldComm)
Am I the master process.
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
~sixDoFRigidBodyMotion()
Destructor.
Ostream & endl(Ostream &os)
Add newline and flush stream.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
void addRestraints(const dictionary &dict)
Add restraints to the motion, public to allow external.
sixDoFRigidBodyMotion(const Time &)
Construct null.
#define forAll(list, i)
Loop across all elements in list.
Quaternion class used to perform rotations in 3D space.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
static autoPtr< sixDoFRigidBodyMotionConstraint > New(const word &name, const dictionary &sDoFRBMCDict, const sixDoFRigidBodyMotion &motion)
Select constructed from the sDoFRBMCDict dictionary and Time.
void update(bool firstIter, const vector &fGlobal, const vector &tauGlobal, scalar deltaT, scalar deltaT0)
Symplectic integration of velocities, orientation and position.
#define R(A, B, C, D, E, F, K, M)
const point & centreOfRotation() const
Return the current centre of rotation.
void addConstraints(const dictionary &dict)
Add restraints to the motion, public to allow external.
messageStream Info
Information stream (stdout output on master, null elsewhere)
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Vector< scalar > vector
A scalar version of the templated Vector.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Six degree of freedom motion for a rigid body.
point transform(const point &initialPoints) const
Transform the given initial state point by the current motion.
Tensor< Cmpt > T() const
Return non-Hermitian transpose.
static const septernion I
tensor constraintTransformation() const
Return the accumulated constraint transformation tensor.
vector invTransformPoint(const vector &v) const
Inverse Transform the given coordinate point.
vector point
Point is a vector.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
void status() const
Report the status of the motion.
static autoPtr< sixDoFRigidBodyMotionRestraint > New(const word &name, const dictionary &sDoFRBMRDict)
Select constructed from the sDoFRBMRDict dictionary and Time.
static const Identity< scalar > I