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:
Henry Weller
2016-04-19 10:32:25 +01:00
parent 30a46904e5
commit ccbb0b93c6
5 changed files with 21 additions and 22 deletions

View File

@ -155,28 +155,26 @@ void Foam::RBD::rigidBodyMotion::solve
if (Pstream::master()) if (Pstream::master())
{ {
solver_->solve(tau, fx); solver_->solve(tau, fx);
if (report_)
{
status();
}
} }
Pstream::scatter(motionState_); 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
{ {
/* const spatialTransform CofR(X0(bodyID));
Info<< "Rigid body motion" << nl const spatialVector vCofR(v(bodyID, Zero));
<< " Centre of rotation: " << centreOfRotation() << nl
<< " Centre of mass: " << centreOfMass() << nl Info<< "Rigid-body motion of the " << name(bodyID) << nl
<< " Orientation: " << orientation() << nl << " Centre of rotation: " << CofR.r() << nl
<< " Linear velocity: " << v() << nl << " Orientation: " << CofR.E() << nl
<< " Angular velocity: " << omega() << " Linear velocity: " << vCofR.l() << nl
<< " Angular velocity: " << vCofR.w()
<< endl; << endl;
*/
} }

View File

@ -177,8 +177,8 @@ public:
const Field<spatialVector>& fx const Field<spatialVector>& fx
); );
//- Report the status of the motion //- Report the status of the motion of the given body
void status() const; void status(const label bodyID) const;
// Transformations // Transformations

View File

@ -83,9 +83,6 @@ void Foam::RBD::rigidBodySolvers::CrankNicolson::solve
q() = q0() + deltaT()*(voc_*qDot() + (1 - voc_)*qDot0()); q() = q0() + deltaT()*(voc_*qDot() + (1 - voc_)*qDot0());
correctQuaternionJoints(); correctQuaternionJoints();
// Update the body-state
model_.forwardDynamicsCorrection(state());
} }

View File

@ -93,9 +93,6 @@ void Foam::RBD::rigidBodySolvers::Newmark::solve
+ sqr(deltaT())*(beta_*qDdot() + (0.5 - beta_)*qDdot0()); + sqr(deltaT())*(beta_*qDdot() + (0.5 - beta_)*qDdot0());
correctQuaternionJoints(); correctQuaternionJoints();
// Update the body-state
model_.forwardDynamicsCorrection(state());
} }

View File

@ -270,6 +270,13 @@ void Foam::rigidBodyMeshMotion::solve()
); );
} }
if (Pstream::master() && model_.report())
{
forAll(bodyMeshes_, bi)
{
model_.status(bodyMeshes_[bi].bodyID_);
}
}
// Update the displacements // Update the displacements
if (bodyMeshes_.size() == 1) if (bodyMeshes_.size() == 1)