RBD: restraints: Corrected restraint force transformations
From commit d4c479cb6447dbfd920bbe3e0204b70a1d5fbb03 in OpenFOAM-dev The restraints generate either joint-local (tau) or global (fx) forces. At the moment they all generate the latter. This change corrects three of the four restraints so that the forces are in the gobal coordinate system and not the local coordinate system of the body. The problem with this is that the forward dynamics code then transforms most of the forces back to the body local coordinate system. A better solution would be to associate restraints which are more sensibly defined in a local frame with the joints instead of the bodies, and return the forces as part of the tau variable.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -40,8 +40,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef RBD_joints_composite_H
|
||||
#define RBD_joints_composite_H
|
||||
#ifndef compositeJoint_H
|
||||
#define compositeJoint_H
|
||||
|
||||
#include "joint.H"
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -40,8 +40,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef RBD_joints_floating_H
|
||||
#define RBD_joints_floating_H
|
||||
#ifndef floatingJoint_H
|
||||
#define floatingJoint_H
|
||||
|
||||
#include "compositeJoint.H"
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -40,8 +40,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef RBD_joints_null_H
|
||||
#define RBD_joints_null_H
|
||||
#ifndef nullJoint_H
|
||||
#define nullJoint_H
|
||||
|
||||
#include "joint.H"
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -133,7 +133,7 @@ void Foam::RBD::restraints::linearAxialAngularSpring::restrain
|
||||
}
|
||||
|
||||
// Accumulate the force for the restrained body
|
||||
fx[bodyIndex_] += spatialVector(moment, Zero);
|
||||
fx[bodyIndex_] += model_.X0(bodyID_).T() & spatialVector(moment, Zero);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -85,7 +85,7 @@ void Foam::RBD::restraints::linearDamper::restrain
|
||||
}
|
||||
|
||||
// Accumulate the force for the restrained body
|
||||
fx[bodyIndex_] += spatialVector(Zero, force);
|
||||
fx[bodyIndex_] += model_.X0(bodyID_).T() & spatialVector(Zero, force);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -85,7 +85,7 @@ void Foam::RBD::restraints::sphericalAngularDamper::restrain
|
||||
}
|
||||
|
||||
// Accumulate the force for the restrained body
|
||||
fx[bodyIndex_] += spatialVector(moment, Zero);
|
||||
fx[bodyIndex_] += model_.X0(bodyID_).T() & spatialVector(moment, Zero);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,6 +35,7 @@ Foam::RBD::rigidBodyModelState::rigidBodyModelState
|
||||
q_(model.nDoF(), Zero),
|
||||
qDot_(model.nDoF(), Zero),
|
||||
qDdot_(model.nDoF(), Zero),
|
||||
t_(-1),
|
||||
deltaT_(0)
|
||||
{}
|
||||
|
||||
@ -48,6 +49,7 @@ Foam::RBD::rigidBodyModelState::rigidBodyModelState
|
||||
q_(dict.lookupOrDefault("q", scalarField(model.nDoF(), Zero))),
|
||||
qDot_(dict.lookupOrDefault("qDot", scalarField(model.nDoF(), Zero))),
|
||||
qDdot_(dict.lookupOrDefault("qDdot", scalarField(model.nDoF(), Zero))),
|
||||
t_(dict.lookupOrDefault<scalar>("t", -1)),
|
||||
deltaT_(dict.lookupOrDefault<scalar>("deltaT", 0))
|
||||
{}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -76,6 +76,9 @@ class rigidBodyModelState
|
||||
//- Joint acceleration
|
||||
scalarField qDdot_;
|
||||
|
||||
//- The time
|
||||
scalar t_;
|
||||
|
||||
//- The time-step used to integrate to this state
|
||||
scalar deltaT_;
|
||||
|
||||
@ -102,14 +105,15 @@ public:
|
||||
//- Return access to the joint position and orientation
|
||||
inline const scalarField& q() const;
|
||||
|
||||
//- Return access to the joint quaternion
|
||||
|
||||
//- Return access to the joint velocity
|
||||
inline const scalarField& qDot() const;
|
||||
|
||||
//- Return access to the joint acceleration
|
||||
inline const scalarField& qDdot() const;
|
||||
|
||||
//- Return access to the time
|
||||
inline scalar t() const;
|
||||
|
||||
//- Return access to the time-step
|
||||
inline scalar deltaT() const;
|
||||
|
||||
@ -119,14 +123,15 @@ public:
|
||||
//- Return access to the joint position and orientation
|
||||
inline scalarField& q();
|
||||
|
||||
//- Return access to the joint quaternion
|
||||
|
||||
//- Return access to the joint velocity
|
||||
inline scalarField& qDot();
|
||||
|
||||
//- Return access to the joint acceleration
|
||||
inline scalarField& qDdot();
|
||||
|
||||
//- Return access to the time
|
||||
inline scalar& t();
|
||||
|
||||
//- Return access to the time-step
|
||||
inline scalar& deltaT();
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,6 +43,12 @@ inline const Foam::scalarField& Foam::RBD::rigidBodyModelState::qDdot() const
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::RBD::rigidBodyModelState::t() const
|
||||
{
|
||||
return t_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::RBD::rigidBodyModelState::deltaT() const
|
||||
{
|
||||
return deltaT_;
|
||||
@ -73,4 +79,10 @@ inline Foam::scalar& Foam::RBD::rigidBodyModelState::deltaT()
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar& Foam::RBD::rigidBodyModelState::t()
|
||||
{
|
||||
return t_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -33,6 +33,7 @@ void Foam::RBD::rigidBodyModelState::write(dictionary& dict) const
|
||||
dict.add("q", q_);
|
||||
dict.add("qDot", qDot_);
|
||||
dict.add("qDdot", qDdot_);
|
||||
dict.add("t", t_);
|
||||
dict.add("deltaT", deltaT_);
|
||||
}
|
||||
|
||||
@ -42,6 +43,7 @@ void Foam::RBD::rigidBodyModelState::write(Ostream& os) const
|
||||
os.writeKeyword("q") << q_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("qDot") << qDot_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("qDdot") << qDdot_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("t") << t_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("deltaT") << deltaT_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
@ -57,6 +59,7 @@ Foam::Istream& Foam::RBD::operator>>
|
||||
is >> state.q_
|
||||
>> state.qDot_
|
||||
>> state.qDdot_
|
||||
>> state.t_
|
||||
>> state.deltaT_;
|
||||
|
||||
// Check state of Istream
|
||||
@ -79,6 +82,7 @@ Foam::Ostream& Foam::RBD::operator<<
|
||||
os << state.q_
|
||||
<< token::SPACE << state.qDot_
|
||||
<< token::SPACE << state.qDdot_
|
||||
<< token::SPACE << state.t_
|
||||
<< token::SPACE << state.deltaT_;
|
||||
|
||||
// Check state of Ostream
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -140,15 +140,18 @@ void Foam::RBD::rigidBodyMotion::forwardDynamics
|
||||
|
||||
void Foam::RBD::rigidBodyMotion::solve
|
||||
(
|
||||
scalar deltaT,
|
||||
const scalar t,
|
||||
const scalar deltaT,
|
||||
const scalarField& tau,
|
||||
const Field<spatialVector>& fx
|
||||
)
|
||||
{
|
||||
motionState_.t() = t;
|
||||
motionState_.deltaT() = deltaT;
|
||||
|
||||
if (motionState0_.deltaT() < SMALL)
|
||||
{
|
||||
motionState0_.t() = t;
|
||||
motionState0_.deltaT() = deltaT;
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -169,10 +169,11 @@ public:
|
||||
) const;
|
||||
|
||||
//- Integrate velocities, orientation and position
|
||||
// for the given time-step
|
||||
// for the given time and time-step
|
||||
void solve
|
||||
(
|
||||
scalar deltaT,
|
||||
const scalar t,
|
||||
const scalar deltaT,
|
||||
const scalarField& tau,
|
||||
const Field<spatialVector>& fx
|
||||
);
|
||||
|
||||
@ -259,6 +259,7 @@ void Foam::rigidBodyMeshMotion::solve()
|
||||
{
|
||||
model_.solve
|
||||
(
|
||||
t.value(),
|
||||
t.deltaTValue(),
|
||||
scalarField(model_.nDoF(), Zero),
|
||||
Field<spatialVector>(model_.nBodies(), Zero)
|
||||
@ -288,6 +289,7 @@ void Foam::rigidBodyMeshMotion::solve()
|
||||
|
||||
model_.solve
|
||||
(
|
||||
t.value(),
|
||||
t.deltaTValue(),
|
||||
scalarField(model_.nDoF(), Zero),
|
||||
fx
|
||||
|
||||
@ -207,6 +207,7 @@ void Foam::rigidBodyMeshMotionSolver::solve()
|
||||
{
|
||||
model_.solve
|
||||
(
|
||||
t.value(),
|
||||
t.deltaTValue(),
|
||||
scalarField(model_.nDoF(), Zero),
|
||||
Field<spatialVector>(model_.nBodies(), Zero)
|
||||
@ -236,6 +237,7 @@ void Foam::rigidBodyMeshMotionSolver::solve()
|
||||
|
||||
model_.solve
|
||||
(
|
||||
t.value(),
|
||||
t.deltaTValue(),
|
||||
scalarField(model_.nDoF(), Zero),
|
||||
fx
|
||||
|
||||
Reference in New Issue
Block a user