diff --git a/applications/test/rigidBodyDynamics/pendulumAndSpring/pendulumAndSpring.C b/applications/test/rigidBodyDynamics/pendulumAndSpring/pendulumAndSpring.C index 94e151f69..b775b59bb 100644 --- a/applications/test/rigidBodyDynamics/pendulumAndSpring/pendulumAndSpring.C +++ b/applications/test/rigidBodyDynamics/pendulumAndSpring/pendulumAndSpring.C @@ -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("t", -1)), deltaT_(dict.lookupOrDefault("deltaT", 0)) {} diff --git a/src/rigidBodyDynamics/rigidBodyModelState/rigidBodyModelState.H b/src/rigidBodyDynamics/rigidBodyModelState/rigidBodyModelState.H index 6b10ac355..5bbc71624 100644 --- a/src/rigidBodyDynamics/rigidBodyModelState/rigidBodyModelState.H +++ b/src/rigidBodyDynamics/rigidBodyModelState/rigidBodyModelState.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 @@ -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(); diff --git a/src/rigidBodyDynamics/rigidBodyModelState/rigidBodyModelStateI.H b/src/rigidBodyDynamics/rigidBodyModelState/rigidBodyModelStateI.H index e3fb2678f..b14946dae 100644 --- a/src/rigidBodyDynamics/rigidBodyModelState/rigidBodyModelStateI.H +++ b/src/rigidBodyDynamics/rigidBodyModelState/rigidBodyModelStateI.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 @@ -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_; +} + + // ************************************************************************* // diff --git a/src/rigidBodyDynamics/rigidBodyModelState/rigidBodyModelStateIO.C b/src/rigidBodyDynamics/rigidBodyModelState/rigidBodyModelStateIO.C index c17819b41..fb9ab3197 100644 --- a/src/rigidBodyDynamics/rigidBodyModelState/rigidBodyModelStateIO.C +++ b/src/rigidBodyDynamics/rigidBodyModelState/rigidBodyModelStateIO.C @@ -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 diff --git a/src/rigidBodyDynamics/rigidBodyMotion/rigidBodyMotion.C b/src/rigidBodyDynamics/rigidBodyMotion/rigidBodyMotion.C index 6cf2514c0..841286729 100644 --- a/src/rigidBodyDynamics/rigidBodyMotion/rigidBodyMotion.C +++ b/src/rigidBodyDynamics/rigidBodyMotion/rigidBodyMotion.C @@ -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& fx ) { + motionState_.t() = t; motionState_.deltaT() = deltaT; if (motionState0_.deltaT() < SMALL) { + motionState0_.t() = t; motionState0_.deltaT() = deltaT; } diff --git a/src/rigidBodyDynamics/rigidBodyMotion/rigidBodyMotion.H b/src/rigidBodyDynamics/rigidBodyMotion/rigidBodyMotion.H index d065d9797..d3fc11647 100644 --- a/src/rigidBodyDynamics/rigidBodyMotion/rigidBodyMotion.H +++ b/src/rigidBodyDynamics/rigidBodyMotion/rigidBodyMotion.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 @@ -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& fx ); diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C b/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C index 3676f8dea..7ccaa928c 100644 --- a/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C +++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C @@ -259,6 +259,7 @@ void Foam::rigidBodyMeshMotion::solve() { model_.solve ( + t.value(), t.deltaTValue(), scalarField(model_.nDoF(), Zero), Field(model_.nBodies(), Zero) @@ -288,6 +289,7 @@ void Foam::rigidBodyMeshMotion::solve() model_.solve ( + t.value(), t.deltaTValue(), scalarField(model_.nDoF(), Zero), fx diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C b/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C index 6434e69fb..70b4acbdc 100644 --- a/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C +++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C @@ -207,6 +207,7 @@ void Foam::rigidBodyMeshMotionSolver::solve() { model_.solve ( + t.value(), t.deltaTValue(), scalarField(model_.nDoF(), Zero), Field(model_.nBodies(), Zero) @@ -236,6 +237,7 @@ void Foam::rigidBodyMeshMotionSolver::solve() model_.solve ( + t.value(), t.deltaTValue(), scalarField(model_.nDoF(), Zero), fx