diff --git a/src/ODE/Make/files b/src/ODE/Make/files index 602890f76..b532c0dd3 100644 --- a/src/ODE/Make/files +++ b/src/ODE/Make/files @@ -16,12 +16,14 @@ sixDOF = sixDOF $(sixDOF)/finiteRotation/finiteRotation.C $(sixDOF)/sixDOFqODE/sixDOFqODE.C -$(sixDOF)/constraints/rotationalConstraints/rotationalConstraint/rotationalConstraint.C -$(sixDOF)/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.C +$(sixDOF)/sixDOFODE/constraints/rotationalConstraints/rotationalConstraint/rotationalConstraint.C +$(sixDOF)/sixDOFODE/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.C +$(sixDOF)/sixDOFODE/constraints/translationalConstraints/translationalConstraint/translationalConstraint.C +$(sixDOF)/sixDOFODE/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.C +$(sixDOF)/sixDOFODE/constraints/translationalConstraints/periodicOscillation/periodicOscillation.C -$(sixDOF)/constraints/translationalConstraints/translationalConstraint/translationalConstraint.C -$(sixDOF)/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.C -$(sixDOF)/constraints/translationalConstraints/periodicOscillation/periodicOscillation.C +$(sixDOF)/sixDOFODE/restraints/translationalRestraints/translationalRestraint/translationalRestraint.C +$(sixDOF)/sixDOFODE/restraints/rotationalRestraints/rotationalRestraint/rotationalRestraint.C $(sixDOF)/sixDOFODE/sixDOFODE.C $(sixDOF)/sixDOFODE/newSixDOFODE.C diff --git a/src/ODE/sixDOF/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.C b/src/ODE/sixDOF/sixDOFODE/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.C similarity index 100% rename from src/ODE/sixDOF/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.C rename to src/ODE/sixDOF/sixDOFODE/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.C diff --git a/src/ODE/sixDOF/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.H b/src/ODE/sixDOF/sixDOFODE/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.H similarity index 100% rename from src/ODE/sixDOF/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.H rename to src/ODE/sixDOF/sixDOFODE/constraints/rotationalConstraints/constantAngularAcceleration/constantAngularAcceleration.H diff --git a/src/ODE/sixDOF/constraints/rotationalConstraints/rotationalConstraint/rotationalConstraint.C b/src/ODE/sixDOF/sixDOFODE/constraints/rotationalConstraints/rotationalConstraint/rotationalConstraint.C similarity index 100% rename from src/ODE/sixDOF/constraints/rotationalConstraints/rotationalConstraint/rotationalConstraint.C rename to src/ODE/sixDOF/sixDOFODE/constraints/rotationalConstraints/rotationalConstraint/rotationalConstraint.C diff --git a/src/ODE/sixDOF/constraints/rotationalConstraints/rotationalConstraint/rotationalConstraint.H b/src/ODE/sixDOF/sixDOFODE/constraints/rotationalConstraints/rotationalConstraint/rotationalConstraint.H similarity index 100% rename from src/ODE/sixDOF/constraints/rotationalConstraints/rotationalConstraint/rotationalConstraint.H rename to src/ODE/sixDOF/sixDOFODE/constraints/rotationalConstraints/rotationalConstraint/rotationalConstraint.H diff --git a/src/ODE/sixDOF/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.C b/src/ODE/sixDOF/sixDOFODE/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.C similarity index 100% rename from src/ODE/sixDOF/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.C rename to src/ODE/sixDOF/sixDOFODE/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.C diff --git a/src/ODE/sixDOF/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.H b/src/ODE/sixDOF/sixDOFODE/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.H similarity index 100% rename from src/ODE/sixDOF/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.H rename to src/ODE/sixDOF/sixDOFODE/constraints/translationalConstraints/constantTranslationalAcceleration/constantTranslationalAcceleration.H diff --git a/src/ODE/sixDOF/constraints/translationalConstraints/periodicOscillation/periodicOscillation.C b/src/ODE/sixDOF/sixDOFODE/constraints/translationalConstraints/periodicOscillation/periodicOscillation.C similarity index 100% rename from src/ODE/sixDOF/constraints/translationalConstraints/periodicOscillation/periodicOscillation.C rename to src/ODE/sixDOF/sixDOFODE/constraints/translationalConstraints/periodicOscillation/periodicOscillation.C diff --git a/src/ODE/sixDOF/constraints/translationalConstraints/periodicOscillation/periodicOscillation.H b/src/ODE/sixDOF/sixDOFODE/constraints/translationalConstraints/periodicOscillation/periodicOscillation.H similarity index 100% rename from src/ODE/sixDOF/constraints/translationalConstraints/periodicOscillation/periodicOscillation.H rename to src/ODE/sixDOF/sixDOFODE/constraints/translationalConstraints/periodicOscillation/periodicOscillation.H diff --git a/src/ODE/sixDOF/constraints/translationalConstraints/translationalConstraint/translationalConstraint.C b/src/ODE/sixDOF/sixDOFODE/constraints/translationalConstraints/translationalConstraint/translationalConstraint.C similarity index 100% rename from src/ODE/sixDOF/constraints/translationalConstraints/translationalConstraint/translationalConstraint.C rename to src/ODE/sixDOF/sixDOFODE/constraints/translationalConstraints/translationalConstraint/translationalConstraint.C diff --git a/src/ODE/sixDOF/constraints/translationalConstraints/translationalConstraint/translationalConstraint.H b/src/ODE/sixDOF/sixDOFODE/constraints/translationalConstraints/translationalConstraint/translationalConstraint.H similarity index 100% rename from src/ODE/sixDOF/constraints/translationalConstraints/translationalConstraint/translationalConstraint.H rename to src/ODE/sixDOF/sixDOFODE/constraints/translationalConstraints/translationalConstraint/translationalConstraint.H diff --git a/src/ODE/sixDOF/sixDOFODE/constraintsAndRestraints.H b/src/ODE/sixDOF/sixDOFODE/constraintsAndRestraints.H new file mode 100644 index 000000000..b63af2b9e --- /dev/null +++ b/src/ODE/sixDOF/sixDOFODE/constraintsAndRestraints.H @@ -0,0 +1,10 @@ +#ifndef constraintsAndRestraints_H +#define constraintsAndRestraints_H + +#include "translationalConstraint.H" +#include "rotationalConstraint.H" + +#include "translationalRestraint.H" +#include "rotationalRestraint.H" + +#endif diff --git a/src/ODE/sixDOF/sixDOFODE/restraints/rotationalRestraints/rotationalRestraint/rotationalRestraint.C b/src/ODE/sixDOF/sixDOFODE/restraints/rotationalRestraints/rotationalRestraint/rotationalRestraint.C new file mode 100644 index 000000000..83da7dcec --- /dev/null +++ b/src/ODE/sixDOF/sixDOFODE/restraints/rotationalRestraints/rotationalRestraint/rotationalRestraint.C @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "rotationalRestraint.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(rotationalRestraint, 0); + defineRunTimeSelectionTable(rotationalRestraint, word); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::rotationalRestraint::rotationalRestraint +( + const word& name, + const dictionary& dict +) +: + name_(name) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::rotationalRestraint::~rotationalRestraint() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::autoPtr Foam::rotationalRestraint::New +( + const word& name, + const dictionary& dict +) +{ + const word restraintType(dict.lookup("type")); + + wordConstructorTable::iterator cstrIter = + wordConstructorTablePtr_->find(restraintType); + + if (cstrIter == wordConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "rotationalRestraint::New" + "\n(" + "\n const word& name," + "\n const dictionary& dict" + "\n)" + ) << "Unknown translation restraint type: " << restraintType + << endl << endl + << "Valid translation restraint types are: " << endl + << wordConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr + ( + cstrIter() + ( + name, + dict + ) + ); +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const rotationalRestraint& rr +) +{ + os << rr.name_ << nl << token::BEGIN_BLOCK << nl; + + rr.write(os); + + os << token::END_BLOCK << endl; + + os.check("Ostream& operator<<(Ostream&, const rotationalRestraint&"); + + return os; +} + + +// ************************************************************************* // diff --git a/src/ODE/sixDOF/sixDOFODE/restraints/rotationalRestraints/rotationalRestraint/rotationalRestraint.H b/src/ODE/sixDOF/sixDOFODE/restraints/rotationalRestraints/rotationalRestraint/rotationalRestraint.H new file mode 100644 index 000000000..b5420e019 --- /dev/null +++ b/src/ODE/sixDOF/sixDOFODE/restraints/rotationalRestraints/rotationalRestraint/rotationalRestraint.H @@ -0,0 +1,171 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::rotationalRestraint + +Description + Abstract base class containing interface for rotational restraints used + within sixDOFODE classes. + + Interface provides restraining moment to the rotational equations of + motion via moment() member function. + +Author + Vuko Vukcevic, FSB Zagreb. All rights reserved. + +SourceFiles + rotationalRestraint.C + +\*---------------------------------------------------------------------------*/ + +#ifndef rotationalRestraint_H +#define rotationalRestraint_H + +#include "typeInfo.H" +#include "runTimeSelectionTables.H" +#include "autoPtr.H" +#include "dimensionedTypes.H" +#include "dictionary.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class rotationalRestraint Declaration +\*---------------------------------------------------------------------------*/ + +class rotationalRestraint +{ + // Private Data + + //- Name of the restraint + word name_; + + +public: + + //- Runtime type information + TypeName("rotationalRestraint"); + + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + rotationalRestraint, + word, + ( + const word& name, + const dictionary& dict + ), + (name, dict) + ); + + + //- Class used for the read-construction of + // PtrLists of rotationalRestraint + class iNew + { + public: + + iNew() + {} + + autoPtr operator()(Istream& is) const + { + word name(is); + dictionary dict(is); + return rotationalRestraint::New(name, dict); + } + }; + + + // Constructors + + //- Construct from dictionary + rotationalRestraint + ( + const word& name, + const dictionary& dict + ); + + //- Construct and return a clone + virtual autoPtr clone() const = 0; + + + // Selectors + + //- Return a reference to the selected rotationalRestraint + static autoPtr New + ( + const word& name, + const dictionary& dict + ); + + + // Destructor + + virtual ~rotationalRestraint(); + + + // Member Functions + + // Restraint specific functions + + //- Return restraining force (in the local coordinate system) + virtual vector restrainingMoment + ( + const scalar t, + const tensor& toRelative, + const vector& omega + ) const = 0; + + + // I-O Functions and Operators + + //- Virtual write function + virtual void write(Ostream& os) const = 0; + + //- Ostream operator implemented in terms of write operator + friend Ostream& operator<< + ( + Ostream& os, + const rotationalRestraint& rr + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/ODE/sixDOF/sixDOFODE/restraints/translationalRestraints/translationalRestraint/translationalRestraint.C b/src/ODE/sixDOF/sixDOFODE/restraints/translationalRestraints/translationalRestraint/translationalRestraint.C new file mode 100644 index 000000000..3d4ffa128 --- /dev/null +++ b/src/ODE/sixDOF/sixDOFODE/restraints/translationalRestraints/translationalRestraint/translationalRestraint.C @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "translationalRestraint.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(translationalRestraint, 0); + defineRunTimeSelectionTable(translationalRestraint, word); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::translationalRestraint::translationalRestraint +( + const word& name, + const dictionary& dict +) +: + name_(name) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::translationalRestraint::~translationalRestraint() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::autoPtr Foam::translationalRestraint::New +( + const word& name, + const dictionary& dict +) +{ + const word restraintType(dict.lookup("type")); + + wordConstructorTable::iterator cstrIter = + wordConstructorTablePtr_->find(restraintType); + + if (cstrIter == wordConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "translationalRestraint::New" + "\n(" + "\n const word& name," + "\n const dictionary& dict" + "\n)" + ) << "Unknown translation restraint type: " << restraintType + << endl << endl + << "Valid translation restraint types are: " << endl + << wordConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr + ( + cstrIter() + ( + name, + dict + ) + ); +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const translationalRestraint& tr +) +{ + os << tr.name_ << nl << token::BEGIN_BLOCK << nl; + + tr.write(os); + + os << token::END_BLOCK << endl; + + os.check("Ostream& operator<<(Ostream&, const translationalRestraint&"); + + return os; +} + + +// ************************************************************************* // diff --git a/src/ODE/sixDOF/sixDOFODE/restraints/translationalRestraints/translationalRestraint/translationalRestraint.H b/src/ODE/sixDOF/sixDOFODE/restraints/translationalRestraints/translationalRestraint/translationalRestraint.H new file mode 100644 index 000000000..19b49eda6 --- /dev/null +++ b/src/ODE/sixDOF/sixDOFODE/restraints/translationalRestraints/translationalRestraint/translationalRestraint.H @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::translationalRestraint + +Description + Abstract base class containing interface for translational restraints used + within sixDOFODE classes. + + Interface provides restraining forces to the translational equations of + motion via force() member function. + +Author + Vuko Vukcevic, FSB Zagreb. All rights reserved. + +SourceFiles + translationalRestraint.C + +\*---------------------------------------------------------------------------*/ + +#ifndef translationalRestraint_H +#define translationalRestraint_H + +#include "typeInfo.H" +#include "runTimeSelectionTables.H" +#include "autoPtr.H" +#include "dimensionedTypes.H" +#include "dictionary.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class translationalRestraint Declaration +\*---------------------------------------------------------------------------*/ + +class translationalRestraint +{ + // Private Data + + //- Name of the restraint + word name_; + + +public: + + //- Runtime type information + TypeName("translationalRestraint"); + + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + translationalRestraint, + word, + ( + const word& name, + const dictionary& dict + ), + (name, dict) + ); + + + //- Class used for the read-construction of + // PtrLists of translationalRestraint + class iNew + { + public: + + iNew() + {} + + autoPtr operator()(Istream& is) const + { + word name(is); + dictionary dict(is); + return translationalRestraint::New(name, dict); + } + }; + + + // Constructors + + //- Construct from dictionary + translationalRestraint + ( + const word& name, + const dictionary& dict + ); + + //- Construct and return a clone + virtual autoPtr clone() const = 0; + + + // Selectors + + //- Return a reference to the selected translationalRestraint + static autoPtr New + ( + const word& name, + const dictionary& dict + ); + + + // Destructor + + virtual ~translationalRestraint(); + + + // Member Functions + + // Restraint specific functions + + //- Return restraining force (in the global coordinate system) + virtual vector restrainingForce + ( + const scalar t, + const tensor& toRelative, + const vector& x, + const vector& u + ) const = 0; + + + // I-O Functions and Operators + + //- Virtual write function + virtual void write(Ostream& os) const = 0; + + //- Ostream operator implemented in terms of write operator + friend Ostream& operator<< + ( + Ostream& os, + const translationalRestraint& tr + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/ODE/sixDOF/sixDOFODE/sixDOFODE.C b/src/ODE/sixDOF/sixDOFODE/sixDOFODE.C index a1ddb57dd..c605543e5 100644 --- a/src/ODE/sixDOF/sixDOFODE/sixDOFODE.C +++ b/src/ODE/sixDOF/sixDOFODE/sixDOFODE.C @@ -200,6 +200,10 @@ void Foam::sixDOFODE::setState(const sixDOFODE& sd) // Copy constraints translationalConstraints_ = sd.translationalConstraints_; rotationalConstraints_ = sd.rotationalConstraints_; + + // Copy restraints + translationalRestraints_ = sd.translationalRestraints_; + rotationalRestraints_ = sd.rotationalRestraints_; } @@ -261,7 +265,10 @@ Foam::sixDOFODE::sixDOFODE(const IOobject& io) oldStatePtr_(), translationalConstraints_(), - rotationalConstraints_() + rotationalConstraints_(), + + translationalRestraints_(), + rotationalRestraints_() { // Sanity checks if (mass_.value() < SMALL) @@ -281,7 +288,7 @@ Foam::sixDOFODE::sixDOFODE(const IOobject& io) << exit(FatalError); } - // Read and construct constraints + // Read and construct constraints and restraints // Read translation constraints if they are present if (dict().found("translationalConstraints")) @@ -304,6 +311,28 @@ Foam::sixDOFODE::sixDOFODE(const IOobject& io) ); rotationalConstraints_.transfer(rcList); } + + // Read translation restraints if they are present + if (dict().found("translationalRestraints")) + { + PtrList tcList + ( + dict().lookup("translationalRestraints"), + translationalRestraint::iNew() + ); + translationalRestraints_.transfer(tcList); + } + + // Read rotation restraints if they are present + if (dict().found("rotationalRestraints")) + { + PtrList rcList + ( + dict().lookup("rotationalRestraints"), + rotationalRestraint::iNew() + ); + rotationalRestraints_.transfer(rcList); + } } @@ -340,7 +369,10 @@ Foam::sixDOFODE::sixDOFODE(const word& name, const sixDOFODE& sd) oldStatePtr_(), translationalConstraints_(sd.translationalConstraints_), - rotationalConstraints_(sd.rotationalConstraints_) + rotationalConstraints_(sd.rotationalConstraints_), + + translationalRestraints_(sd.translationalRestraints_), + rotationalRestraints_(sd.rotationalRestraints_) {} @@ -398,6 +430,20 @@ bool Foam::sixDOFODE::writeData(Ostream& os) const << token::END_STATEMENT << endl; } + if (!translationalRestraints_.empty()) + { + os.writeKeyword("translationalRestraints") + << translationalRestraints_ + << token::END_STATEMENT << nl << endl; + } + + if (!rotationalRestraints_.empty()) + { + os.writeKeyword("rotationalRestraints") + << rotationalRestraints_ + << token::END_STATEMENT << endl; + } + return os.good(); } diff --git a/src/ODE/sixDOF/sixDOFODE/sixDOFODE.H b/src/ODE/sixDOF/sixDOFODE/sixDOFODE.H index 22ed699c6..2c0b42306 100644 --- a/src/ODE/sixDOF/sixDOFODE/sixDOFODE.H +++ b/src/ODE/sixDOF/sixDOFODE/sixDOFODE.H @@ -28,8 +28,8 @@ Description Abstract base class for six-degrees-of-freedom (6DOF) ordinary differential equations with necessary interface for two-way coupling with CFD solvers. - Holds list of translational and rotational constraints to be used in derived - classes. + Holds list of translational and rotational constraints and restraings to be + used in derived classes. Author Dubravko Matijasevic, FSB Zagreb. All rights reserved. @@ -56,9 +56,7 @@ SourceFiles #include "runTimeSelectionTables.H" #include "Switch.H" #include "foamTime.H" -#include "translationalConstraint.H" -#include "rotationalConstraint.H" -#include "PtrList.H" +#include "constraintsAndRestraints.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -166,6 +164,15 @@ class sixDOFODE PtrList rotationalConstraints_; + // Motion restraints + + //- List of translational restraints + PtrList translationalRestraints_; + + //- List of rotational restraints + PtrList rotationalRestraints_; + + // Private Member Functions // Copy control @@ -318,6 +325,17 @@ public: rotationalConstraints() const; + // Access to motion restraints + + //- Return const reference to translational restraints + inline const PtrList& + translationalRestraints() const; + + //- Return const reference to rotational restraints + inline const PtrList& + rotationalRestraints() const; + + // Virtual interface for 6DOF motion state // Variables in relative coordinate system diff --git a/src/ODE/sixDOF/sixDOFODE/sixDOFODEI.H b/src/ODE/sixDOF/sixDOFODE/sixDOFODEI.H index 60f719beb..383d1b0f9 100644 --- a/src/ODE/sixDOF/sixDOFODE/sixDOFODEI.H +++ b/src/ODE/sixDOF/sixDOFODE/sixDOFODEI.H @@ -139,4 +139,18 @@ Foam::sixDOFODE::rotationalConstraints() const return rotationalConstraints_; } + +const Foam::PtrList& +Foam::sixDOFODE::translationalRestraints() const +{ + return translationalRestraints_; +} + + +const Foam::PtrList& +Foam::sixDOFODE::rotationalRestraints() const +{ + return rotationalRestraints_; +} + // ************************************************************************* //