mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
rigidBodyModelState: Added time value member
The absolute value of the the time has been added to the rigid body model state. This value is not directly necessary for calculating the evolution of the rigid body system, it just facilitates the implementation of sub-models which are in some way time-dependent.
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
|
||||
@ -75,7 +75,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (label i=0; i<nIter; i++)
|
||||
{
|
||||
pendulumAndSpring.solve(deltaT, tau, fx);
|
||||
pendulumAndSpring.solve(t + deltaT, deltaT, tau, fx);
|
||||
}
|
||||
|
||||
// Write the results for graph generation
|
||||
|
||||
@ -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
|
||||
@ -80,7 +80,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (label i=0; i<nIter; i++)
|
||||
{
|
||||
sphericalJoint.solve(deltaT, tau, fx);
|
||||
sphericalJoint.solve(t + deltaT, deltaT, tau, fx);
|
||||
}
|
||||
|
||||
// Write the results for graph generation
|
||||
|
||||
@ -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
|
||||
@ -71,7 +71,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (label i=0; i<nIter; i++)
|
||||
{
|
||||
spring.solve(deltaT, tau, fx);
|
||||
spring.solve(t + deltaT, deltaT, tau, fx);
|
||||
}
|
||||
|
||||
// Write the results for graph generation
|
||||
|
||||
@ -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