35void Foam::RBD::rigidBodyMotion::initialize()
48Foam::RBD::rigidBodyMotion::rigidBodyMotion(
const Time& time)
59Foam::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)),
85 g() = dict.get<vector>(
"g");
92Foam::RBD::rigidBodyMotion::rigidBodyMotion
100 motionState_(*this, stateDict),
101 motionState0_(motionState_),
107 "accelerationRelaxation",
113 aDamp_(
dict.getOrDefault<scalar>(
"accelerationDamping", 1)),
114 report_(
dict.getOrDefault<
Switch>(
"report", false)),
119 g() = dict.get<vector>(
"g");
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);
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()
242 auto&
points = tpoints.ref();
246 points[i] = X.transformPoint(initialPoints[i]);
269 auto&
points = tpoints.ref();
274 if (weight[i] > SMALL)
277 if (weight[i] > 1 - SMALL)
286 .transformPoint(initialPoints[i]);
298 const List<const scalarField*>& weights,
302 List<septernion> ss(bodyIDs.size() + 1);
307 const label bodyID = bodyIDs[bi];
311 spatialTransform X(
X0(bodyID).
inv() & X00(bodyID));
314 ss[bi] = septernion(X);
318 auto&
points = tpoints.ref();
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;
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Holds the motion state of rigid-body model.
Basic rigid-body model representing a system of rigid-bodies connected by 1-6 DoF joints.
DynamicList< spatialTransform > X0_
Transform for external forces to the bodies reference frame.
const spatialVector & v(const label i) const
Return the spatial velocity of the bodies.
const Time & time() const
Return the time.
const subBody & mergedBody(label mergedBodyID) const
Return the merged body for the given body ID.
void forwardDynamicsCorrection(const rigidBodyModelState &state) const
Correct the velocity and acceleration of the bodies in the model.
rigidBodyModel(const Time &time)
Null-constructor which adds the single root-body at the origin.
label bodyID(const word &name) const
Return the ID of the body with the given name.
const DynamicList< label > & lambda() const
List of indices of the parent of each body.
void forwardDynamics(rigidBodyModelState &state, const scalarField &tau, const Field< spatialVector > &fx) const
Calculate the joint acceleration qDdot from the joint state q,.
bool merged(label bodyID) const
Return true if the body with given ID has been merged with a parent.
spatialTransform X00(const label bodyId) const
Return the initial transform to the global frame for the.
tmp< pointField > transformPoints(const label bodyID, const pointField &initialPoints) const
Transform the given initial pointField of the specified body.
const vector vCofR(const label bodyID) const
Report linear velocity of the given body.
~rigidBodyMotion()
Destructor.
const rigidBodyModelState & state() const
Return the motion state.
void status(const label bodyID) const
Report the status of the motion of the given body.
void forwardDynamics(rigidBodyModelState &state, const scalarField &tau, const Field< spatialVector > &fx) const
Calculate and optionally relax the joint acceleration qDdot from.
void solve(const scalar t, const scalar deltaT, const scalarField &tau, const Field< spatialVector > &fx)
Integrate velocities, orientation and position.
friend class rigidBodySolver
const vector cCofR(const label bodyID) const
Report CofR of the given body.
const spatialTransform & masterXT() const
Return the transform with respect to the master body.
label masterID() const
Return the master body Id.
Vector< Cmpt > l() const
Return the linear part of the spatial vector as a vector.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
void size(const label n)
Older name for setAddressableSize.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
@ broadcast
broadcast [MPI]
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Septernion class used to perform translations and rotations in 3D space.
static const septernion I
A class for managing temporary objects.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
A class for handling words, derived from Foam::string.
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))
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
SpatialVector< scalar > spatialVector
SpatialVector of scalars.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static constexpr const zero Zero
Global zero (0).
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
vectorField pointField
pointField is a vectorField.
quaternion slerp(const quaternion &qa, const quaternion &qb, const scalar t)
Spherical linear interpolation of quaternions.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &f1, const label comm)
constexpr char nl
The newline '\n' character (0x0a).
scalarList X0(nSpecie, Zero)
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
#define forAll(list, i)
Loop across all elements in list.