39 void Foam::sixDoFRigidBodyMotion::applyRestraints()
41 if (restraints_.empty())
52 Info<<
"Restraint " << restraints_[rI].name() <<
": ";
65 restraints_[rI].restrain(*
this, rP, rF, rM);
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")),
131 aRelax_(
dict.lookupOrDefault<scalar>(
"accelerationRelaxation", 1.0)),
132 aDamp_(
dict.lookupOrDefault<scalar>(
"accelerationDamping", 1.0)),
133 report_(
dict.lookupOrDefault<
Switch>(
"report", false)),
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_)
203 restraints_.setSize(restraintDict.size());
221 restraints_.setSize(i);
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
332 <<
" Centre of rotation: " << centreOfRotation() <<
nl
333 <<
" Centre of mass: " << centreOfMass() <<
nl
334 <<
" Orientation: " << orientation() <<
nl
335 <<
" Linear velocity: " << v() <<
nl
336 <<
" Angular velocity: " <<
omega()
349 + (Q() & initialQ_.T() & (initialPoints - initialCentreOfRotation_))
363 centreOfRotation() - initialCentreOfRotation(),
373 if (scale[pointi] > small)
376 if (scale[pointi] > 1 - small)
386 initialCentreOfRotation()
389 initialPoints[pointi]
390 - initialCentreOfRotation()
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Template class for intrusive linked lists.
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Tensor< Cmpt > T() const
Return transpose.
static bool master(const label communicator=0)
Am I the master process.
A list of keyword definitions, which are a keyword followed by any number of values (e....
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
A class representing the concept of 1 (scalar(1)) used to avoid unnecessary manipulations for objects...
Accumulates point constraints through successive applications of the applyConstraint function.
tensor constraintTransformation() const
Return the accumulated constraint transformation tensor.
Quaternion class used to perform rotations in 3D space.
Septernion class used to perform translations and rotations in 3D space.
vector invTransformPoint(const vector &v) const
Inverse Transform the given coordinate point.
static const septernion I
static autoPtr< sixDoFRigidBodyMotionConstraint > New(const word &name, const dictionary &sDoFRBMCDict, const sixDoFRigidBodyMotion &motion)
Select constructed from the sDoFRBMCDict dictionary and Time.
static autoPtr< sixDoFRigidBodyMotionRestraint > New(const word &name, const dictionary &sDoFRBMRDict)
Select constructed from the sDoFRBMRDict dictionary and Time.
const point & centreOfRotation() const
Return access to the centre of mass.
Six degree of freedom motion for a rigid body.
void update(bool firstIter, const vector &fGlobal, const vector &tauGlobal, scalar deltaT, scalar deltaT0)
Symplectic integration of velocities, orientation and position.
void status() const
Report the status of the motion.
void addConstraints(const dictionary &dict)
Add restraints to the motion, public to allow external.
point transform(const point &initialPoints) const
Transform the given initial state point by the current motion.
virtual ~sixDoFRigidBodyMotion()
Destructor.
void addRestraints(const dictionary &dict)
Add restraints to the motion, public to allow external.
const point & centreOfRotation() const
Return the current centre of rotation.
sixDoFRigidBodyMotion()
Construct null.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
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.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
vectorField pointField
pointField is a vectorField.
static const Identity< scalar > I
vector point
Point is a vector.
labelList first(const UList< labelPair > &p)
Vector< scalar > vector
A scalar version of the templated Vector.
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
dimensionSet transform(const dimensionSet &)
defineTypeNameAndDebug(combustionModel, 0)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
static scalar R(const scalar a, const scalar x)
quaternion slerp(const quaternion &qa, const quaternion &qb, const scalar t)
Spherical linear interpolation of quaternions.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensioned< scalar > magSqr(const dimensioned< Type > &)