From e7fd51dc978850cbc5bd416c3702bf4e31dbf1fd Mon Sep 17 00:00:00 2001 From: Vuko Vukcevic Date: Fri, 10 Mar 2017 12:58:14 +0100 Subject: [PATCH] Angular damper rotational restraint --- src/ODE/Make/files | 1 + .../angularDamper/angularDamper.C | 111 ++++++++++++++++ .../angularDamper/angularDamper.H | 118 ++++++++++++++++++ 3 files changed, 230 insertions(+) create mode 100644 src/ODE/sixDOF/sixDOFODE/restraints/rotationalRestraints/angularDamper/angularDamper.C create mode 100644 src/ODE/sixDOF/sixDOFODE/restraints/rotationalRestraints/angularDamper/angularDamper.H diff --git a/src/ODE/Make/files b/src/ODE/Make/files index f32948cb7..79e742a77 100644 --- a/src/ODE/Make/files +++ b/src/ODE/Make/files @@ -25,6 +25,7 @@ $(sixDOF)/sixDOFODE/constraints/translationalConstraints/periodicOscillation/per $(sixDOF)/sixDOFODE/restraints/translationalRestraints/translationalRestraint/translationalRestraint.C $(sixDOF)/sixDOFODE/restraints/translationalRestraints/linearSpringDamper/linearSpringDamper.C $(sixDOF)/sixDOFODE/restraints/rotationalRestraints/rotationalRestraint/rotationalRestraint.C +$(sixDOF)/sixDOFODE/restraints/rotationalRestraints/angularDamper/angularDamper.C $(sixDOF)/sixDOFODE/sixDOFODE.C $(sixDOF)/sixDOFODE/newSixDOFODE.C diff --git a/src/ODE/sixDOF/sixDOFODE/restraints/rotationalRestraints/angularDamper/angularDamper.C b/src/ODE/sixDOF/sixDOFODE/restraints/rotationalRestraints/angularDamper/angularDamper.C new file mode 100644 index 000000000..8b114f20c --- /dev/null +++ b/src/ODE/sixDOF/sixDOFODE/restraints/rotationalRestraints/angularDamper/angularDamper.C @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "angularDamper.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(angularDamper, 0); + addToRunTimeSelectionTable + ( + rotationalRestraint, + angularDamper, + word + ); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::angularDamper::angularDamper +( + const word& name, + const dictionary& dict +) +: + rotationalRestraint(name, dict), + angDampingCoeffs_(dict.lookup("angularDamping")), + inGlobal_(dict.lookup("inGlobalCoordinateSystem")) +{} + + +Foam::autoPtr +Foam::angularDamper::clone() const +{ + return autoPtr + ( + new angularDamper(*this) + ); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::angularDamper::~angularDamper() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::vector Foam::angularDamper::restrainingMoment +( + const scalar, + const tensor& toRelative, + const vector& omega +) const +{ + vector rm; + + if (inGlobal_) + { + // Restraint given in global (inertial) coordinate system, transform it + // to local + rm = (toRelative & angDampingCoeffs_) & omega; + } + else + { + // Restraint already in local (body) coordinate system + rm = angDampingCoeffs_ & omega; + } + + return -rm; +} + + +void Foam::angularDamper::write(Ostream& os) const +{ + os.writeKeyword("type") << tab << type() + << token::END_STATEMENT << nl << nl; + + os.writeKeyword("angularDamping") << tab << angDampingCoeffs_ + << token::END_STATEMENT << nl; + os.writeKeyword("inGlobalCoordinateSystem") << tab << inGlobal_ + << token::END_STATEMENT << endl; +} + + +// ************************************************************************* // diff --git a/src/ODE/sixDOF/sixDOFODE/restraints/rotationalRestraints/angularDamper/angularDamper.H b/src/ODE/sixDOF/sixDOFODE/restraints/rotationalRestraints/angularDamper/angularDamper.H new file mode 100644 index 000000000..5044dfc16 --- /dev/null +++ b/src/ODE/sixDOF/sixDOFODE/restraints/rotationalRestraints/angularDamper/angularDamper.H @@ -0,0 +1,118 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.0 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +Class + Foam::angularDamper + +Description + Rotational restraint corresponding to angular damper defined by angular + damping coefficients. + +Author + Vuko Vukcevic, FSB Zagreb. All rights reserved. + +SourceFiles + angularDamper.C + +\*---------------------------------------------------------------------------*/ + +#ifndef angularDamper_H +#define angularDamper_H + +#include "rotationalRestraint.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class angularDamper Declaration +\*---------------------------------------------------------------------------*/ + +class angularDamper +: + public rotationalRestraint +{ + // Private Data + + //- Angular damping coefficients + diagTensor angDampingCoeffs_; + + //- Whether the damper is applied in global or local c. s. + Switch inGlobal_; + + +public: + + //- Runtime type information + TypeName("angularDamper"); + + + // Constructors + + //- Construct from dictionary + angularDamper + ( + const word& name, + const dictionary& dict + ); + + //- Construct and return a clone + virtual autoPtr clone() const; + + + // Destructor + + virtual ~angularDamper(); + + + // Member Functions + + // Restraint specific functions + + //- Return restraining moment (in the global coordinate system) + virtual vector restrainingMoment + ( + const scalar t, + const tensor& toRelative, + const vector& omega + ) const; + + + // I-O Functions and Operators + + //- Virtual write function + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //