Commit 0f3e4160 authored by graham's avatar graham
Browse files

BUG: sixDoFRigidBodyMotion. tabulatedAxialAngularSpring is now

tabulated with moment vs angle, not stiffness vs angle.
parent 9f23282e
......@@ -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<scalar>(sDoFRBMRCoeffs_);
moment_ = interpolationTable<scalar>(sDoFRBMRCoeffs_);
word angleFormat = sDoFRBMRCoeffs_.lookup("angleFormat");
......
......@@ -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<scalar> stiffness_;
//- Spring moment interpolation table, depending on angleFormat
interpolationTable<scalar> 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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment