diff --git a/applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMTurbulenceModels.C b/applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMTurbulenceModels.C index 66b480df0..ae345c206 100644 --- a/applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMTurbulenceModels.C +++ b/applications/solvers/lagrangian/DPMFoam/DPMTurbulenceModels/DPMTurbulenceModels.C @@ -28,8 +28,8 @@ License #include "addToRunTimeSelectionTable.H" #include "makeTurbulenceModel.H" -#include "laminar.H" -#include "turbulentTransportModel.H" +#include "laminarModel.H" +#include "RASModel.H" #include "LESModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,6 +52,10 @@ makeBaseTurbulenceModel singlePhaseTransportModel ); +#define makeLaminarModel(Type) \ + makeTemplatedTurbulenceModel \ + (singlePhaseTransportModelPhaseIncompressibleTurbulenceModel, laminar, Type) + #define makeRASModel(Type) \ makeTemplatedTurbulenceModel \ (singlePhaseTransportModelPhaseIncompressibleTurbulenceModel, RAS, Type) @@ -60,6 +64,9 @@ makeBaseTurbulenceModel makeTemplatedTurbulenceModel \ (singlePhaseTransportModelPhaseIncompressibleTurbulenceModel, LES, Type) +#include "Stokes.H" +makeLaminarModel(Stokes); + #include "kEpsilon.H" makeRASModel(kEpsilon); diff --git a/applications/solvers/multiphase/driftFluxFoam/compressibleTurbulenceModels.C b/applications/solvers/multiphase/driftFluxFoam/compressibleTurbulenceModels.C index 4cb722f5f..abf89c150 100644 --- a/applications/solvers/multiphase/driftFluxFoam/compressibleTurbulenceModels.C +++ b/applications/solvers/multiphase/driftFluxFoam/compressibleTurbulenceModels.C @@ -28,7 +28,7 @@ License #include "addToRunTimeSelectionTable.H" #include "makeTurbulenceModel.H" -#include "laminar.H" +#include "laminarModel.H" #include "RASModel.H" #include "LESModel.H" @@ -52,6 +52,14 @@ makeBaseTurbulenceModel incompressibleTwoPhaseInteractingMixture ); +#define makeLaminarModel(Type) \ + makeTemplatedTurbulenceModel \ + ( \ + incompressibleTwoPhaseInteractingMixtureCompressibleTurbulenceModel, \ + laminar, \ + Type \ + ) + #define makeRASModel(Type) \ makeTemplatedTurbulenceModel \ ( \ @@ -68,6 +76,9 @@ makeBaseTurbulenceModel Type \ ) +#include "Stokes.H" +makeLaminarModel(Stokes); + #include "kEpsilon.H" makeRASModel(kEpsilon); diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseCompressibleTurbulenceModels/multiphaseCompressibleTurbulenceModels.C b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseCompressibleTurbulenceModels/multiphaseCompressibleTurbulenceModels.C index 083c2567f..92089901d 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseCompressibleTurbulenceModels/multiphaseCompressibleTurbulenceModels.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseCompressibleTurbulenceModels/multiphaseCompressibleTurbulenceModels.C @@ -27,7 +27,7 @@ License #include "addToRunTimeSelectionTable.H" #include "makeTurbulenceModel.H" -#include "laminar.H" +#include "laminarModel.H" #include "RASModel.H" #include "LESModel.H" @@ -53,6 +53,10 @@ makeBaseTurbulenceModel phaseModel ); +#define makeLaminarModel(Type) \ + makeTemplatedLaminarModel \ + (phaseModelPhaseCompressibleTurbulenceModel, laminar, Type) + #define makeRASModel(Type) \ makeTemplatedTurbulenceModel \ (phaseModelPhaseCompressibleTurbulenceModel, RAS, Type) @@ -61,6 +65,9 @@ makeBaseTurbulenceModel makeTemplatedTurbulenceModel \ (phaseModelPhaseCompressibleTurbulenceModel, LES, Type) +#include "Stokes.H" +makeLaminarModel(Stokes); + #include "kEpsilon.H" makeRASModel(kEpsilon); diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModels.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModels.C index bd04977f2..bcf791161 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModels.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModels.C @@ -27,7 +27,7 @@ License #include "addToRunTimeSelectionTable.H" #include "makeTurbulenceModel.H" -#include "laminar.H" +#include "laminarModel.H" #include "RASModel.H" #include "LESModel.H" @@ -53,6 +53,10 @@ makeBaseTurbulenceModel phaseModel ); +#define makeLaminarModel(Type) \ + makeTemplatedLaminarModel \ + (phaseModelPhaseCompressibleTurbulenceModel, laminar, Type) + #define makeRASModel(Type) \ makeTemplatedTurbulenceModel \ (phaseModelPhaseCompressibleTurbulenceModel, RAS, Type) @@ -61,6 +65,9 @@ makeBaseTurbulenceModel makeTemplatedTurbulenceModel \ (phaseModelPhaseCompressibleTurbulenceModel, LES, Type) +#include "Stokes.H" +makeLaminarModel(Stokes); + #include "kEpsilon.H" makeRASModel(kEpsilon); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModels.C b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModels.C index c60dea0f7..687113656 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModels.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseCompressibleTurbulenceModels/phaseCompressibleTurbulenceModels.C @@ -32,7 +32,7 @@ License #include "ThermalDiffusivity.H" #include "EddyDiffusivity.H" -#include "laminar.H" +#include "laminarModel.H" #include "RASModel.H" #include "LESModel.H" @@ -58,6 +58,10 @@ makeBaseTurbulenceModel phaseModel ); +#define makeLaminarModel(Type) \ + makeTemplatedLaminarModel \ + (phaseModelPhaseCompressibleTurbulenceModel, laminar, Type) + #define makeRASModel(Type) \ makeTemplatedTurbulenceModel \ (phaseModelPhaseCompressibleTurbulenceModel, RAS, Type) @@ -66,6 +70,9 @@ makeBaseTurbulenceModel makeTemplatedTurbulenceModel \ (phaseModelPhaseCompressibleTurbulenceModel, LES, Type) +#include "Stokes.H" +makeLaminarModel(Stokes); + #include "kEpsilon.H" makeRASModel(kEpsilon); diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/makeTurbulenceModel.H b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/makeTurbulenceModel.H index da2dd7188..e4e5358e3 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/makeTurbulenceModel.H +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/makeTurbulenceModel.H @@ -34,7 +34,8 @@ License { \ typedef TDModel> \ Transport##BaseModel; \ - typedef laminar Laminar##Transport##BaseModel; \ + typedef laminarModel \ + laminar##Transport##BaseModel; \ typedef RASModel> \ RAS##Transport##BaseModel; \ typedef LESModel> \ @@ -65,14 +66,18 @@ License Transport##BaseModel; \ \ \ - typedef laminar Laminar##Transport##BaseModel; \ + typedef laminarModel \ + laminar##Transport##BaseModel; \ \ - defineNamedTemplateTypeNameAndDebug(Laminar##Transport##BaseModel, 0); \ + defineNamedTemplateTypeNameAndDebug(laminar##Transport##BaseModel, 0); \ + \ + defineTemplateRunTimeSelectionTable \ + (laminar##Transport##BaseModel, dictionary); \ \ addToRunTimeSelectionTable \ ( \ Transport##baseModel, \ - Laminar##Transport##BaseModel, \ + laminar##Transport##BaseModel, \ dictionary \ ); \ \ @@ -110,6 +115,27 @@ License } +#define makeTemplatedLaminarModel(BaseModel, SType, Type) \ + typedef Foam::SType##Models::Type \ + Type##SType##BaseModel; \ + defineNamedTemplateTypeNameAndDebug(Type##SType##BaseModel, 0); \ + \ + namespace Foam \ + { \ + namespace SType##Models \ + { \ + typedef Type Type##SType##BaseModel; \ + \ + addToRunTimeSelectionTable \ + ( \ + SType##BaseModel, \ + Type##SType##BaseModel, \ + dictionary \ + ); \ + } \ + } + + #define makeTemplatedTurbulenceModel(BaseModel, SType, Type) \ typedef Foam::SType##Models::Type> \ Type##SType##BaseModel; \ diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModel.H b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModel.H index 330673850..98bc0b578 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModel.H +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModel.H @@ -46,6 +46,7 @@ SourceFiles #include "CompressibleTurbulenceModel.H" #include "ThermalDiffusivity.H" #include "EddyDiffusivity.H" +#include "laminarModel.H" #include "RASModel.H" #include "LESModel.H" #include "fluidThermo.H" @@ -59,6 +60,7 @@ namespace Foam typedef ThermalDiffusivity> turbulenceModel; + typedef laminarModel laminarModel; typedef RASModel> RASModel; typedef LESModel> LESModel; diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModels.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModels.C index 0bf0cf00e..83c184f49 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModels.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModels.C @@ -37,6 +37,15 @@ makeBaseTurbulenceModel fluidThermo ); + +// -------------------------------------------------------------------------- // +// Laminar models +// -------------------------------------------------------------------------- // + +#include "Stokes.H" +makeLaminarModel(Stokes); + + // -------------------------------------------------------------------------- // // RAS models // -------------------------------------------------------------------------- // diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModels.H b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModels.H index 67ba5cf4e..54b8c3ebe 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModels.H +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/turbulentFluidThermoModels.H @@ -32,7 +32,7 @@ License #include "ThermalDiffusivity.H" #include "EddyDiffusivity.H" -#include "laminar.H" +#include "laminarModel.H" #include "RASModel.H" #include "LESModel.H" @@ -48,6 +48,10 @@ makeTurbulenceModelTypes fluidThermo ); +#define makeLaminarModel(Type) \ + makeTemplatedLaminarModel \ + (fluidThermoCompressibleTurbulenceModel, laminar, Type) + #define makeRASModel(Type) \ makeTemplatedTurbulenceModel \ (fluidThermoCompressibleTurbulenceModel, RAS, Type) diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModel.H b/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModel.H index 31b9a37c1..268425e1a 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModel.H +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModel.H @@ -44,6 +44,7 @@ SourceFiles #define turbulentTransportModel_H #include "IncompressibleTurbulenceModel.H" +#include "laminarModel.H" #include "RASModel.H" #include "LESModel.H" #include "incompressible/transportModel/transportModel.H" @@ -56,6 +57,7 @@ namespace Foam { typedef IncompressibleTurbulenceModel turbulenceModel; + typedef laminarModel laminarModel; typedef RASModel RASModel; typedef LESModel LESModel; diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.C b/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.C index 31d3cfc90..1679dbcb4 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.C +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.C @@ -36,6 +36,15 @@ makeBaseTurbulenceModel transportModel ); + +// -------------------------------------------------------------------------- // +// Laminar models +// -------------------------------------------------------------------------- // + +#include "Stokes.H" +makeLaminarModel(Stokes); + + // -------------------------------------------------------------------------- // // RAS models // -------------------------------------------------------------------------- // diff --git a/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.H b/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.H index c86c93ab7..b0501ac0a 100644 --- a/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.H +++ b/src/TurbulenceModels/incompressible/turbulentTransportModels/turbulentTransportModels.H @@ -28,7 +28,7 @@ License #include "addToRunTimeSelectionTable.H" #include "makeTurbulenceModel.H" -#include "laminar.H" +#include "laminarModel.H" #include "RASModel.H" #include "LESModel.H" @@ -43,6 +43,10 @@ makeTurbulenceModelTypes transportModel ); +#define makeLaminarModel(Type) \ + makeTemplatedTurbulenceModel \ + (transportModelIncompressibleTurbulenceModel, laminar, Type) + #define makeRASModel(Type) \ makeTemplatedTurbulenceModel \ (transportModelIncompressibleTurbulenceModel, RAS, Type) diff --git a/src/TurbulenceModels/turbulenceModels/laminar/laminar.C b/src/TurbulenceModels/turbulenceModels/laminar/Stokes/Stokes.C similarity index 75% rename from src/TurbulenceModels/turbulenceModels/laminar/laminar.C rename to src/TurbulenceModels/turbulenceModels/laminar/Stokes/Stokes.C index 2e60815a4..792e4c82a 100644 --- a/src/TurbulenceModels/turbulenceModels/laminar/laminar.C +++ b/src/TurbulenceModels/turbulenceModels/laminar/Stokes/Stokes.C @@ -23,17 +23,24 @@ License \*---------------------------------------------------------------------------*/ -#include "laminar.H" +#include "Stokes.H" #include "volFields.H" #include "surfaceFields.H" #include "fvcGrad.H" #include "fvcDiv.H" #include "fvmLaplacian.H" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace laminarModels +{ + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -Foam::laminar::laminar +Stokes::Stokes ( const alphaField& alpha, const rhoField& rho, @@ -44,7 +51,7 @@ Foam::laminar::laminar const word& propertiesName ) : - linearViscousStress + linearViscousStress> ( typeName, alpha, @@ -58,57 +65,26 @@ Foam::laminar::laminar {} -// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // - -template -Foam::autoPtr> -Foam::laminar::New -( - const alphaField& alpha, - const rhoField& rho, - const volVectorField& U, - const surfaceScalarField& alphaRhoPhi, - const surfaceScalarField& phi, - const transportModel& transport, - const word& propertiesName -) -{ - return autoPtr - ( - new laminar - ( - alpha, - rho, - U, - alphaRhoPhi, - phi, - transport, - propertiesName - ) - ); -} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -const Foam::dictionary& -Foam::laminar::coeffDict() const +const dictionary& +Stokes::coeffDict() const { return dictionary::null; } template -bool Foam::laminar::read() +bool Stokes::read() { return true; } template -Foam::tmp -Foam::laminar::nut() const +tmp +Stokes::nut() const { return tmp ( @@ -131,8 +107,8 @@ Foam::laminar::nut() const template -Foam::tmp -Foam::laminar::nut +tmp +Stokes::nut ( const label patchi ) const @@ -145,8 +121,8 @@ Foam::laminar::nut template -Foam::tmp -Foam::laminar::nuEff() const +tmp +Stokes::nuEff() const { return tmp ( @@ -159,8 +135,8 @@ Foam::laminar::nuEff() const template -Foam::tmp -Foam::laminar::nuEff +tmp +Stokes::nuEff ( const label patchi ) const @@ -170,8 +146,8 @@ Foam::laminar::nuEff template -Foam::tmp -Foam::laminar::k() const +tmp +Stokes::k() const { return tmp ( @@ -194,8 +170,8 @@ Foam::laminar::k() const template -Foam::tmp -Foam::laminar::epsilon() const +tmp +Stokes::epsilon() const { return tmp ( @@ -221,8 +197,8 @@ Foam::laminar::epsilon() const template -Foam::tmp -Foam::laminar::R() const +tmp +Stokes::R() const { return tmp ( @@ -248,10 +224,15 @@ Foam::laminar::R() const template -void Foam::laminar::correct() +void Stokes::correct() { - BasicTurbulenceModel::correct(); + laminarModel::correct(); } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace laminarModels +} // End namespace Foam + // ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/laminar.H b/src/TurbulenceModels/turbulenceModels/laminar/Stokes/Stokes.H similarity index 82% rename from src/TurbulenceModels/turbulenceModels/laminar/laminar.H rename to src/TurbulenceModels/turbulenceModels/laminar/Stokes/Stokes.H index 114287c0b..a714cbf29 100644 --- a/src/TurbulenceModels/turbulenceModels/laminar/laminar.H +++ b/src/TurbulenceModels/turbulenceModels/laminar/Stokes/Stokes.H @@ -22,34 +22,37 @@ License along with OpenFOAM. If not, see . Class - Foam::laminar + Foam::Stokes Description - Turbulence model for laminar flow. + Turbulence model for Stokes flow. SourceFiles - laminar.C + Stokes.C \*---------------------------------------------------------------------------*/ -#ifndef laminar_H -#define laminar_H +#ifndef Stokes_H +#define Stokes_H +#include "laminarModel.H" #include "linearViscousStress.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +namespace laminarModels +{ /*---------------------------------------------------------------------------* \ - Class laminar Declaration + Class Stokes Declaration \*---------------------------------------------------------------------------*/ template -class laminar +class Stokes : - public linearViscousStress + public linearViscousStress> { public: @@ -60,13 +63,13 @@ public: //- Runtime type information - TypeName("laminar"); + TypeName("Stokes"); // Constructors //- Construct from components - laminar + Stokes ( const alphaField& alpha, const rhoField& rho, @@ -81,7 +84,7 @@ public: // Selectors //- Return a reference to the selected turbulence model - static autoPtr New + static autoPtr New ( const alphaField& alpha, const rhoField& rho, @@ -94,7 +97,7 @@ public: //- Destructor - virtual ~laminar() + virtual ~Stokes() {} @@ -106,41 +109,42 @@ public: //- Read turbulenceProperties dictionary virtual bool read(); - //- Return the turbulence viscosity, i.e. 0 for laminar flow + //- Return the turbulence viscosity, i.e. 0 for Stokes flow virtual tmp nut() const; //- Return the turbulence viscosity on patch virtual tmp nut(const label patchi) const; - //- Return the effective viscosity, i.e. the laminar viscosity + //- Return the effective viscosity, i.e. the Stokes viscosity virtual tmp nuEff() const; //- Return the effective viscosity on patch virtual tmp nuEff(const label patchi) const; - //- Return the turbulence kinetic energy, i.e. 0 for laminar flow + //- Return the turbulence kinetic energy, i.e. 0 for Stokes flow virtual tmp k() const; //- Return the turbulence kinetic energy dissipation rate, - // i.e. 0 for laminar flow + // i.e. 0 for Stokes flow virtual tmp epsilon() const; - //- Return the Reynolds stress tensor, i.e. 0 for laminar flow + //- Return the Reynolds stress tensor, i.e. 0 for Stokes flow virtual tmp R() const; - //- Correct the laminar viscosity + //- Correct the Stokes viscosity virtual void correct(); }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace laminarModels } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "laminar.C" + #include "Stokes.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModel.C b/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModel.C new file mode 100644 index 000000000..0bd0bb49e --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModel.C @@ -0,0 +1,339 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "laminarModel.H" +#include "Stokes.H" + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +template +void Foam::laminarModel::printCoeffs(const word& type) +{ + if (printCoeffs_) + { + Info<< type << "Coeffs" << coeffDict_ << endl; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::laminarModel::laminarModel +( + const word& type, + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName +) +: + BasicTurbulenceModel + ( + type, + alpha, + rho, + U, + alphaRhoPhi, + phi, + transport, + propertiesName + ), + + laminarDict_(this->subOrEmptyDict("laminar")), + printCoeffs_(laminarDict_.lookupOrDefault("printCoeffs", false)), + coeffDict_(laminarDict_.subOrEmptyDict(type + "Coeffs")) +{ + // Force the construction of the mesh deltaCoeffs which may be needed + // for the construction of the derived models and BCs + this->mesh_.deltaCoeffs(); +} + + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +template +Foam::autoPtr> +Foam::laminarModel::New +( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName +) +{ + IOdictionary modelDict + ( + IOobject + ( + IOobject::groupName(propertiesName, U.group()), + U.time().constant(), + U.db(), + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE, + false + ) + ); + + if (modelDict.found("laminar")) + { + // get model name, but do not register the dictionary + // otherwise it is registered in the database twice + const word modelType + ( + modelDict.subDict("laminar").lookup("laminarModel") + ); + + Info<< "Selecting laminar stress model " << modelType << endl; + + typename dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown laminarModel type " + << modelType << nl << nl + << "Valid laminarModel types:" << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr + ( + cstrIter() + ( + alpha, + rho, + U, + alphaRhoPhi, + phi, + transport, propertiesName) + ); + } + else + { + Info<< "Selecting laminar stress model " + << laminarModels::Stokes::typeName << endl; + + return autoPtr + ( + new laminarModels::Stokes + ( + alpha, + rho, + U, + alphaRhoPhi, + phi, + transport, + propertiesName + ) + ); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::laminarModel::read() +{ + if (BasicTurbulenceModel::read()) + { + laminarDict_ <<= this->subDict("laminar"); + + if + ( + const dictionary* dictPtr = + laminarDict_.subDictPtr(type() + "Coeffs") + ) + { + coeffDict_ <<= *dictPtr; + } + + return true; + } + else + { + return false; + } +} + + +template +Foam::tmp +Foam::laminarModel::nut() const +{ + return tmp + ( + new volScalarField + ( + IOobject + ( + IOobject::groupName("nut", this->U_.group()), + this->runTime_.timeName(), + this->mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + this->mesh_, + dimensionedScalar("nut", dimViscosity, 0.0) + ) + ); +} + + +template +Foam::tmp +Foam::laminarModel::nut +( + const label patchi +) const +{ + return tmp + ( + new scalarField(this->mesh_.boundary()[patchi].size(), 0.0) + ); +} + + +template +Foam::tmp +Foam::laminarModel::nuEff() const +{ + return tmp + ( + new volScalarField + ( + IOobject::groupName("nuEff", this->U_.group()), this->nu() + ) + ); +} + + +template +Foam::tmp +Foam::laminarModel::nuEff +( + const label patchi +) const +{ + return this->nu(patchi); +} + + +template +Foam::tmp +Foam::laminarModel::k() const +{ + return tmp + ( + new volScalarField + ( + IOobject + ( + IOobject::groupName("k", this->U_.group()), + this->runTime_.timeName(), + this->mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + this->mesh_, + dimensionedScalar("k", sqr(this->U_.dimensions()), 0.0) + ) + ); +} + + +template +Foam::tmp +Foam::laminarModel::epsilon() const +{ + return tmp + ( + new volScalarField + ( + IOobject + ( + IOobject::groupName("epsilon", this->U_.group()), + this->runTime_.timeName(), + this->mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + this->mesh_, + dimensionedScalar + ( + "epsilon", sqr(this->U_.dimensions())/dimTime, 0.0 + ) + ) + ); +} + + +template +Foam::tmp +Foam::laminarModel::R() const +{ + return tmp + ( + new volSymmTensorField + ( + IOobject + ( + IOobject::groupName("R", this->U_.group()), + this->runTime_.timeName(), + this->mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + this->mesh_, + dimensionedSymmTensor + ( + "R", sqr(this->U_.dimensions()), Zero + ) + ) + ); +} + + +template +void Foam::laminarModel::correct() +{ + BasicTurbulenceModel::correct(); +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModel.H b/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModel.H new file mode 100644 index 000000000..ad5466e0f --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModel.H @@ -0,0 +1,208 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ 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 3 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, see . + +Class + Foam::laminarModel + +Description + Templated abstract base class for laminar transport models + +SourceFiles + laminarModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef laminarModel_H +#define laminarModel_H + +#include "TurbulenceModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class laminarModel Declaration +\*---------------------------------------------------------------------------*/ + +template +class laminarModel +: + public BasicTurbulenceModel +{ + +protected: + + // Protected data + + //- laminar coefficients dictionary + dictionary laminarDict_; + + //- Flag to print the model coeffs at run-time + Switch printCoeffs_; + + //- Model coefficients dictionary + dictionary coeffDict_; + + + // Protected Member Functions + + //- Print model coefficients + virtual void printCoeffs(const word& type); + + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + laminarModel(const laminarModel&); + + //- Disallow default bitwise assignment + void operator=(const laminarModel&); + + +public: + + typedef typename BasicTurbulenceModel::alphaField alphaField; + typedef typename BasicTurbulenceModel::rhoField rhoField; + typedef typename BasicTurbulenceModel::transportModel transportModel; + + + //- Runtime type information + TypeName("laminar"); + + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + laminarModel, + dictionary, + ( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName + ), + (alpha, rho, U, alphaRhoPhi, phi, transport, propertiesName) + ); + + + // Constructors + + //- Construct from components + laminarModel + ( + const word& type, + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName + ); + + + // Selectors + + //- Return a reference to the selected laminar model + static autoPtr New + ( + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName = turbulenceModel::propertiesName + ); + + + //- Destructor + virtual ~laminarModel() + {} + + + // Member Functions + + //- Read model coefficients if they have changed + virtual bool read(); + + + // Access + + //- Const access to the coefficients dictionary + virtual const dictionary& coeffDict() const + { + return coeffDict_; + } + + //- Return the turbulence viscosity, i.e. 0 for laminar flow + virtual tmp nut() const; + + //- Return the turbulence viscosity on patch + virtual tmp nut(const label patchi) const; + + //- Return the effective viscosity, i.e. the laminar viscosity + virtual tmp nuEff() const; + + //- Return the effective viscosity on patch + virtual tmp nuEff(const label patchi) const; + + //- Return the turbulence kinetic energy, i.e. 0 for laminar flow + virtual tmp k() const; + + //- Return the turbulence kinetic energy dissipation rate, + // i.e. 0 for laminar flow + virtual tmp epsilon() const; + + //- Return the Reynolds stress tensor, i.e. 0 for laminar flow + virtual tmp R() const; + + //- Correct the laminar transport + virtual void correct(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "laminarModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModelDoc.H b/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModelDoc.H new file mode 100644 index 000000000..e58e1c6d4 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/laminar/laminarModel/laminarModelDoc.H @@ -0,0 +1,32 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\/ 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 3 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, see . + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +\defgroup grpLaminar laminar transport model +@{ + \ingroup grpTurbulence + This group contains laminar models. +@} + +\*---------------------------------------------------------------------------*/ diff --git a/src/TurbulenceModels/turbulenceModels/makeTurbulenceModel.H b/src/TurbulenceModels/turbulenceModels/makeTurbulenceModel.H index 1b226749e..64ba83fee 100644 --- a/src/TurbulenceModels/turbulenceModels/makeTurbulenceModel.H +++ b/src/TurbulenceModels/turbulenceModels/makeTurbulenceModel.H @@ -28,7 +28,8 @@ License namespace Foam \ { \ typedef BaseModel Transport##BaseModel; \ - typedef laminar Laminar##Transport##BaseModel; \ + typedef laminarModel \ + laminar##Transport##BaseModel; \ typedef RASModel RAS##Transport##BaseModel; \ typedef LESModel LES##Transport##BaseModel; \ } @@ -53,12 +54,15 @@ License ); \ \ \ - defineNamedTemplateTypeNameAndDebug(Laminar##Transport##BaseModel, 0); \ + defineNamedTemplateTypeNameAndDebug(laminar##Transport##BaseModel, 0); \ + \ + defineTemplateRunTimeSelectionTable \ + (laminar##Transport##BaseModel, dictionary); \ \ addToRunTimeSelectionTable \ ( \ Transport##baseModel, \ - Laminar##Transport##BaseModel, \ + laminar##Transport##BaseModel, \ dictionary \ ); \ \