36 namespace sixDoFRigidBodyMotionRestraints
41 sixDoFRigidBodyMotionRestraint,
42 tabulatedAxialAngularSpring,
88 vector oldDir = refQ_ & refDir;
92 if (
mag(oldDir & axis_) > 0.95 ||
mag(newDir & axis_) > 0.95)
98 vector oldDir = refQ_ & refDir;
104 oldDir -= (axis_ & oldDir)*axis_;
105 oldDir /= (
mag(oldDir) + VSMALL);
107 newDir -= (axis_ & newDir)*axis_;
108 newDir /= (
mag(newDir) + VSMALL);
110 scalar theta =
mag(
acos(
min(oldDir & newDir, 1.0)));
114 theta *=
sign((oldDir ^ newDir) & axis_);
118 if (convertToDegrees_)
124 moment = moment_(theta);
128 restraintMoment = moment*axis_ - damping_*(motion.
omega() & axis_)*axis_;
138 Info<<
" angle " << theta
139 <<
" force " << restraintForce
140 <<
" moment " << restraintMoment
153 refQ_ = sDoFRBMRCoeffs_.lookupOrDefault<
tensor>(
"referenceOrientation",
I);
159 "Foam::sixDoFRigidBodyMotionRestraints::"
160 "tabulatedAxialAngularSpring::read"
162 "const dictionary& sDoFRBMRDict"
165 <<
"referenceOrientation " << refQ_ <<
" is not a rotation tensor. "
166 <<
"mag(referenceOrientation) - sqrt(3) = "
171 axis_ = sDoFRBMRCoeffs_.lookup(
"axis");
173 scalar magAxis(
mag(axis_));
175 if (magAxis > VSMALL)
183 "Foam::sixDoFRigidBodyMotionRestraints::"
184 "tabulatedAxialAngularSpring::read"
186 "const dictionary& sDoFRBMCDict"
189 <<
"axis has zero length"
195 word angleFormat = sDoFRBMRCoeffs_.lookup(
"angleFormat");
197 if (angleFormat ==
"degrees" || angleFormat ==
"degree")
199 convertToDegrees_ =
true;
201 else if (angleFormat ==
"radians" || angleFormat ==
"radian")
203 convertToDegrees_ =
false;
209 "Foam::sixDoFRigidBodyMotionRestraints::"
210 "tabulatedAxialAngularSpring::read"
212 "const dictionary& sDoFRBMCDict"
215 <<
"angleFormat must be degree, degrees, radian or radians"
219 sDoFRBMRCoeffs_.lookup(
"damping") >> damping_;
240 if (convertToDegrees_)