diff --git a/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionRestraint/tabulatedAxialAngularSpring/tabulatedAxialAngularSpring.C b/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionRestraint/tabulatedAxialAngularSpring/tabulatedAxialAngularSpring.C index 571ae7030d..c1609e9df3 100644 --- a/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionRestraint/tabulatedAxialAngularSpring/tabulatedAxialAngularSpring.C +++ b/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionRestraint/tabulatedAxialAngularSpring/tabulatedAxialAngularSpring.C @@ -58,7 +58,7 @@ tabulatedAxialAngularSpring sixDoFRigidBodyMotionRestraint(sDoFRBMRDict), refQ_(), axis_(), - stiffness_(), + moment_(), convertToDegrees_(), damping_() { @@ -110,36 +110,23 @@ Foam::sixDoFRigidBodyMotionRestraints::tabulatedAxialAngularSpring::restrain scalar theta = mag(acos(min(oldDir & newDir, 1.0))); - // Temporary axis with sign information. - vector a = (oldDir ^ newDir); + // Determining the sign of theta by comparing the cross product of + // the direction vectors with the axis + theta *= sign((oldDir ^ newDir) & axis_); - // Remove any component that is not along axis that may creep in - a = (a & axis_)*axis_; - - scalar magA = mag(a); - - if (magA > VSMALL) - { - a /= magA; - } - else - { - a = vector::zero; - } - - scalar stiffness; + scalar moment; if (convertToDegrees_) { - stiffness = stiffness_(radToDeg(theta)); + moment = moment_(radToDeg(theta)); } else { - stiffness = stiffness_(theta); + moment = moment_(theta); } // Damping of along axis angular velocity only - restraintMoment = -stiffness*theta*a - damping_*(motion.omega() & a)*a; + restraintMoment = moment*axis_ - damping_*(motion.omega() & axis_)*axis_; restraintForce = vector::zero; @@ -196,7 +183,7 @@ bool Foam::sixDoFRigidBodyMotionRestraints::tabulatedAxialAngularSpring::read << abort(FatalError); } - stiffness_ = interpolationTable(sDoFRBMRCoeffs_); + moment_ = interpolationTable(sDoFRBMRCoeffs_); word angleFormat = sDoFRBMRCoeffs_.lookup("angleFormat"); diff --git a/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionRestraint/tabulatedAxialAngularSpring/tabulatedAxialAngularSpring.H b/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionRestraint/tabulatedAxialAngularSpring/tabulatedAxialAngularSpring.H index 61c2c64197..09cc336e0e 100644 --- a/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionRestraint/tabulatedAxialAngularSpring/tabulatedAxialAngularSpring.H +++ b/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionRestraint/tabulatedAxialAngularSpring/tabulatedAxialAngularSpring.H @@ -26,7 +26,7 @@ Class Foam::sixDoFRigidBodyMotionRestraints::tabulatedAxialAngularSpring Description - sixDoFRigidBodyMotionRestraints model. Axial angular spring with stiffness + sixDoFRigidBodyMotionRestraints model. Axial angular spring with moment values drawn from an interpolation table. Linear damping. SourceFiles @@ -66,13 +66,12 @@ class tabulatedAxialAngularSpring //- Global unit axis around which the motion is sprung vector axis_; - //- Spring stiffness coefficient interpolation table (Nm/rad - // or Nm/deg, depending on angleFormat) - interpolationTable stiffness_; + //- Spring moment interpolation table, depending on angleFormat + interpolationTable moment_; //- Boolean stating whether the angle around the axis needs to // be converted to degrees before asking the - // interpolationTable for a value + // interpolationTable for a moment value bool convertToDegrees_; //- Damping coefficient (Nms/rad)