38 void Foam::sixDoFRigidBodyMotion::applyRestraints()
40 if (restraints_.empty())
51 Info<<
"Restraint " << restraints_[rI].name() <<
": ";
64 restraints_[rI].restrain(*
this, rP, rF, rM);
87 initialCentreOfMass_(
Zero),
88 initialCentreOfRotation_(
Zero),
105 motionState_(stateDict),
115 "initialCentreOfMass",
119 initialCentreOfRotation_(initialCentreOfMass_),
124 "initialOrientation",
129 momentOfInertia_(
dict.
lookup(
"momentOfInertia")),
130 aRelax_(
dict.lookupOrDefault<scalar>(
"accelerationRelaxation", 1.0)),
131 aDamp_(
dict.lookupOrDefault<scalar>(
"accelerationDamping", 1.0)),
132 report_(
dict.lookupOrDefault<
Switch>(
"report", false)),
142 vector R(initialCentreOfMass_ - initialCentreOfRotation_);
150 if (!stateDict.
found(
"centreOfRotation"))
157 motionState0_ = motionState_;
166 motionState_(sDoFRBM.motionState_),
167 motionState0_(sDoFRBM.motionState0_),
168 restraints_(sDoFRBM.restraints_),
169 constraints_(sDoFRBM.constraints_),
170 tConstraints_(sDoFRBM.tConstraints_),
171 rConstraints_(sDoFRBM.rConstraints_),
172 initialCentreOfMass_(sDoFRBM.initialCentreOfMass_),
173 initialCentreOfRotation_(sDoFRBM.initialCentreOfRotation_),
174 initialQ_(sDoFRBM.initialQ_),
175 mass_(sDoFRBM.mass_),
176 momentOfInertia_(sDoFRBM.momentOfInertia_),
177 aRelax_(sDoFRBM.aRelax_),
178 aDamp_(sDoFRBM.aDamp_),
179 report_(sDoFRBM.report_)
202 restraints_.setSize(restraintDict.size());
220 restraints_.setSize(i);
236 constraints_.setSize(constraintDict.size());
256 constraints_[i].setCentreOfRotation(initialCentreOfRotation_);
257 constraints_[i].constrainTranslation(pct);
258 constraints_[i].constrainRotation(pcr);
264 constraints_.setSize(i);
269 Info<<
"Translational constraint tensor " << tConstraints_ <<
nl
270 <<
"Rotational constraint tensor " << rConstraints_ <<
endl;
275 void Foam::sixDoFRigidBodyMotion::updateAcceleration
281 static bool first =
true;
289 tau() = (Q().T() & tauGlobal);
295 a() = aRelax_*a() + (1 - aRelax_)*aPrevIter;
296 tau() = aRelax_*
tau() + (1 - aRelax_)*tauPrevIter;
316 solver_->solve(firstIter, fGlobal, tauGlobal, deltaT, deltaT0);
330 Info<<
"6-DoF rigid body motion" <<
nl
331 <<
" Centre of rotation: " << centreOfRotation() <<
nl
332 <<
" Centre of mass: " << centreOfMass() <<
nl
333 <<
" Orientation: " << orientation() <<
nl
334 <<
" Linear velocity: " << v() <<
nl
335 <<
" Angular velocity: " <<
omega()
348 + (Q() & initialQ_.T() & (initialPoints - 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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
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.
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.
virtual ~sixDoFRigidBodyMotion()
Destructor.
point transform(const point &initialPoint) const
Transform the given initial state point by the current motion.
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.
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static const Identity< scalar > I
vector point
Point is a vector.
labelList first(const UList< labelPair > &p)
tmp< DimensionedField< typename outerProduct< Type, Type >::type, GeoMesh, Field >> sqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Vector< scalar > vector
A scalar version of the templated Vector.
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
static scalar R(const scalar a, const scalar x)
tmp< DimensionedField< scalar, GeoMesh, Field > > magSqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)