diff --git a/src/dynamicFvMesh/Make/files b/src/dynamicFvMesh/Make/files index cf619024625aab50fd879899478586fd545ce184..4bd6e629813549029b5becaf6150c0549cb82119 100644 --- a/src/dynamicFvMesh/Make/files +++ b/src/dynamicFvMesh/Make/files @@ -14,5 +14,7 @@ $(solidBodyMotionFunctions)/SKA/SKA.C $(solidBodyMotionFunctions)/linearMotion/linearMotion.C $(solidBodyMotionFunctions)/rotationMotion/rotationMotion.C $(solidBodyMotionFunctions)/multiMotion/multiMotion.C +$(solidBodyMotionFunctions)/oscillatingMotion/oscillatingMotion.C +$(solidBodyMotionFunctions)/rockingMotion/rockingMotion.C LIB = $(FOAM_LIBBIN)/libdynamicFvMesh diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingMotion/oscillatingMotion.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingMotion/oscillatingMotion.C new file mode 100644 index 0000000000000000000000000000000000000000..946b26a32d60c9a09c547161634b2e4dcc53b728 --- /dev/null +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingMotion/oscillatingMotion.C @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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 2 of the License, or (at your + option) any later version. + + OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "oscillatingMotion.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidBodyMotionFunctions +{ + defineTypeNameAndDebug(oscillatingMotion, 0); + addToRunTimeSelectionTable + ( + solidBodyMotionFunction, + oscillatingMotion, + dictionary + ); +}; +}; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solidBodyMotionFunctions::oscillatingMotion::oscillatingMotion +( + const dictionary& SBMFCoeffs, + const Time& runTime +) +: + solidBodyMotionFunction(SBMFCoeffs, runTime) +{ + read(SBMFCoeffs); +} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +Foam::solidBodyMotionFunctions::oscillatingMotion::~oscillatingMotion() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::septernion +Foam::solidBodyMotionFunctions::oscillatingMotion::transformation() const +{ + scalar t = time_.value(); + + const vector displacement = amplitude_*sin(omega_*t); + + quaternion R(0, 0, 0); + septernion TR(septernion(displacement)*R); + + Info<< "solidBodyMotionFunctions::oscillatingMotion::transformation(): " + << "Time = " << t << " transformation: " << TR << endl; + + return TR; +} + + +bool Foam::solidBodyMotionFunctions::oscillatingMotion::read +( + const dictionary& SBMFCoeffs +) +{ + solidBodyMotionFunction::read(SBMFCoeffs); + + SBMFCoeffs_.lookup("amplitude") >> amplitude_; + SBMFCoeffs_.lookup("omega") >> omega_; + + return true; +} + +// ************************************************************************* // diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingMotion/oscillatingMotion.H b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingMotion/oscillatingMotion.H new file mode 100644 index 0000000000000000000000000000000000000000..d416652be1af26322a4aec9f288cbadd20fbabea --- /dev/null +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/oscillatingMotion/oscillatingMotion.H @@ -0,0 +1,116 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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 2 of the License, or (at your + option) any later version. + + OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::solidBodyMotionFunctions::oscillatingMotion + +Description + SolidBodyMotionFvMesh 6DoF motion function. Oscillating displacement. + +SourceFiles + oscillatingMotion.C + +\*---------------------------------------------------------------------------*/ + +#ifndef oscillatingMotion_H +#define oscillatingMotion_H + +#include "solidBodyMotionFunction.H" +#include "primitiveFields.H" +#include "point.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidBodyMotionFunctions +{ + +/*---------------------------------------------------------------------------*\ + Class oscillatingMotion Declaration +\*---------------------------------------------------------------------------*/ + +class oscillatingMotion +: + public solidBodyMotionFunction +{ + // Private data + + //- Amplitude + vector amplitude_; + + //- Radial velocity + scalar omega_; + + + // Private Member Functions + + //- Disallow copy construct + oscillatingMotion(const oscillatingMotion&); + + //- Disallow default bitwise assignment + void operator=(const oscillatingMotion&); + + +public: + + //- Runtime type information + TypeName("oscillatingMotion"); + + + // Constructors + + //- Construct from components + oscillatingMotion + ( + const dictionary& SBMFCoeffs, + const Time& runTime + ); + + + // Destructor + + virtual ~oscillatingMotion(); + + + // Member Functions + + //- Return the solid-body motion transformation septernion + virtual septernion transformation() const; + + //- Update properties from given dictionary + virtual bool read(const dictionary& SBMFCoeffs); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solidBodyMotionFunctions +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/rockingMotion/rockingMotion.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/rockingMotion/rockingMotion.C new file mode 100644 index 0000000000000000000000000000000000000000..c6a734383242579a55071524d582921273dd246c --- /dev/null +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/rockingMotion/rockingMotion.C @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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 2 of the License, or (at your + option) any later version. + + OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "rockingMotion.H" +#include "addToRunTimeSelectionTable.H" +#include "mathConstants.H" + +using namespace Foam::constant::math; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidBodyMotionFunctions +{ + defineTypeNameAndDebug(rockingMotion, 0); + addToRunTimeSelectionTable + ( + solidBodyMotionFunction, + rockingMotion, + dictionary + ); +}; +}; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solidBodyMotionFunctions::rockingMotion::rockingMotion +( + const dictionary& SBMFCoeffs, + const Time& runTime +) +: + solidBodyMotionFunction(SBMFCoeffs, runTime) +{ + read(SBMFCoeffs); +} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +Foam::solidBodyMotionFunctions::rockingMotion::~rockingMotion() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::septernion +Foam::solidBodyMotionFunctions::rockingMotion::transformation() const +{ + scalar t = time_.value(); + + vector eulerAngles = amplitude_*sin(omega_*t); + + // Convert the rotational motion from deg to rad + eulerAngles *= pi/180.0; + + quaternion R(eulerAngles.x(), eulerAngles.y(), eulerAngles.z()); + septernion TR(septernion(CofG_)*R*septernion(-CofG_)); + + Info<< "solidBodyMotionFunctions::rockingMotion::transformation(): " + << "Time = " << t << " transformation: " << TR << endl; + + return TR; +} + + +bool Foam::solidBodyMotionFunctions::rockingMotion::read +( + const dictionary& SBMFCoeffs +) +{ + solidBodyMotionFunction::read(SBMFCoeffs); + + SBMFCoeffs_.lookup("CofG") >> CofG_; + SBMFCoeffs_.lookup("amplitude") >> amplitude_; + SBMFCoeffs_.lookup("omega") >> omega_; + + return true; +} + +// ************************************************************************* // diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/rockingMotion/rockingMotion.H b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/rockingMotion/rockingMotion.H new file mode 100644 index 0000000000000000000000000000000000000000..ca372047fa917d7b9a35eca75188efc7fb6c4d83 --- /dev/null +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/rockingMotion/rockingMotion.H @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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 2 of the License, or (at your + option) any later version. + + OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::solidBodyMotionFunctions::rockingMotion + +Description + SolidBodyMotionFvMesh 6DoF motion function. Oscillating rotation. + +SourceFiles + rockingMotion.C + +\*---------------------------------------------------------------------------*/ + +#ifndef rockingMotion_H +#define rockingMotion_H + +#include "solidBodyMotionFunction.H" +#include "primitiveFields.H" +#include "point.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solidBodyMotionFunctions +{ + +/*---------------------------------------------------------------------------*\ + Class rockingMotion Declaration +\*---------------------------------------------------------------------------*/ + +class rockingMotion +: + public solidBodyMotionFunction +{ + // Private data + + //- Centre of gravity + point CofG_; + + //- Amplitude + vector amplitude_; + + //- Radial velocity + scalar omega_; + + + // Private Member Functions + + //- Disallow copy construct + rockingMotion(const rockingMotion&); + + //- Disallow default bitwise assignment + void operator=(const rockingMotion&); + + +public: + + //- Runtime type information + TypeName("rockingMotion"); + + + // Constructors + + //- Construct from components + rockingMotion + ( + const dictionary& SBMFCoeffs, + const Time& runTime + ); + + + // Destructor + + virtual ~rockingMotion(); + + + // Member Functions + + //- Return the solid-body motion transformation septernion + virtual septernion transformation() const; + + //- Update properties from given dictionary + virtual bool read(const dictionary& SBMFCoeffs); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solidBodyMotionFunctions +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/dynamicMeshDict b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/dynamicMeshDict index 17ea97ec1fb5ce8e6ef5899e375a7d7bd35f99c9..fdbc9e8a60034bc0b5c2d880670f91b37bf9d2db 100644 --- a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/dynamicMeshDict +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/constant/dynamicMeshDict @@ -34,14 +34,25 @@ solidBodyMotionFvMeshCoeffs } } - // Box rotates on rotating table + //// Box rotates on rotating table + //rotatingBox + //{ + // solidBodyMotionFunction rotationMotion; + // rotationMotionCoeffs + // { + // CofG (0 0 0); + // radialVelocity (720 0 0); // degrees/s + // } + //} + // Box rocking on rotating table rotatingBox { - solidBodyMotionFunction rotationMotion; - rotationMotionCoeffs + solidBodyMotionFunction rockingMotion; + rockingMotionCoeffs { CofG (0 0 0); - radialVelocity (720 0 0); // degrees/s + omega 40; // rad/s + amplitude (45 0 0); // 45 degrees max tilt } } } diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/setFieldsDict b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/setFieldsDict index 000870b80b28747eb26de2f1aa1df9df36884851..106b12faa2132793f9dc1876cb86da8423dbe44f 100644 --- a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/setFieldsDict +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/setFieldsDict @@ -24,7 +24,7 @@ regions ( boxToCell { - box ( -100 -100 -100 ) ( 100 -0.02 100); + box ( -100 -100 -100 ) ( 100 100 -0.0025); fieldValues ( volScalarFieldValue alpha1 1 ); } );