35 void Foam::RBD::rigidBodyMotion::initialize()
48 Foam::RBD::rigidBodyMotion::rigidBodyMotion(
const Time& time)
59 Foam::RBD::rigidBodyMotion::rigidBodyMotion
66 motionState_(*this,
dict),
67 motionState0_(motionState_),
73 "accelerationRelaxation",
79 aDamp_(
dict.getOrDefault<scalar>(
"accelerationDamping", 1)),
80 report_(
dict.getOrDefault<
Switch>(
"report", false)),
92 Foam::RBD::rigidBodyMotion::rigidBodyMotion
99 rigidBodyModel(time,
dict),
100 motionState_(*this, stateDict),
101 motionState0_(motionState_),
107 "accelerationRelaxation",
113 aDamp_(
dict.getOrDefault<scalar>(
"accelerationDamping", 1)),
114 report_(
dict.getOrDefault<
Switch>(
"report", false)),
115 solver_(rigidBodySolver::
New(*this,
dict.subDict(
"solver")))
141 const subBody& mBody = mergedBody(bodyId);
153 rigidBodyModelState& state,
164 aRelax = aRelax_->value(motionState_.t());
167 state.qDdot() = aDamp_*(aRelax*state.qDdot() + (1 - aRelax)*qDdotPrev);
179 motionState_.t() = t;
180 motionState_.deltaT() = deltaT;
182 if (motionState0_.deltaT() < SMALL)
184 motionState0_.t() = t;
185 motionState0_.deltaT() = deltaT;
190 solver_->solve(tau, fx);
196 forwardDynamicsCorrection(motionState_);
205 Info<<
"Rigid-body motion of the " <<
name(bodyID) <<
nl 206 <<
" Centre of rotation: " << CofR.r() <<
nl 207 <<
" Orientation: " << CofR.E() <<
nl 208 <<
" Linear velocity: " << vCofR.l() <<
nl 209 <<
" Angular velocity: " << vCofR.w()
274 if (weight[i] > SMALL)
277 if (weight[i] > 1 - SMALL)
286 .transformPoint(initialPoints[i]);
307 const label bodyID = bodyIDs[bi];
317 tmp<pointField> tpoints(
new pointField(initialPoints));
320 List<scalar> w(ss.
size());
329 w[bi] = (*(weights[bi]))[i];
330 sum1mw += w[bi]/(1 + SMALL - w[bi]);
340 w[bi] =
lambda*w[bi]/(1 + SMALL - w[bi]);
345 w[bodyIDs.
size()] = 1 - sumw;
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
void size(const label n)
Older name for setAddressableSize.
DynamicList< spatialTransform > X0_
Transform for external forces to the bodies reference frame.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
void forwardDynamicsCorrection(const rigidBodyModelState &state) const
Correct the velocity and acceleration of the bodies in the model.
tmp< pointField > transformPoints(const label bodyID, const pointField &initialPoints) const
Transform the given initial pointField of the specified body.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
void status(const label bodyID) const
Report the status of the motion of the given body.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, any/none. Also accepts 0/1 as a string and shortcuts t/f, y/n.
spatialTransform X00(const label bodyId) const
Return the initial transform to the global frame for the.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
Septernion class used to perform translations and rotations in 3D space.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static void broadcast(Type &value, const label comm=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all processes in communicator.
#define forAll(list, i)
Loop across all elements in list.
vectorField pointField
pointField is a vectorField.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
A class for handling words, derived from Foam::string.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
static const septernion I
Vector< Cmpt > l() const
Return the linear part of the spatial vector as a vector.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
void solve(const scalar t, const scalar deltaT, const scalarField &tau, const Field< spatialVector > &fx)
Integrate velocities, orientation and position.
const vector vCofR(const label bodyID) const
Report linear velocity of the given body.
label masterID() const
Return the master body Id.
const vector & g() const
Return the acceleration due to gravity.
scalarList X0(nSpecie, Zero)
quaternion slerp(const quaternion &qa, const quaternion &qb, const scalar t)
Spherical linear interpolation of quaternions.
static bool master(const label communicator=worldComm)
Am I the master rank.
const vector cCofR(const label bodyID) const
Report CofR of the given body.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Basic rigid-body model representing a system of rigid-bodies connected by 1-6 DoF joints...
A class for managing temporary objects.
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))
~rigidBodyMotion()
Destructor.
void forwardDynamics(rigidBodyModelState &state, const scalarField &tau, const Field< spatialVector > &fx) const
Calculate the joint acceleration qDdot from the joint state q,.
void forwardDynamics(rigidBodyModelState &state, const scalarField &tau, const Field< spatialVector > &fx) const
Calculate and optionally relax the joint acceleration qDdot from.
const spatialTransform & masterXT() const
Return the transform with respect to the master body.
static constexpr const zero Zero
Global zero (0)