From 082165d1c51a44c8ffbdee9d70f2938c2cefd862 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 8 May 2008 17:43:17 +0100 Subject: [PATCH] adding SRF library, and tutorial with demonstration solver --- src/finiteVolume/Make/files | 4 + .../general/SRF/SRFModel/SRFModel/SRFModel.C | 193 +++++++++++++++++ .../general/SRF/SRFModel/SRFModel/SRFModel.H | 187 +++++++++++++++++ .../SRF/SRFModel/SRFModel/newSRFModel.C | 92 ++++++++ .../cfdTools/general/SRF/SRFModel/rpm/rpm.C | 92 ++++++++ .../cfdTools/general/SRF/SRFModel/rpm/rpm.H | 107 ++++++++++ .../SRFVelocityFvPatchVectorField.C | 181 ++++++++++++++++ .../SRFVelocityFvPatchVectorField.H | 172 +++++++++++++++ tutorials/simpleSRFFoam/Allclean | 16 ++ tutorials/simpleSRFFoam/Allrun | 16 ++ tutorials/simpleSRFFoam/mixer/0/Urel | 66 ++++++ tutorials/simpleSRFFoam/mixer/0/epsilon | 60 ++++++ tutorials/simpleSRFFoam/mixer/0/k | 60 ++++++ tutorials/simpleSRFFoam/mixer/0/omega | 60 ++++++ tutorials/simpleSRFFoam/mixer/0/p | 60 ++++++ .../mixer/constant/SRFProperties | 35 ++++ .../mixer/constant/polyMesh/blockMeshDict | 123 +++++++++++ .../mixer/constant/transportProperties | 46 ++++ .../mixer/constant/turbulenceProperties | 198 ++++++++++++++++++ .../simpleSRFFoam/mixer/system/controlDict | 56 +++++ .../simpleSRFFoam/mixer/system/fvSchemes | 80 +++++++ .../simpleSRFFoam/mixer/system/fvSolution | 88 ++++++++ .../simpleSRFFoam/simpleSRFFoam/Make/files | 3 + .../simpleSRFFoam/simpleSRFFoam/Make/options | 10 + .../simpleSRFFoam/createFields.H | 74 +++++++ .../simpleSRFFoam/simpleSRFFoam.C | 130 ++++++++++++ 26 files changed, 2209 insertions(+) create mode 100644 src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C create mode 100644 src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.H create mode 100644 src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/newSRFModel.C create mode 100644 src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.C create mode 100644 src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.H create mode 100644 src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C create mode 100644 src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.H create mode 100755 tutorials/simpleSRFFoam/Allclean create mode 100755 tutorials/simpleSRFFoam/Allrun create mode 100644 tutorials/simpleSRFFoam/mixer/0/Urel create mode 100644 tutorials/simpleSRFFoam/mixer/0/epsilon create mode 100644 tutorials/simpleSRFFoam/mixer/0/k create mode 100644 tutorials/simpleSRFFoam/mixer/0/omega create mode 100644 tutorials/simpleSRFFoam/mixer/0/p create mode 100644 tutorials/simpleSRFFoam/mixer/constant/SRFProperties create mode 100644 tutorials/simpleSRFFoam/mixer/constant/polyMesh/blockMeshDict create mode 100644 tutorials/simpleSRFFoam/mixer/constant/transportProperties create mode 100644 tutorials/simpleSRFFoam/mixer/constant/turbulenceProperties create mode 100644 tutorials/simpleSRFFoam/mixer/system/controlDict create mode 100644 tutorials/simpleSRFFoam/mixer/system/fvSchemes create mode 100644 tutorials/simpleSRFFoam/mixer/system/fvSolution create mode 100644 tutorials/simpleSRFFoam/simpleSRFFoam/Make/files create mode 100644 tutorials/simpleSRFFoam/simpleSRFFoam/Make/options create mode 100644 tutorials/simpleSRFFoam/simpleSRFFoam/createFields.H create mode 100644 tutorials/simpleSRFFoam/simpleSRFFoam/simpleSRFFoam.C diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 22047adeda..80a93f4ce1 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -259,6 +259,10 @@ cfdTools/general/porousMedia/porousZones.C cfdTools/general/MRF/MRFZone.C cfdTools/general/MRF/MRFZones.C cfdTools/general/fieldSources/timeActivatedExplicitSource/timeActivatedExplicitSource.C +cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C +cfdTools/general/SRF/SRFModel/SRFModel/newSRFModel.C +cfdTools/general/SRF/SRFModel/rpm/rpm.C +cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C fvMeshCutSurface = fvMesh/fvMeshCutSurface diff --git a/src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C b/src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C new file mode 100644 index 0000000000..77255818e3 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C @@ -0,0 +1,193 @@ +/*---------------------------------------------------------------------------* \ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 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 + +Description + + Formulation based on relative velocities + +\*---------------------------------------------------------------------------*/ + +#include "SRFModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace SRF + { + defineTypeNameAndDebug(SRFModel, 0); + defineRunTimeSelectionTable(SRFModel, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::SRF::SRFModel::SRFModel +( + const word& type, + const volVectorField& Urel +) +: + IOdictionary + ( + IOobject + ( + "SRFProperties", + Urel.mesh().time().constant(), + Urel.mesh().db(), + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ), + Urel_(Urel), + mesh_(Urel_.mesh()), + axis_(lookup("axis")), + SRFModelCoeffs_(subDict(type + "Coeffs")), + omega_(dimensionedVector("omega", dimless/dimTime, vector::zero)) +{ + // Normalise the axis + axis_ /= mag(axis_); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::SRF::SRFModel::~SRFModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::SRF::SRFModel::read() +{ + if (regIOobject::read()) + { + // Re-read axis + SRFModelCoeffs_.lookup("axis") >> axis_; + axis_ /= mag(axis_); + + // Re-read sub-model coeffs + SRFModelCoeffs_ = subDict(type() + "Coeffs"); + + return true; + } + else + { + return false; + } +} + + +const Foam::vector& Foam::SRF::SRFModel::axis() const +{ + return axis_; +} + + +const Foam::dimensionedVector& Foam::SRF::SRFModel::omega() const +{ + return omega_; +} + + +Foam::tmp > +Foam::SRF::SRFModel::Fcoriolis() const +{ + return tmp > + ( + new DimensionedField + ( + IOobject + ( + "Fcoriolis", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + 2.0*omega_ ^ Urel_ + ) + ); +} + + +Foam::tmp > +Foam::SRF::SRFModel::Fcentrifugal() const +{ + return tmp > + ( + new DimensionedField + ( + IOobject + ( + "Fcentrifugal", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + omega_ ^ (omega_ ^ mesh_.C()) + ) + ); +} + + +Foam::tmp > +Foam::SRF::SRFModel::Su() const +{ + return Fcoriolis() + Fcentrifugal(); +} + + +Foam::vectorField Foam::SRF::SRFModel::velocity +( + const vectorField& positions +) const +{ + return -omega_.value() ^ (positions - axis_*(axis_ & positions)); +} + + +Foam::tmp Foam::SRF::SRFModel::U() const +{ + return tmp + ( + new volVectorField + ( + IOobject + ( + "Usrf", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + -omega_ ^ (mesh_.C() - axis_*(axis_ & mesh_.C())) + ) + ); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.H b/src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.H new file mode 100644 index 0000000000..4a680efa5d --- /dev/null +++ b/src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.H @@ -0,0 +1,187 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 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 + +Namespace + Foam::SRF + +Description + Namespace for single rotating frame (SRF) models + +Class + Foam::SRF::SRFModel + +Description + Top level model for single rotating frame + - Steady state only - no time derivatives included + +SourceFiles + SRFModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SRFModel_H +#define SRFModel_H + +#include "IOdictionary.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" +#include "fvMesh.H" +#include "volFields.H" +#include "vectorField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace SRF +{ + +/*---------------------------------------------------------------------------*\ + Class SRFModel Declaration +\*---------------------------------------------------------------------------*/ + +class SRFModel +: + public IOdictionary +{ + +protected: + + // Protected data + + //- Reference to the relative velocity field + const volVectorField& Urel_; + + //- Reference to the mesh + const fvMesh& mesh_; + + //- Axis of rotation + vector axis_; + + //- SRF model coeficients dictionary + dictionary SRFModelCoeffs_; + + //- Angular velocity of the frame (rad/s) + dimensionedVector omega_; + + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + SRFModel(const SRFModel&); + + //- Disallow default bitwise assignment + void operator=(const SRFModel&); + + +public: + + //- Runtime type information + TypeName("SRFModel"); + + + // Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + SRFModel, + dictionary, + ( + const volVectorField& Urel + ), + (Urel) + ); + + + // Constructors + + //- Construct from components + SRFModel + ( + const word& type, + const volVectorField& Urel + ); + + + // Selectors + + //- Return a reference to the selected SRF model + static autoPtr New + ( + const volVectorField& Urel + ); + + + // Destructor + + virtual ~SRFModel(); + + + // Member Functions + + // Edit + + //- Read radiationProperties dictionary + virtual bool read(); + + + // Access + + //- Return the axis of rotation + const vector& axis() const; + + //- Return the angular velocity field [rad/s] + const dimensionedVector& omega() const; + + //- Return the coriolis force + tmp > Fcoriolis() const; + + //- Return the centrifugal force + tmp > Fcentrifugal() const; + + //- Source term component for momentum equation + tmp > Su() const; + + //- Return velocity vector from positions + vectorField velocity(const vectorField& positions) const; + + //- Return velocity of SRF for complete mesh + tmp U() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace SRF +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // + diff --git a/src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/newSRFModel.C b/src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/newSRFModel.C new file mode 100644 index 0000000000..c359e6d162 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/newSRFModel.C @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 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 + +Description + +\*---------------------------------------------------------------------------*/ + +#include "SRFModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace SRF +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +autoPtr SRFModel::New +( + const volVectorField& Urel +) +{ + word SRFModelTypeName; + + // Enclose the creation of the SRFPropertiesDict to ensure it is + // deleted before the SRFModel is created - otherwise the dictionary + // is entered in the database twice + { + IOdictionary SRFPropertiesDict + ( + IOobject + ( + "SRFProperties", + Urel.mesh().time().constant(), + Urel.mesh().db(), + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + SRFPropertiesDict.lookup("SRFModel") >> SRFModelTypeName; + } + + Info<< "Selecting SRFModel " << SRFModelTypeName << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(SRFModelTypeName); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "SRFModel::New(const fvMesh&)" + ) << "Unknown SRFModel type " << SRFModelTypeName + << nl << nl + << "Valid SRFModel types are :" << nl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(Urel)); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace SRF +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.C b/src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.C new file mode 100644 index 0000000000..13c023cf27 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.C @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 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 + +Description + +\*---------------------------------------------------------------------------*/ + +#include "rpm.H" +#include "addToRunTimeSelectionTable.H" +#include "mathematicalConstants.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace SRF + { + defineTypeNameAndDebug(rpm, 0); + + addToRunTimeSelectionTable + ( + SRFModel, + rpm, + dictionary + ); + } +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::SRF::rpm::rpm +( + const volVectorField& U +) +: + SRFModel(typeName, U), + rpm_(readScalar(SRFModelCoeffs_.lookup("rpm"))) +{ + // Initialise the angular velocity + omega_.value() = axis_*rpm_*2.0*mathematicalConstant::pi/60.0; +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::SRF::rpm::~rpm() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::SRF::rpm::read() +{ + if (SRFModel::read()) + { + // Re-read rpm + SRFModelCoeffs_.lookup("rpm") >> rpm_; + + // Update angular velocity + omega_.value() = axis_*rpm_*(2.0*mathematicalConstant::pi/60.0); + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.H b/src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.H new file mode 100644 index 0000000000..c341ac3e8b --- /dev/null +++ b/src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.H @@ -0,0 +1,107 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 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::SRF::rpm + +Description + Basic SRF model whereby angular velocity is specified in terms of + a (global) axis and revolutions-per-minute [rpm] + +SourceFiles + rpm.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SRFModelRpm_H +#define SRFModelRpm_H + +#include "SRFModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace SRF +{ + +/*---------------------------------------------------------------------------*\ + Class rpm Declaration +\*---------------------------------------------------------------------------*/ + +class rpm +: + public SRFModel +{ + + // Private data + + //- Revolutions per minute + scalar rpm_; + + + // Private member functions + + //- Disallow default bitwise copy construct + rpm(const rpm&); + + //- Disallow default bitwise assignment + void operator=(const rpm&); + + +public: + + //- Runtime type information + TypeName("rpm"); + + + // Constructors + + //- Construct from components + rpm(const volVectorField& U); + + + // Destructor + + ~rpm(); + + // Member functions + + // I-O + + //- Read + bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace SRF +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C new file mode 100644 index 0000000000..20562d4425 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C @@ -0,0 +1,181 @@ +/*---------------------------------------------------------------------------* \ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 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 "SRFVelocityFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" + +#include "SRFModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(p, iF), + relative_(0), + inletValue_(p.size(), vector::zero) +{} + + +SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField +( + const SRFVelocityFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchVectorField(ptf, p, iF, mapper), + relative_(ptf.relative_), + inletValue_(ptf.inletValue_, mapper) +{} + + +SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchVectorField(p, iF), + relative_(dict.lookup("relative")), + inletValue_("inletValue", dict, p.size()) +{ + fvPatchVectorField::operator=(vectorField("value", dict, p.size())); +} + + +SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField +( + const SRFVelocityFvPatchVectorField& srfvpvf +) +: + fixedValueFvPatchVectorField(srfvpvf), + relative_(srfvpvf.relative_), + inletValue_(srfvpvf.inletValue_) +{} + + +SRFVelocityFvPatchVectorField::SRFVelocityFvPatchVectorField +( + const SRFVelocityFvPatchVectorField& srfvpvf, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(srfvpvf, iF), + relative_(srfvpvf.relative_), + inletValue_(srfvpvf.inletValue_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void SRFVelocityFvPatchVectorField::autoMap +( + const fvPatchFieldMapper& m +) +{ + vectorField::autoMap(m); + inletValue_.autoMap(m); +} + + +void SRFVelocityFvPatchVectorField::rmap +( + const fvPatchVectorField& ptf, + const labelList& addr +) +{ + fixedValueFvPatchVectorField::rmap(ptf, addr); + + const SRFVelocityFvPatchVectorField& tiptf = + refCast(ptf); + + inletValue_.rmap(tiptf.inletValue_, addr); +} + + +void SRFVelocityFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + // If relative, include the effect of the SRF + if (relative_) + { + // Get reference to the SRF model + const SRF::SRFModel& srf = + db().lookupObject("SRFProperties"); + + // Determine patch velocity due to SRF + const vectorField SRFVelocity = srf.velocity(patch().Cf()); + + operator==(SRFVelocity + inletValue_); + } + // If absolute, simply supply the inlet value as a fixed value + else + { + operator==(inletValue_); + } + + fixedValueFvPatchVectorField::updateCoeffs(); +} + + +void SRFVelocityFvPatchVectorField::write(Ostream& os) const +{ + fvPatchVectorField::write(os); + os.writeKeyword("relative") << relative_ << token::END_STATEMENT << nl; + inletValue_.writeEntry("inletValue", os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchVectorField, + SRFVelocityFvPatchVectorField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.H b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.H new file mode 100644 index 0000000000..9383887bcd --- /dev/null +++ b/src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.H @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 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::SRFVelocityFvPatchVectorField + +Description + Velocity patch to be used with SRF model + +SourceFiles + SRFVelocityFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SRFVelocityFvPatchVectorField_H +#define SRFVelocityFvPatchVectorField_H + +#include "fvPatchFields.H" +#include "fixedValueFvPatchFields.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class SRFVelocityFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class SRFVelocityFvPatchVectorField +: + public fixedValueFvPatchVectorField +{ + // Private data + + //- Is the supplied inlet value relative to the SRF + Switch relative_; + + //- Inlet value + vectorField inletValue_; + + +public: + + //- Runtime type information + TypeName("SRFVelocity"); + + + // Constructors + + //- Construct from patch and internal field + SRFVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + SRFVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given SRFVelocityFvPatchVectorField + // onto a new patch + SRFVelocityFvPatchVectorField + ( + const SRFVelocityFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + SRFVelocityFvPatchVectorField + ( + const SRFVelocityFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new SRFVelocityFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + SRFVelocityFvPatchVectorField + ( + const SRFVelocityFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new SRFVelocityFvPatchVectorField(*this, iF) + ); + } + + + // Member functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchVectorField&, + const labelList& + ); + + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/tutorials/simpleSRFFoam/Allclean b/tutorials/simpleSRFFoam/Allclean new file mode 100755 index 0000000000..84e497ae85 --- /dev/null +++ b/tutorials/simpleSRFFoam/Allclean @@ -0,0 +1,16 @@ +#!/bin/sh + +currDir=`pwd` +application=`basename $currDir` +cases="mixer" + +tutorialPath=`dirname $0`/.. +. $tutorialPath/CleanFunctions + +wclean $application + +for case in $cases +do + cleanCase $case +done + diff --git a/tutorials/simpleSRFFoam/Allrun b/tutorials/simpleSRFFoam/Allrun new file mode 100755 index 0000000000..d235878a47 --- /dev/null +++ b/tutorials/simpleSRFFoam/Allrun @@ -0,0 +1,16 @@ +#!/bin/sh + +currDir=`pwd` +application=`basename $currDir` +cases="mixer" + +tutorialPath=`dirname $0`/.. +. $tutorialPath/RunFunctions + +compileApplication $currDir $application + +for case in $cases +do + runApplication blockMesh $case + runApplication $application $case +done diff --git a/tutorials/simpleSRFFoam/mixer/0/Urel b/tutorials/simpleSRFFoam/mixer/0/Urel new file mode 100644 index 0000000000..b843c7858b --- /dev/null +++ b/tutorials/simpleSRFFoam/mixer/0/Urel @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.4 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + + root ""; + case ""; + instance ""; + local ""; + + class volVectorField; + object Urel; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type SRFVelocity; + inletValue uniform (0 0 -10); + relative yes; + value uniform (0 0 0); + } + + outlet + { + type zeroGradient; + } + + innerWall + { + type fixedValue; + value uniform (0 0 0); + } + + outerWall + { + type SRFVelocity; + inletValue uniform (0 0 0); + relative yes; + value uniform (0 0 0); + } + + cyclic + { + type cyclic; + } +} + + +// ************************************************************************* // diff --git a/tutorials/simpleSRFFoam/mixer/0/epsilon b/tutorials/simpleSRFFoam/mixer/0/epsilon new file mode 100644 index 0000000000..6bc667ad42 --- /dev/null +++ b/tutorials/simpleSRFFoam/mixer/0/epsilon @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.4 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + + root ""; + case ""; + instance ""; + local ""; + + class volScalarField; + object epsilon; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +dimensions [0 2 -3 0 0 0 0]; + +internalField uniform 14.855; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform 14.855; + } + + outlet + { + type zeroGradient; + } + + innerWall + { + type zeroGradient; + } + + outerWall + { + type zeroGradient; + } + + cyclic + { + type cyclic; + } +} + + +// ************************************************************************* // diff --git a/tutorials/simpleSRFFoam/mixer/0/k b/tutorials/simpleSRFFoam/mixer/0/k new file mode 100644 index 0000000000..3c971a95cb --- /dev/null +++ b/tutorials/simpleSRFFoam/mixer/0/k @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.4 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + + root ""; + case ""; + instance ""; + local ""; + + class volScalarField; + object k; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0.375; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform 0.375; + } + + outlet + { + type zeroGradient; + } + + innerWall + { + type zeroGradient; + } + + outerWall + { + type zeroGradient; + } + + cyclic + { + type cyclic; + } +} + + +// ************************************************************************* // diff --git a/tutorials/simpleSRFFoam/mixer/0/omega b/tutorials/simpleSRFFoam/mixer/0/omega new file mode 100644 index 0000000000..b86edc6412 --- /dev/null +++ b/tutorials/simpleSRFFoam/mixer/0/omega @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.4 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + + root ""; + case ""; + instance ""; + local ""; + + class volScalarField; + object omega; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +dimensions [0 0 -1 0 0 0 0]; + +internalField uniform 3.5; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform 3.5; + } + + outlet + { + type zeroGradient; + } + + innerWall + { + type zeroGradient; + } + + outerWall + { + type zeroGradient; + } + + cyclic + { + type cyclic; + } +} + + +// ************************************************************************* // diff --git a/tutorials/simpleSRFFoam/mixer/0/p b/tutorials/simpleSRFFoam/mixer/0/p new file mode 100644 index 0000000000..75fe0835e1 --- /dev/null +++ b/tutorials/simpleSRFFoam/mixer/0/p @@ -0,0 +1,60 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.4 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + + root ""; + case ""; + instance ""; + local ""; + + class volScalarField; + object p; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type zeroGradient; + } + + outlet + { + type fixedValue; + value uniform 0; + } + + innerWall + { + type zeroGradient; + } + + outerWall + { + type zeroGradient; + } + + cyclic + { + type cyclic; + } +} + + +// ************************************************************************* // diff --git a/tutorials/simpleSRFFoam/mixer/constant/SRFProperties b/tutorials/simpleSRFFoam/mixer/constant/SRFProperties new file mode 100644 index 0000000000..c7ba552f0f --- /dev/null +++ b/tutorials/simpleSRFFoam/mixer/constant/SRFProperties @@ -0,0 +1,35 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.4 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + + root ""; + case ""; + instance ""; + local ""; + + class dictionary; + object SRFProperties; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +SRFModel rpm; + +axis (0 0 1); + +rpmCoeffs +{ + rpm 5000.0; +} + + +// ************************************************************************* // diff --git a/tutorials/simpleSRFFoam/mixer/constant/polyMesh/blockMeshDict b/tutorials/simpleSRFFoam/mixer/constant/polyMesh/blockMeshDict new file mode 100644 index 0000000000..7ee95068a1 --- /dev/null +++ b/tutorials/simpleSRFFoam/mixer/constant/polyMesh/blockMeshDict @@ -0,0 +1,123 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.4 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + + root ""; + case ""; + instance ""; + local ""; + + class dictionary; + object blockMeshDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.1; + +vertices +( + ( 0.500 0.000 0.000) + ( 0.369 0.338 0.000) + ( 0.338 0.369 0.000) + ( 0.000 0.500 0.000) + ( 0.737 0.676 0.000) + ( 0.074 0.068 0.000) + ( 0.676 0.737 0.000) + ( 0.068 0.074 0.000) + ( 0.000 1.000 0.000) + ( 1.000 0.000 0.000) + ( 0.100 0.000 0.000) + ( 0.000 0.100 0.000) + ( 0.500 0.000 2.000) + ( 0.369 0.338 2.000) + ( 0.338 0.369 2.000) + ( 0.000 0.500 2.000) + ( 0.737 0.676 2.000) + ( 0.074 0.068 2.000) + ( 0.676 0.737 2.000) + ( 0.068 0.074 2.000) + ( 0.000 1.000 2.000) + ( 1.000 0.000 2.000) + ( 0.100 0.000 2.000) + ( 0.000 0.100 2.000) +); + +blocks +( + hex (1 0 9 4 13 12 21 16) (10 20 40) simpleGrading (1 1 1) + hex (2 1 4 6 14 13 16 18) (2 20 40) simpleGrading (1 1 1) + hex (3 2 6 8 15 14 18 20) (10 20 40) simpleGrading (1 1 1) + hex (5 10 0 1 17 22 12 13) (10 20 40) simpleGrading (1 1 1) + hex (11 7 2 3 23 19 14 15) (10 20 40) simpleGrading (1 1 1) +); + +edges +( + arc 0 1 ( 0.470 0.171 0.000 ) + arc 12 13 ( 0.470 0.171 2.000 ) + arc 2 3 ( 0.171 0.470 0.000 ) + arc 14 15 ( 0.171 0.470 2.000 ) + arc 9 4 ( 0.940 0.342 0.000 ) + arc 21 16 ( 0.940 0.342 2.000 ) + arc 5 10 ( 0.094 0.034 0.000 ) + arc 17 22 ( 0.094 0.034 2.000 ) + arc 6 8 ( 0.342 0.940 0.000 ) + arc 18 20 ( 0.342 0.940 2.000 ) + arc 11 7 ( 0.034 0.094 0.000 ) + arc 23 19 ( 0.034 0.094 2.000 ) +); + +patches +( + patch inlet + ( + (13 12 21 16) + (14 13 16 18) + (15 14 18 20) + (17 22 12 13) + (23 19 14 15) + ) + patch outlet + ( + (1 4 9 0) + (2 6 4 1) + (3 8 6 2) + (5 1 0 10) + (11 3 2 7) + ) + wall innerWall + ( + (2 1 13 14) + (5 10 22 17) + (5 17 13 1) + (11 7 19 23) + (7 2 14 19) + ) + wall outerWall + ( + (4 16 21 9) + (6 18 16 4) + (8 20 18 6) + ) + cyclic cyclic + ( + (0 9 21 12) + (10 0 12 22) + (3 15 20 8) + (11 23 15 3) + ) +); + +mergeMatchPairs +( +); diff --git a/tutorials/simpleSRFFoam/mixer/constant/transportProperties b/tutorials/simpleSRFFoam/mixer/constant/transportProperties new file mode 100644 index 0000000000..ab0e454728 --- /dev/null +++ b/tutorials/simpleSRFFoam/mixer/constant/transportProperties @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.4 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + + root ""; + case ""; + instance ""; + local ""; + + class dictionary; + object transportProperties; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +transportModel Newtonian; + +nu nu [0 2 -1 0 0 0 0] 1.5e-05; + +CrossPowerLawCoeffs +{ + nu0 nu0 [0 2 -1 0 0 0 0] 1e-06; + nuInf nuInf [0 2 -1 0 0 0 0] 1e-06; + m m [0 0 1 0 0 0 0] 1; + n n [0 0 0 0 0 0 0] 1; +} + +BirdCarreauCoeffs +{ + nu0 nu0 [0 2 -1 0 0 0 0] 1e-06; + nuInf nuInf [0 2 -1 0 0 0 0] 1e-06; + k k [0 0 1 0 0 0 0] 0; + n n [0 0 0 0 0 0 0] 1; +} + + +// ************************************************************************* // diff --git a/tutorials/simpleSRFFoam/mixer/constant/turbulenceProperties b/tutorials/simpleSRFFoam/mixer/constant/turbulenceProperties new file mode 100644 index 0000000000..65b42f0063 --- /dev/null +++ b/tutorials/simpleSRFFoam/mixer/constant/turbulenceProperties @@ -0,0 +1,198 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.4 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + + root ""; + case ""; + instance ""; + local ""; + + class dictionary; + object turbulenceProperties; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +turbulenceModel kOmegaSST; + +turbulence on; + +laminarCoeffs +{ +} + +kEpsilonCoeffs +{ + Cmu Cmu [0 0 0 0 0 0 0] 0.09; + C1 C1 [0 0 0 0 0 0 0] 1.44; + C2 C2 [0 0 0 0 0 0 0] 1.92; + alphaEps alphaEps [0 0 0 0 0 0 0] 0.76923; +} + +RNGkEpsilonCoeffs +{ + Cmu Cmu [0 0 0 0 0 0 0] 0.0845; + C1 C1 [0 0 0 0 0 0 0] 1.42; + C2 C2 [0 0 0 0 0 0 0] 1.68; + alphak alphaK [0 0 0 0 0 0 0] 1.39; + alphaEps alphaEps [0 0 0 0 0 0 0] 1.39; + eta0 eta0 [0 0 0 0 0 0 0] 4.38; + beta beta [0 0 0 0 0 0 0] 0.012; +} + +kOmegaSSTCoeffs +{ + alphaK1 alphaK1 [0 0 0 0 0 0 0] 0.85034; + alphaK2 alphaK1 [0 0 0 0 0 0 0] 1.0; + alphaOmega1 alphaOmega1 [0 0 0 0 0 0 0] 0.5; + alphaOmega2 alphaOmega2 [0 0 0 0 0 0 0] 0.85616; + gamma1 gamma1 [0 0 0 0 0 0 0] 0.5532; + gamma2 gamma2 [0 0 0 0 0 0 0] 0.4403; + beta1 beta1 [0 0 0 0 0 0 0] 0.0750; + beta2 beta2 [0 0 0 0 0 0 0] 0.0828; + betaStar betaStar [0 0 0 0 0 0 0] 0.09; + a1 a1 [0 0 0 0 0 0 0] 0.31; + c1 c1 [0 0 0 0 0 0 0] 10; + + Cmu Cmu [0 0 0 0 0 0 0] 0.09; +} + +NonlinearKEShihCoeffs +{ + Cmu Cmu [0 0 0 0 0 0 0] 0.09; + C1 C1 [0 0 0 0 0 0 0] 1.44; + C2 C2 [0 0 0 0 0 0 0] 1.92; + alphak alphak [0 0 0 0 0 0 0] 1; + alphaEps alphaEps [0 0 0 0 0 0 0] 0.76932; + A1 A1 [0 0 0 0 0 0 0] 1.25; + A2 A2 [0 0 0 0 0 0 0] 1000; + Ctau1 Ctau1 [0 0 0 0 0 0 0] -4; + Ctau2 Ctau2 [0 0 0 0 0 0 0] 13; + Ctau3 Ctau3 [0 0 0 0 0 0 0] -2; + alphaKsi alphaKsi [0 0 0 0 0 0 0] 0.9; +} + +LienCubicKECoeffs +{ + C1 C1 [0 0 0 0 0 0 0] 1.44; + C2 C2 [0 0 0 0 0 0 0] 1.92; + alphak alphak [0 0 0 0 0 0 0] 1; + alphaEps alphaEps [0 0 0 0 0 0 0] 0.76923; + A1 A1 [0 0 0 0 0 0 0] 1.25; + A2 A2 [0 0 0 0 0 0 0] 1000; + Ctau1 Ctau1 [0 0 0 0 0 0 0] -4; + Ctau2 Ctau2 [0 0 0 0 0 0 0] 13; + Ctau3 Ctau3 [0 0 0 0 0 0 0] -2; + alphaKsi alphaKsi [0 0 0 0 0 0 0] 0.9; +} + +QZetaCoeffs +{ + Cmu Cmu [0 0 0 0 0 0 0] 0.09; + C1 C1 [0 0 0 0 0 0 0] 1.44; + C2 C2 [0 0 0 0 0 0 0] 1.92; + alphaZeta alphaZeta [0 0 0 0 0 0 0] 0.76923; + anisotropic no; +} + +LaunderSharmaKECoeffs +{ + Cmu Cmu [0 0 0 0 0 0 0] 0.09; + C1 C1 [0 0 0 0 0 0 0] 1.44; + C2 C2 [0 0 0 0 0 0 0] 1.92; + alphaEps alphaEps [0 0 0 0 0 0 0] 0.76923; +} + +LamBremhorstKECoeffs +{ + Cmu Cmu [0 0 0 0 0 0 0] 0.09; + C1 C1 [0 0 0 0 0 0 0] 1.44; + C2 C2 [0 0 0 0 0 0 0] 1.92; + alphaEps alphaEps [0 0 0 0 0 0 0] 0.76923; +} + +LienCubicKELowReCoeffs +{ + Cmu Cmu [0 0 0 0 0 0 0] 0.09; + C1 C1 [0 0 0 0 0 0 0] 1.44; + C2 C2 [0 0 0 0 0 0 0] 1.92; + alphak alphak [0 0 0 0 0 0 0] 1; + alphaEps alphaEps [0 0 0 0 0 0 0] 0.76923; + A1 A1 [0 0 0 0 0 0 0] 1.25; + A2 A2 [0 0 0 0 0 0 0] 1000; + Ctau1 Ctau1 [0 0 0 0 0 0 0] -4; + Ctau2 Ctau2 [0 0 0 0 0 0 0] 13; + Ctau3 Ctau3 [0 0 0 0 0 0 0] -2; + alphaKsi alphaKsi [0 0 0 0 0 0 0] 0.9; + Am Am [0 0 0 0 0 0 0] 0.016; + Aepsilon Aepsilon [0 0 0 0 0 0 0] 0.263; + Amu Amu [0 0 0 0 0 0 0] 0.00222; +} + +LienLeschzinerLowReCoeffs +{ + Cmu Cmu [0 0 0 0 0 0 0] 0.09; + C1 C1 [0 0 0 0 0 0 0] 1.44; + C2 C2 [0 0 0 0 0 0 0] 1.92; + alphak alphak [0 0 0 0 0 0 0] 1; + alphaEps alphaEps [0 0 0 0 0 0 0] 0.76923; + Am Am [0 0 0 0 0 0 0] 0.016; + Aepsilon Aepsilon [0 0 0 0 0 0 0] 0.263; + Amu Amu [0 0 0 0 0 0 0] 0.00222; +} + +LRRCoeffs +{ + Cmu Cmu [0 0 0 0 0 0 0] 0.09; + Clrr1 Clrr1 [0 0 0 0 0 0 0] 1.8; + Clrr2 Clrr2 [0 0 0 0 0 0 0] 0.6; + C1 C1 [0 0 0 0 0 0 0] 1.44; + C2 C2 [0 0 0 0 0 0 0] 1.92; + Cs Cs [0 0 0 0 0 0 0] 0.25; + Ceps Ceps [0 0 0 0 0 0 0] 0.15; + alphaEps alphaEps [0 0 0 0 0 0 0] 0.76923; +} + +LaunderGibsonRSTMCoeffs +{ + Cmu Cmu [0 0 0 0 0 0 0] 0.09; + Clg1 Clg1 [0 0 0 0 0 0 0] 1.8; + Clg2 Clg2 [0 0 0 0 0 0 0] 0.6; + C1 C1 [0 0 0 0 0 0 0] 1.44; + C2 C2 [0 0 0 0 0 0 0] 1.92; + C1Ref C1Ref [0 0 0 0 0 0 0] 0.5; + C2Ref C2Ref [0 0 0 0 0 0 0] 0.3; + Cs Cs [0 0 0 0 0 0 0] 0.25; + Ceps Ceps [0 0 0 0 0 0 0] 0.15; + alphaEps alphaEps [0 0 0 0 0 0 0] 0.76923; + alphaR alphaR [0 0 0 0 0 0 0] 1.22; +} + +SpalartAllmarasCoeffs +{ + alphaNut alphaNut [0 0 0 0 0 0 0] 1.5; + Cb1 Cb1 [0 0 0 0 0 0 0] 0.1355; + Cb2 Cb2 [0 0 0 0 0 0 0] 0.622; + Cw2 Cw2 [0 0 0 0 0 0 0] 0.3; + Cw3 Cw3 [0 0 0 0 0 0 0] 2; + Cv1 Cv1 [0 0 0 0 0 0 0] 7.1; + Cv2 Cv2 [0 0 0 0 0 0 0] 5.0; +} + +wallFunctionCoeffs +{ + kappa kappa [0 0 0 0 0 0 0] 0.4187; + E E [0 0 0 0 0 0 0] 9; +} + + +// ************************************************************************* // diff --git a/tutorials/simpleSRFFoam/mixer/system/controlDict b/tutorials/simpleSRFFoam/mixer/system/controlDict new file mode 100644 index 0000000000..a69778d53d --- /dev/null +++ b/tutorials/simpleSRFFoam/mixer/system/controlDict @@ -0,0 +1,56 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.4 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + + root ""; + case ""; + instance ""; + local ""; + + class dictionary; + object controlDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application simpleSRFFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 1000; + +deltaT 1; + +writeControl timeStep; + +writeInterval 100; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + + +// ************************************************************************* // diff --git a/tutorials/simpleSRFFoam/mixer/system/fvSchemes b/tutorials/simpleSRFFoam/mixer/system/fvSchemes new file mode 100644 index 0000000000..c372f564ad --- /dev/null +++ b/tutorials/simpleSRFFoam/mixer/system/fvSchemes @@ -0,0 +1,80 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.4 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + + root ""; + case ""; + instance ""; + local ""; + + class dictionary; + object fvSchemes; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default steadyState; +} + +gradSchemes +{ + default Gauss linear; + grad(p) Gauss linear; + grad(Urel) Gauss linear; +} + +divSchemes +{ + default none; + div(phi,Urel) Gauss upwind; + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; + div(phi,omega) Gauss upwind; + div(phi,R) Gauss upwind; + div(R) Gauss linear; + div(phi,nuTilda) Gauss upwind; + div((nuEff*dev(grad(Urel).T()))) Gauss linear; +} + +laplacianSchemes +{ + default none; + laplacian(nuEff,Urel) Gauss linear corrected; + laplacian((1|A(Urel)),p) Gauss linear corrected; + laplacian(DkEff,k) Gauss linear corrected; + laplacian(DepsilonEff,epsilon) Gauss linear corrected; + laplacian(DomegaEff,omega) Gauss linear corrected; + laplacian(DREff,R) Gauss linear corrected; + laplacian(DnuTildaEff,nuTilda) Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; + interpolate(Urel) linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p; +} + + +// ************************************************************************* // diff --git a/tutorials/simpleSRFFoam/mixer/system/fvSolution b/tutorials/simpleSRFFoam/mixer/system/fvSolution new file mode 100644 index 0000000000..c8b1fd40a4 --- /dev/null +++ b/tutorials/simpleSRFFoam/mixer/system/fvSolution @@ -0,0 +1,88 @@ +/*---------------------------------------------------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.4 | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + + root ""; + case ""; + instance ""; + local ""; + + class dictionary; + object fvSolution; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p PCG + { + preconditioner DIC; + tolerance 1e-06; + relTol 0.01; + }; + Urel PBiCG + { + preconditioner DILU; + tolerance 1e-05; + relTol 0.1; + }; + k PBiCG + { + preconditioner DILU; + tolerance 1e-05; + relTol 0.1; + }; + epsilon PBiCG + { + preconditioner DILU; + tolerance 1e-05; + relTol 0.1; + }; + omega PBiCG + { + preconditioner DILU; + tolerance 1e-05; + relTol 0.1; + }; + R PBiCG + { + preconditioner DILU; + tolerance 1e-05; + relTol 0.1; + }; + nuTilda PBiCG + { + preconditioner DILU; + tolerance 1e-05; + relTol 0.1; + }; +} + +SIMPLE +{ + nNonOrthogonalCorrectors 0; +} + +relaxationFactors +{ + p 0.3; + Urel 0.7; + k 0.7; + epsilon 0.7; + omega 0.7; + R 0.7; + nuTilda 0.7; +} + + +// ************************************************************************* // diff --git a/tutorials/simpleSRFFoam/simpleSRFFoam/Make/files b/tutorials/simpleSRFFoam/simpleSRFFoam/Make/files new file mode 100644 index 0000000000..cd5e01f8b4 --- /dev/null +++ b/tutorials/simpleSRFFoam/simpleSRFFoam/Make/files @@ -0,0 +1,3 @@ +simpleSRFFoam.C + +EXE = $(FOAM_USER_APPBIN)/simpleSRFFoam diff --git a/tutorials/simpleSRFFoam/simpleSRFFoam/Make/options b/tutorials/simpleSRFFoam/simpleSRFFoam/Make/options new file mode 100644 index 0000000000..35a2464b97 --- /dev/null +++ b/tutorials/simpleSRFFoam/simpleSRFFoam/Make/options @@ -0,0 +1,10 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/turbulenceModels \ + -I$(LIB_SRC)/transportModels + +EXE_LIBS = \ + -lincompressibleTurbulenceModels \ + -lincompressibleTransportModels \ + -lfiniteVolume \ + -lmeshTools diff --git a/tutorials/simpleSRFFoam/simpleSRFFoam/createFields.H b/tutorials/simpleSRFFoam/simpleSRFFoam/createFields.H new file mode 100644 index 0000000000..2ef0fc8b67 --- /dev/null +++ b/tutorials/simpleSRFFoam/simpleSRFFoam/createFields.H @@ -0,0 +1,74 @@ + Info << "Reading field p\n" << endl; + volScalarField p + ( + IOobject + ( + "p", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + Info<< "Reading field Urel\n" << endl; + volVectorField Urel + ( + IOobject + ( + "Urel", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + // Create absolute velocity field (post-processing only) + // Will be updated before first use, so can be initialised by Urel + Info<< "Creating field Uabs\n" << endl; + volVectorField Uabs + ( + IOobject + ( + "Uabs", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + Urel + ); + + Info<< "Reading/calculating face flux field phi\n" << endl; + surfaceScalarField phi + ( + IOobject + ( + "phi", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + linearInterpolate(Urel) & mesh.Sf() + ); + + label pRefCell = 0; + scalar pRefValue = 0.0; + setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue); + + singlePhaseTransportModel laminarTransport(Urel, phi); + + autoPtr turbulence + ( + turbulenceModel::New(Urel, phi, laminarTransport) + ); + + Info<< "Creating SRF model\n" << endl; + autoPtr SRF + ( + SRF::SRFModel::New(Urel) + ); diff --git a/tutorials/simpleSRFFoam/simpleSRFFoam/simpleSRFFoam.C b/tutorials/simpleSRFFoam/simpleSRFFoam/simpleSRFFoam.C new file mode 100644 index 0000000000..4ae921d487 --- /dev/null +++ b/tutorials/simpleSRFFoam/simpleSRFFoam/simpleSRFFoam.C @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 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 + +Application + simpleSRFFoam + +Description + Steady-state solver for incompressible, turbulent flow of non-Newtonian + fluids with single rotating frame. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" +#include "SRFModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + +# include "setRootCase.H" + +# include "createTime.H" +# include "createMesh.H" +# include "createFields.H" +# include "initContinuityErrs.H" + + //mesh.clearPrimitives(); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + for (runTime++; !runTime.end(); runTime++) + { + Info<< "Time = " << runTime.timeName() << nl << endl; + +# include "readSIMPLEControls.H" + + p.storePrevIter(); + + // Pressure-velocity SIMPLE corrector + { + // Momentum predictor + tmp UrelEqn + ( + fvm::div(phi, Urel) + + turbulence->divDevReff(Urel) + + SRF->Su() + ); + + UrelEqn().relax(); + + solve(UrelEqn() == -fvc::grad(p)); + + p.boundaryField().updateCoeffs(); + volScalarField AUrel = UrelEqn().A(); + Urel = UrelEqn().H()/AUrel; + UrelEqn.clear(); + phi = fvc::interpolate(Urel) & mesh.Sf(); + adjustPhi(phi, Urel, p); + + // Non-orthogonal pressure corrector loop + for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + { + fvScalarMatrix pEqn + ( + fvm::laplacian(1.0/AUrel, p) == fvc::div(phi) + ); + + pEqn.setReference(pRefCell, pRefValue); + pEqn.solve(); + + if (nonOrth == nNonOrthCorr) + { + phi -= pEqn.flux(); + } + } + +# include "continuityErrs.H" + + // Explicitly relax pressure for momentum corrector + p.relax(); + + // Momentum corrector + Urel -= fvc::grad(p)/AUrel; + Urel.correctBoundaryConditions(); + } + + turbulence->correct(); + + Uabs = Urel + SRF->U(); + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return(0); +} + + +// ************************************************************************* //