diff --git a/src/rigidBodyDynamics/rigidBodyModel/rigidBodyModel.C b/src/rigidBodyDynamics/rigidBodyModel/rigidBodyModel.C index 07a1975082..c29efdb7ea 100644 --- a/src/rigidBodyDynamics/rigidBodyModel/rigidBodyModel.C +++ b/src/rigidBodyDynamics/rigidBodyModel/rigidBodyModel.C @@ -384,25 +384,6 @@ Foam::spatialTransform Foam::RBD::rigidBodyModel::X0 } -Foam::wordList Foam::RBD::rigidBodyModel::movingBodyNames() const -{ - wordList names(nBodies()); - - label j = 0; - for (label i=1; i(bodies_[i])) - { - names[j++] = bodies_[i].name(); - } - } - - names.setSize(j); - - return names; -} - - void Foam::RBD::rigidBodyModel::write(Ostream& os) const { os << indent << "bodies" << nl diff --git a/src/rigidBodyDynamics/rigidBodyModel/rigidBodyModel.H b/src/rigidBodyDynamics/rigidBodyModel/rigidBodyModel.H index ac36c7e765..7a749d9f41 100644 --- a/src/rigidBodyDynamics/rigidBodyModel/rigidBodyModel.H +++ b/src/rigidBodyDynamics/rigidBodyModel/rigidBodyModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -252,9 +252,6 @@ public: //- Return the name of body with the given ID inline const word& name(const label bodyID) const; - //- Return the names of the moving bodies - wordList movingBodyNames() const; - //- Return the inertia of body i inline const rigidBodyInertia& I(const label i) const; diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C b/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C index 43690cfcc8..db91877a0c 100644 --- a/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C +++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -88,7 +88,7 @@ Foam::rigidBodyMeshMotion::rigidBodyMeshMotion ) : displacementMotionSolver(mesh, dict, typeName), - RBD::rigidBodyMotion + model_ ( coeffDict(), IOobject @@ -141,7 +141,7 @@ Foam::rigidBodyMeshMotion::rigidBodyMeshMotion if (bodyDict.found("patches")) { - const label bodyID = this->bodyID(iter().keyword()); + const label bodyID = model_.bodyID(iter().keyword()); if (bodyID == -1) { @@ -239,7 +239,7 @@ void Foam::rigidBodyMeshMotion::solve() // Store the motion state at the beginning of the time-step if (curTimeIndex_ != this->db().time().timeIndex()) { - newTime(); + model_.newTime(); curTimeIndex_ = this->db().time().timeIndex(); } @@ -247,7 +247,7 @@ void Foam::rigidBodyMeshMotion::solve() if (db().foundObject("g")) { - g() = + model_.g() = ramp*db().lookupObject("g").value(); } @@ -257,18 +257,18 @@ void Foam::rigidBodyMeshMotion::solve() for (label i=0; i(nBodies(), Zero) + scalarField(model_.nDoF(), Zero), + Field(model_.nBodies(), Zero) ); } } else { - Field fx(nBodies(), Zero); + Field fx(model_.nBodies(), Zero); forAll(bodyMeshes_, bi) { @@ -287,27 +287,27 @@ void Foam::rigidBodyMeshMotion::solve() fx[bodyID] = ramp*spatialVector(f.momentEff(), f.forceEff()); } - RBD::rigidBodyMotion::solve + model_.solve ( t.value(), t.deltaTValue(), - scalarField(nDoF(), Zero), + scalarField(model_.nDoF(), Zero), fx ); } - if (Pstream::master() && report()) + if (Pstream::master() && model_.report()) { forAll(bodyMeshes_, bi) { - status(bodyMeshes_[bi].bodyID_); + model_.status(bodyMeshes_[bi].bodyID_); } } // Update the displacements if (bodyMeshes_.size() == 1) { - pointDisplacement_.primitiveFieldRef() = transformPoints + pointDisplacement_.primitiveFieldRef() = model_.transformPoints ( bodyMeshes_[0].bodyID_, bodyMeshes_[0].weight_, @@ -325,7 +325,7 @@ void Foam::rigidBodyMeshMotion::solve() } pointDisplacement_.primitiveFieldRef() = - transformPoints(bodyIDs, weights, points0()) - points0(); + model_.transformPoints(bodyIDs, weights, points0()) - points0(); } // Displacement has changed. Update boundary conditions @@ -358,7 +358,7 @@ bool Foam::rigidBodyMeshMotion::writeObject ) ); - state().write(dict); + model_.state().write(dict); return dict.regIOobject::write(); } @@ -367,7 +367,7 @@ bool Foam::rigidBodyMeshMotion::read() { if (displacementMotionSolver::read()) { - RBD::rigidBodyMotion::read(coeffDict()); + model_.read(coeffDict()); return true; } diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.H b/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.H index a8ab033551..62b463c785 100644 --- a/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.H +++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotion/rigidBodyMeshMotion.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,8 +53,7 @@ namespace Foam class rigidBodyMeshMotion : - public displacementMotionSolver, - public RBD::rigidBodyMotion + public displacementMotionSolver { //- Class containing the patches and point motion weighting for each body class bodyMesh @@ -98,6 +97,9 @@ class rigidBodyMeshMotion // Private data + //- Rigid-body model + RBD::rigidBodyMotion model_; + //- List of the bodyMeshes containing the patches and point motion // weighting for each body PtrList bodyMeshes_; diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C b/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C index 6019a2f96f..40399fd2bc 100644 --- a/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C +++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -71,7 +71,7 @@ Foam::rigidBodyMeshMotionSolver::rigidBodyMeshMotionSolver ) : motionSolver(mesh, dict, typeName), - RBD::rigidBodyMotion + model_ ( coeffDict(), IOobject @@ -132,7 +132,7 @@ Foam::rigidBodyMeshMotionSolver::rigidBodyMeshMotionSolver if (bodyDict.found("patches")) { - const label bodyID = this->bodyID(iter().keyword()); + const label bodyID = model_.bodyID(iter().keyword()); if (bodyID == -1) { @@ -189,13 +189,13 @@ void Foam::rigidBodyMeshMotionSolver::solve() // Store the motion state at the beginning of the time-step if (curTimeIndex_ != this->db().time().timeIndex()) { - newTime(); + model_.newTime(); curTimeIndex_ = this->db().time().timeIndex(); } if (db().foundObject("g")) { - g() = + model_.g() = db().lookupObject("g").value(); } @@ -205,18 +205,18 @@ void Foam::rigidBodyMeshMotionSolver::solve() for (label i=0; i(nBodies(), Zero) + scalarField(model_.nDoF(), Zero), + Field(model_.nBodies(), Zero) ); } } else { - Field fx(nBodies(), Zero); + Field fx(model_.nBodies(), Zero); forAll(bodyMeshes_, bi) { @@ -235,20 +235,20 @@ void Foam::rigidBodyMeshMotionSolver::solve() fx[bodyID] = spatialVector(f.momentEff(), f.forceEff()); } - RBD::rigidBodyMotion::solve + model_.solve ( t.value(), t.deltaTValue(), - scalarField(nDoF(), Zero), + scalarField(model_.nDoF(), Zero), fx ); } - if (Pstream::master() && report()) + if (Pstream::master() && model_.report()) { forAll(bodyMeshes_, bi) { - status(bodyMeshes_[bi].bodyID_); + model_.status(bodyMeshes_[bi].bodyID_); } } @@ -267,7 +267,7 @@ void Foam::rigidBodyMeshMotionSolver::solve() meshSolver_.pointDisplacement().boundaryFieldRef()[patchi] == ( - transformPoints + model_.transformPoints ( bodyMeshes_[bi].bodyID_, patchPoints0 @@ -302,7 +302,7 @@ bool Foam::rigidBodyMeshMotionSolver::writeObject ) ); - state().write(dict); + model_.state().write(dict); return dict.regIOobject::write(); } @@ -311,7 +311,7 @@ bool Foam::rigidBodyMeshMotionSolver::read() { if (motionSolver::read()) { - RBD::rigidBodyMotion::read(coeffDict()); + model_.read(coeffDict()); return true; } diff --git a/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.H b/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.H index 510c8db80e..1dfbdad589 100644 --- a/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.H +++ b/src/rigidBodyMeshMotion/rigidBodyMeshMotionSolver/rigidBodyMeshMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -52,8 +52,7 @@ namespace Foam class rigidBodyMeshMotionSolver : - public motionSolver, - public RBD::rigidBodyMotion + public motionSolver { //- Class containing the patches and point motion weighting for each body class bodyMesh @@ -87,6 +86,9 @@ class rigidBodyMeshMotionSolver // Private data + //- Rigid-body model + RBD::rigidBodyMotion model_; + //- List of the bodyMeshes containing the patches and point motion // weighting for each body PtrList bodyMeshes_; diff --git a/src/sixDoFRigidBodyState/Make/options b/src/sixDoFRigidBodyState/Make/options index 4e92d1eec1..2d77c5dda4 100644 --- a/src/sixDoFRigidBodyState/Make/options +++ b/src/sixDoFRigidBodyState/Make/options @@ -2,8 +2,10 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ - -I$(LIB_SRC)/sixDoFRigidBodyMotion/lnInclude + -I$(LIB_SRC)/sixDoFRigidBodyMotion/lnInclude \ + -I$(LIB_SRC)/OpenFOAM/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude LIB_LIBS = \ -lfiniteVolume \ - -ldynamicFvMesh + -lmeshTools diff --git a/src/sixDoFRigidBodyState/sixDoFRigidBodyState/sixDoFRigidBodyState.H b/src/sixDoFRigidBodyState/sixDoFRigidBodyState/sixDoFRigidBodyState.H index 3a6c77a189..42267b32da 100644 --- a/src/sixDoFRigidBodyState/sixDoFRigidBodyState/sixDoFRigidBodyState.H +++ b/src/sixDoFRigidBodyState/sixDoFRigidBodyState/sixDoFRigidBodyState.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -125,11 +125,9 @@ public: // Member Functions - //- Return the current body velocity - vector velocity() const; + vector velocity() const; - //- Return the current body angular velocity - vector angularVelocity() const; + vector angularVelocity() const; //- Read the sixDoFRigidBodyState data virtual bool read(const dictionary&);