From e3b8fadcc5505ce5b7e4ed5ae1f28b2f9c659a7b Mon Sep 17 00:00:00 2001 From: Henry <Henry> Date: Mon, 16 Dec 2013 11:51:09 +0000 Subject: [PATCH] uncoupledSixDoFRigidBodyDisplacement: Corrected for PMIPLE --- ...gidBodyDisplacementPointPatchVectorField.C | 6 ++--- ...gidBodyDisplacementPointPatchVectorField.C | 22 ++++++++++++++----- ...gidBodyDisplacementPointPatchVectorField.H | 3 +++ 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/sixDoFRigidBodyMotion/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C b/src/sixDoFRigidBodyMotion/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C index 559b3cc1752..3a6db808399 100644 --- a/src/sixDoFRigidBodyMotion/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C +++ b/src/sixDoFRigidBodyMotion/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C @@ -204,10 +204,10 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs() const pointPatch& ptPatch = this->patch(); // Store the motion state at the beginning of the time-step - if (curTimeIndex_ != this->db().time().timeIndex()) + if (curTimeIndex_ != t.timeIndex()) { motion_.newTime(); - curTimeIndex_ = this->db().time().timeIndex(); + curTimeIndex_ = t.timeIndex(); } // Patch force data is valid for the current positions, so @@ -238,7 +238,7 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs() g_ = g.value(); } - // scalar ramp = min(max((this->db().time().value() - 5)/10, 0), 1); + // scalar ramp = min(max((t.value() - 5)/10, 0), 1); scalar ramp = 1.0; motion_.updateAcceleration diff --git a/src/sixDoFRigidBodyMotion/pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.C b/src/sixDoFRigidBodyMotion/pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.C index aaae3592221..bb66a5fb14b 100644 --- a/src/sixDoFRigidBodyMotion/pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.C +++ b/src/sixDoFRigidBodyMotion/pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.C @@ -47,7 +47,8 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField : fixedValuePointPatchField<vector>(p, iF), motion_(), - initialPoints_(p.localPoints()) + initialPoints_(p.localPoints()), + curTimeIndex_(-1) {} @@ -60,7 +61,8 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField ) : fixedValuePointPatchField<vector>(p, iF, dict), - motion_(dict, dict) + motion_(dict, dict), + curTimeIndex_(-1) { if (!dict.found("value")) { @@ -89,7 +91,8 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField : fixedValuePointPatchField<vector>(ptf, p, iF, mapper), motion_(ptf.motion_), - initialPoints_(ptf.initialPoints_, mapper) + initialPoints_(ptf.initialPoints_, mapper), + curTimeIndex_(-1) {} @@ -102,7 +105,8 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField : fixedValuePointPatchField<vector>(ptf, iF), motion_(ptf.motion_), - initialPoints_(ptf.initialPoints_) + initialPoints_(ptf.initialPoints_), + curTimeIndex_(-1) {} @@ -147,6 +151,13 @@ void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs() const polyMesh& mesh = this->dimensionedInternalField().mesh()(); const Time& t = mesh.time(); + // Store the motion state at the beginning of the time-step + if (curTimeIndex_ != t.timeIndex()) + { + motion_.newTime(); + curTimeIndex_ = t.timeIndex(); + } + motion_.updatePosition(t.deltaTValue(), t.deltaT0Value()); vector gravity = vector::zero; @@ -163,7 +174,8 @@ void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs() motion_.updateAcceleration ( gravity*motion_.mass(), - vector::zero, t.deltaTValue() + vector::zero, + t.deltaTValue() ); Field<vector>::operator= diff --git a/src/sixDoFRigidBodyMotion/pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.H b/src/sixDoFRigidBodyMotion/pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.H index 3ffaf25bb52..bd7538ad712 100644 --- a/src/sixDoFRigidBodyMotion/pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.H +++ b/src/sixDoFRigidBodyMotion/pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.H @@ -59,6 +59,9 @@ class uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField //- Initial positions of points on the patch pointField initialPoints_; + //- Current time index (used for updating) + label curTimeIndex_; + public: -- GitLab