rigidBodyDynamics: Added support for running in parallel
The joint-space dynamics is solved on the master processor only and the resulting joint-state distributed to the slave processors on which the body-state is then updated. This guarantees consistency of the body position and orientation on all processors.
This commit is contained in:
@ -155,28 +155,26 @@ void Foam::RBD::rigidBodyMotion::solve
|
||||
if (Pstream::master())
|
||||
{
|
||||
solver_->solve(tau, fx);
|
||||
|
||||
if (report_)
|
||||
{
|
||||
status();
|
||||
}
|
||||
}
|
||||
|
||||
Pstream::scatter(motionState_);
|
||||
|
||||
// Update the body-state to correspond to the current joint-state
|
||||
forwardDynamicsCorrection(motionState_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::RBD::rigidBodyMotion::status() const
|
||||
void Foam::RBD::rigidBodyMotion::status(const label bodyID) const
|
||||
{
|
||||
/*
|
||||
Info<< "Rigid body motion" << nl
|
||||
<< " Centre of rotation: " << centreOfRotation() << nl
|
||||
<< " Centre of mass: " << centreOfMass() << nl
|
||||
<< " Orientation: " << orientation() << nl
|
||||
<< " Linear velocity: " << v() << nl
|
||||
<< " Angular velocity: " << omega()
|
||||
const spatialTransform CofR(X0(bodyID));
|
||||
const spatialVector vCofR(v(bodyID, Zero));
|
||||
|
||||
Info<< "Rigid-body motion of the " << name(bodyID) << nl
|
||||
<< " Centre of rotation: " << CofR.r() << nl
|
||||
<< " Orientation: " << CofR.E() << nl
|
||||
<< " Linear velocity: " << vCofR.l() << nl
|
||||
<< " Angular velocity: " << vCofR.w()
|
||||
<< endl;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -177,8 +177,8 @@ public:
|
||||
const Field<spatialVector>& fx
|
||||
);
|
||||
|
||||
//- Report the status of the motion
|
||||
void status() const;
|
||||
//- Report the status of the motion of the given body
|
||||
void status(const label bodyID) const;
|
||||
|
||||
|
||||
// Transformations
|
||||
|
||||
@ -83,9 +83,6 @@ void Foam::RBD::rigidBodySolvers::CrankNicolson::solve
|
||||
q() = q0() + deltaT()*(voc_*qDot() + (1 - voc_)*qDot0());
|
||||
|
||||
correctQuaternionJoints();
|
||||
|
||||
// Update the body-state
|
||||
model_.forwardDynamicsCorrection(state());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -93,9 +93,6 @@ void Foam::RBD::rigidBodySolvers::Newmark::solve
|
||||
+ sqr(deltaT())*(beta_*qDdot() + (0.5 - beta_)*qDdot0());
|
||||
|
||||
correctQuaternionJoints();
|
||||
|
||||
// Update the body-state
|
||||
model_.forwardDynamicsCorrection(state());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -270,6 +270,13 @@ void Foam::rigidBodyMeshMotion::solve()
|
||||
);
|
||||
}
|
||||
|
||||
if (Pstream::master() && model_.report())
|
||||
{
|
||||
forAll(bodyMeshes_, bi)
|
||||
{
|
||||
model_.status(bodyMeshes_[bi].bodyID_);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the displacements
|
||||
if (bodyMeshes_.size() == 1)
|
||||
|
||||
Reference in New Issue
Block a user