mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
sixDoFRigidBodyMotion/restraints: rationalise reporting
This commit is contained in:
@ -11,6 +11,8 @@ $(restraints)/linearAxialAngularSpring/linearAxialAngularSpring.C
|
|||||||
$(restraints)/linearSpring/linearSpring.C
|
$(restraints)/linearSpring/linearSpring.C
|
||||||
$(restraints)/sphericalAngularSpring/sphericalAngularSpring.C
|
$(restraints)/sphericalAngularSpring/sphericalAngularSpring.C
|
||||||
$(restraints)/tabulatedAxialAngularSpring/tabulatedAxialAngularSpring.C
|
$(restraints)/tabulatedAxialAngularSpring/tabulatedAxialAngularSpring.C
|
||||||
|
$(restraints)/linearDamper/linearDamper.C
|
||||||
|
$(restraints)/sphericalAngularDamper/sphericalAngularDamper.C
|
||||||
|
|
||||||
constraints = sixDoFRigidBodyMotion/constraints
|
constraints = sixDoFRigidBodyMotion/constraints
|
||||||
|
|
||||||
|
|||||||
@ -135,7 +135,6 @@ Foam::sixDoFRigidBodyMotionRestraints::linearAxialAngularSpring::restrain
|
|||||||
if (motion.report())
|
if (motion.report())
|
||||||
{
|
{
|
||||||
Info<< " angle " << theta*sign(a & axis_)
|
Info<< " angle " << theta*sign(a & axis_)
|
||||||
<< " force " << restraintForce
|
|
||||||
<< " moment " << restraintMoment
|
<< " moment " << restraintMoment
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
@ -190,7 +189,6 @@ bool Foam::sixDoFRigidBodyMotionRestraints::linearAxialAngularSpring::read
|
|||||||
}
|
}
|
||||||
|
|
||||||
sDoFRBMRCoeffs_.lookup("stiffness") >> stiffness_;
|
sDoFRBMRCoeffs_.lookup("stiffness") >> stiffness_;
|
||||||
|
|
||||||
sDoFRBMRCoeffs_.lookup("damping") >> damping_;
|
sDoFRBMRCoeffs_.lookup("damping") >> damping_;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -85,8 +85,6 @@ void Foam::sixDoFRigidBodyMotionRestraints::linearSpring::restrain
|
|||||||
vector r = restraintPosition - anchor_;
|
vector r = restraintPosition - anchor_;
|
||||||
|
|
||||||
scalar magR = mag(r);
|
scalar magR = mag(r);
|
||||||
|
|
||||||
// r is now the r unit vector
|
|
||||||
r /= (magR + VSMALL);
|
r /= (magR + VSMALL);
|
||||||
|
|
||||||
vector v = motion.currentVelocity(restraintPosition);
|
vector v = motion.currentVelocity(restraintPosition);
|
||||||
@ -100,7 +98,6 @@ void Foam::sixDoFRigidBodyMotionRestraints::linearSpring::restrain
|
|||||||
Info<< " attachmentPt - anchor " << r*magR
|
Info<< " attachmentPt - anchor " << r*magR
|
||||||
<< " spring length " << magR
|
<< " spring length " << magR
|
||||||
<< " force " << restraintForce
|
<< " force " << restraintForce
|
||||||
<< " moment " << restraintMoment
|
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,13 +111,9 @@ bool Foam::sixDoFRigidBodyMotionRestraints::linearSpring::read
|
|||||||
sixDoFRigidBodyMotionRestraint::read(sDoFRBMRDict);
|
sixDoFRigidBodyMotionRestraint::read(sDoFRBMRDict);
|
||||||
|
|
||||||
sDoFRBMRCoeffs_.lookup("anchor") >> anchor_;
|
sDoFRBMRCoeffs_.lookup("anchor") >> anchor_;
|
||||||
|
|
||||||
sDoFRBMRCoeffs_.lookup("refAttachmentPt") >> refAttachmentPt_;
|
sDoFRBMRCoeffs_.lookup("refAttachmentPt") >> refAttachmentPt_;
|
||||||
|
|
||||||
sDoFRBMRCoeffs_.lookup("stiffness") >> stiffness_;
|
sDoFRBMRCoeffs_.lookup("stiffness") >> stiffness_;
|
||||||
|
|
||||||
sDoFRBMRCoeffs_.lookup("damping") >> damping_;
|
sDoFRBMRCoeffs_.lookup("damping") >> damping_;
|
||||||
|
|
||||||
sDoFRBMRCoeffs_.lookup("restLength") >> restLength_;
|
sDoFRBMRCoeffs_.lookup("restLength") >> restLength_;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -72,8 +72,7 @@ Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularSpring::
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void
|
void Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularSpring::restrain
|
||||||
Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularSpring::restrain
|
|
||||||
(
|
(
|
||||||
const sixDoFRigidBodyMotion& motion,
|
const sixDoFRigidBodyMotion& motion,
|
||||||
vector& restraintPosition,
|
vector& restraintPosition,
|
||||||
@ -86,19 +85,15 @@ Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularSpring::restrain
|
|||||||
for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
|
for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
|
||||||
{
|
{
|
||||||
vector axis = vector::zero;
|
vector axis = vector::zero;
|
||||||
|
|
||||||
axis[cmpt] = 1;
|
axis[cmpt] = 1;
|
||||||
|
|
||||||
vector refDir = vector::zero;
|
vector refDir = vector::zero;
|
||||||
|
|
||||||
refDir[(cmpt + 1) % 3] = 1;
|
refDir[(cmpt + 1) % 3] = 1;
|
||||||
|
|
||||||
vector newDir = motion.orientation() & refDir;
|
vector newDir = motion.orientation() & refDir;
|
||||||
|
|
||||||
axis = (refQ_ & axis);
|
axis = (refQ_ & axis);
|
||||||
|
|
||||||
refDir = (refQ_ & refDir);
|
refDir = (refQ_ & refDir);
|
||||||
|
|
||||||
newDir -= (axis & newDir)*axis;
|
newDir -= (axis & newDir)*axis;
|
||||||
|
|
||||||
restraintMoment += -stiffness_*(refDir ^ newDir);
|
restraintMoment += -stiffness_*(refDir ^ newDir);
|
||||||
@ -114,8 +109,7 @@ Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularSpring::restrain
|
|||||||
|
|
||||||
if (motion.report())
|
if (motion.report())
|
||||||
{
|
{
|
||||||
Info<< " force " << restraintForce
|
Info<< " moment " << restraintMoment
|
||||||
<< " moment " << restraintMoment
|
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -147,7 +141,6 @@ bool Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularSpring::read
|
|||||||
}
|
}
|
||||||
|
|
||||||
sDoFRBMRCoeffs_.lookup("stiffness") >> stiffness_;
|
sDoFRBMRCoeffs_.lookup("stiffness") >> stiffness_;
|
||||||
|
|
||||||
sDoFRBMRCoeffs_.lookup("damping") >> damping_;
|
sDoFRBMRCoeffs_.lookup("damping") >> damping_;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -136,7 +136,6 @@ Foam::sixDoFRigidBodyMotionRestraints::tabulatedAxialAngularSpring::restrain
|
|||||||
if (motion.report())
|
if (motion.report())
|
||||||
{
|
{
|
||||||
Info<< " angle " << theta
|
Info<< " angle " << theta
|
||||||
<< " force " << restraintForce
|
|
||||||
<< " moment " << restraintMoment
|
<< " moment " << restraintMoment
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -174,9 +174,6 @@ class sixDoFRigidBodyMotion
|
|||||||
//- Return access to the orientation
|
//- Return access to the orientation
|
||||||
inline const tensor& Q() const;
|
inline const tensor& Q() const;
|
||||||
|
|
||||||
//- Return access to velocity
|
|
||||||
inline const vector& v() const;
|
|
||||||
|
|
||||||
//- Return access to acceleration
|
//- Return access to acceleration
|
||||||
inline const vector& a() const;
|
inline const vector& a() const;
|
||||||
|
|
||||||
@ -356,8 +353,7 @@ public:
|
|||||||
//- Return the angular velocity in the global frame
|
//- Return the angular velocity in the global frame
|
||||||
inline vector omega() const;
|
inline vector omega() const;
|
||||||
|
|
||||||
//- Return the velocity of a position given by the current
|
//- Return the velocity of a position
|
||||||
// motion state
|
|
||||||
inline point currentVelocity(const point& pt) const;
|
inline point currentVelocity(const point& pt) const;
|
||||||
|
|
||||||
//- Report the status of the motion
|
//- Report the status of the motion
|
||||||
@ -384,6 +380,9 @@ public:
|
|||||||
//- Return the report Switch
|
//- Return the report Switch
|
||||||
inline bool report() const;
|
inline bool report() const;
|
||||||
|
|
||||||
|
//- Return access to velocity
|
||||||
|
inline const vector& v() const;
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user