diff --git a/src/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.H b/src/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.H index 45a4e70edf45f4f80d5c456a4bcfa20a01968812..cee0a3e26035f068f13309fd1cf20c311a15d3df 100644 --- a/src/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.H +++ b/src/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.H @@ -79,10 +79,10 @@ public: // Constructors - //- from components + //- Construct from components anisotropicFilter(const fvMesh& mesh, scalar widthCoeff); - //- from IOdictionary + //- Construct from IOdictionary anisotropicFilter(const fvMesh& mesh, const dictionary&); diff --git a/src/turbulenceModels/LES/LESfilters/laplaceFilter/laplaceFilter.H b/src/turbulenceModels/LES/LESfilters/laplaceFilter/laplaceFilter.H index 3e5760604b579d9cc18cfafde0da379656fca98d..324ab5ba9295ff3d10daada5abc873e067aaa684 100644 --- a/src/turbulenceModels/LES/LESfilters/laplaceFilter/laplaceFilter.H +++ b/src/turbulenceModels/LES/LESfilters/laplaceFilter/laplaceFilter.H @@ -80,10 +80,10 @@ public: // Constructors - //- from components + //- Construct from components laplaceFilter(const fvMesh& mesh, scalar widthCoeff); - //- from IOdictionary + //- Construct from IOdictionary laplaceFilter(const fvMesh& mesh, const dictionary&); diff --git a/src/turbulenceModels/LES/LESfilters/simpleFilter/simpleFilter.H b/src/turbulenceModels/LES/LESfilters/simpleFilter/simpleFilter.H index 4e4c5e0f471024d99baf02db1d3149e46c432027..0c9b0ebec3c578307e55d0e18e159eed9dec0313 100644 --- a/src/turbulenceModels/LES/LESfilters/simpleFilter/simpleFilter.H +++ b/src/turbulenceModels/LES/LESfilters/simpleFilter/simpleFilter.H @@ -69,10 +69,10 @@ public: // Constructors - //- from components + //- Construct from components simpleFilter(const fvMesh& mesh); - //- from IOdictionary + //- Construct from IOdictionary simpleFilter(const fvMesh& mesh, const dictionary&); diff --git a/src/turbulenceModels/compressible/Allwmake b/src/turbulenceModels/compressible/Allwmake index 4686db7027c71c2ac1726bfb3dfe023abae9da74..ddff4170182e9c3f52fe2291bbebe0b912eca766 100755 --- a/src/turbulenceModels/compressible/Allwmake +++ b/src/turbulenceModels/compressible/Allwmake @@ -2,7 +2,7 @@ cd ${0%/*} || exit 1 # run from this directory set -x -#wmake libso turbulenceModel +wmake libso turbulenceModel wmake libso RAS wmake libso LES diff --git a/src/turbulenceModels/compressible/LES/DeardorffDiffStress/DeardorffDiffStress.C b/src/turbulenceModels/compressible/LES/DeardorffDiffStress/DeardorffDiffStress.C index 28f31e7164f01d7536356324d7407db526323eb5..4127724ed1fd24007024ef9e7314dc77649a3d0d 100644 --- a/src/turbulenceModels/compressible/LES/DeardorffDiffStress/DeardorffDiffStress.C +++ b/src/turbulenceModels/compressible/LES/DeardorffDiffStress/DeardorffDiffStress.C @@ -43,7 +43,6 @@ addToRunTimeSelectionTable(LESModel, DeardorffDiffStress, dictionary); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// from components DeardorffDiffStress::DeardorffDiffStress ( const volScalarField& rho, diff --git a/src/turbulenceModels/compressible/LES/DeardorffDiffStress/DeardorffDiffStress.H b/src/turbulenceModels/compressible/LES/DeardorffDiffStress/DeardorffDiffStress.H index bfbcb2a41bef8684575b5853ba54d07b4085cf9d..46bf057bec4c9782386201abc1759565aad3d3e3 100644 --- a/src/turbulenceModels/compressible/LES/DeardorffDiffStress/DeardorffDiffStress.H +++ b/src/turbulenceModels/compressible/LES/DeardorffDiffStress/DeardorffDiffStress.H @@ -103,10 +103,9 @@ public: ); - // Destructor - - ~DeardorffDiffStress() - {} + //- Destructor + virtual ~DeardorffDiffStress() + {} // Member Functions @@ -121,10 +120,10 @@ public: } //- Correct Eddy-Viscosity and related properties - void correct(const tmp<volTensorField>& gradU); + virtual void correct(const tmp<volTensorField>& gradU); //- Read turbulenceProperties dictionary - bool read(); + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.C b/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.C index c3843bb8f193ca9020bbdb130126450fec6f06a5..143ddc0987174ec8c283a7d3a037d71011aab979 100644 --- a/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.C +++ b/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.C @@ -37,7 +37,6 @@ namespace LESModels // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// from components GenEddyVisc::GenEddyVisc ( const volScalarField& rho, @@ -86,9 +85,7 @@ GenEddyVisc::GenEddyVisc ), mesh_ ) -{ -// printCoeffs(); -} +{} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.H b/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.H index cd501e9f68ef6326344f9b44f540c65ad0779480..2ed052c1416953324ee11d6d7f225477ba391be4 100644 --- a/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.H +++ b/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.H @@ -88,10 +88,9 @@ public: ); - // Destructor - - virtual ~GenEddyVisc() - {} + //- Destructor + virtual ~GenEddyVisc() + {} // Member Functions @@ -138,7 +137,7 @@ public: virtual void correct(const tmp<volTensorField>& gradU); //- Read turbulenceProperties dictionary - bool read(); + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/LES/GenSGSStress/GenSGSStress.C b/src/turbulenceModels/compressible/LES/GenSGSStress/GenSGSStress.C index 7ef8ebee764ff62f06534d86a71eb67bc7528dee..6b861941f24c3fec97651162c3e6dab6bb62fdb8 100644 --- a/src/turbulenceModels/compressible/LES/GenSGSStress/GenSGSStress.C +++ b/src/turbulenceModels/compressible/LES/GenSGSStress/GenSGSStress.C @@ -37,7 +37,6 @@ namespace LESModels // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// from components GenSGSStress::GenSGSStress ( const volScalarField& rho, @@ -90,9 +89,7 @@ GenSGSStress::GenSGSStress ), mesh_ ) -{ -// printCoeffs(); -} +{} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/turbulenceModels/compressible/LES/GenSGSStress/GenSGSStress.H b/src/turbulenceModels/compressible/LES/GenSGSStress/GenSGSStress.H index c071a7a01cc10ab93353f95a9e350cdb0c6c0253..c1d53d884806b116f352ccb0b362b9da84028ba5 100644 --- a/src/turbulenceModels/compressible/LES/GenSGSStress/GenSGSStress.H +++ b/src/turbulenceModels/compressible/LES/GenSGSStress/GenSGSStress.H @@ -89,10 +89,9 @@ public: ); - // Destructor - - virtual ~GenSGSStress() - {} + //- Destructor + virtual ~GenSGSStress() + {} // Member Functions @@ -143,7 +142,7 @@ public: virtual void correct(const tmp<volTensorField>& gradU); //- Read turbulenceProperties dictionary - bool read(); + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/LES/LESModel/LESModel.C b/src/turbulenceModels/compressible/LES/LESModel/LESModel.C index 8591c4c7b466669571e3afe13e468c2ef47acb6c..01d3a4110ca901bad2a7368bf38eaf26660146ef 100644 --- a/src/turbulenceModels/compressible/LES/LESModel/LESModel.C +++ b/src/turbulenceModels/compressible/LES/LESModel/LESModel.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "LESModel.H" -#include "wallDist.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -61,6 +61,8 @@ LESModel::LESModel const basicThermo& thermoPhysicalModel ) : + turbulenceModel(rho, U, phi, thermoPhysicalModel), + IOdictionary ( IOobject @@ -73,14 +75,6 @@ LESModel::LESModel ) ), - runTime_(U.time()), - mesh_(U.mesh()), - - rho_(rho), - U_(U), - phi_(phi), - thermoPhysicalModel_(thermoPhysicalModel), - printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)), coeffDict_(subDict(type + "Coeffs")), diff --git a/src/turbulenceModels/compressible/LES/LESModel/LESModel.H b/src/turbulenceModels/compressible/LES/LESModel/LESModel.H index ecef2d8f7716a9e6ea5baf43f5b6c5f591240329..61ada487984fc29efa39f9019682930beaff61a3 100644 --- a/src/turbulenceModels/compressible/LES/LESModel/LESModel.H +++ b/src/turbulenceModels/compressible/LES/LESModel/LESModel.H @@ -43,13 +43,13 @@ Description SourceFiles LESModel.C - newLESModel.C \*---------------------------------------------------------------------------*/ #ifndef compressibleLESModel_H #define compressibleLESModel_H +#include "turbulenceModel.H" #include "LESdelta.H" #include "fvm.H" #include "fvc.H" @@ -72,6 +72,7 @@ namespace compressible class LESModel : + public turbulenceModel, public IOdictionary { @@ -79,20 +80,6 @@ protected: // Protected data - const Time& runTime_; - const fvMesh& mesh_; - - -private: - - // Private data - - const volScalarField& rho_; - const volVectorField& U_; - const surfaceScalarField& phi_; - - const basicThermo& thermoPhysicalModel_; - Switch printCoeffs_; dictionary coeffDict_; @@ -101,19 +88,21 @@ private: autoPtr<LESdelta> delta_; - // Private Member Functions + // Protected Member Functions - // Disallow default bitwise copy construct and assignment - LESModel(const LESModel&); - LESModel& operator=(const LESModel&); + //- Print model coefficients + virtual void printCoeffs(); -protected: +private: - // Protected Member Functions + // Private Member Functions - //- Print model coefficients - virtual void printCoeffs(); + //- Disallow default bitwise copy construct + LESModel(const LESModel&); + + //- Disallow default bitwise assignment + LESModel& operator=(const LESModel&); public: @@ -164,76 +153,37 @@ public: ); - // Destructor - - virtual ~LESModel() - {} + //- Destructor + virtual ~LESModel() + {} // Member Functions - // Access - - //- Access function to the density field - inline const volScalarField& rho() const - { - return rho_; - } - - //- Access function to velocity field - inline const volVectorField& U() const - { - return U_; - } - - //- Access function to flux field - inline const surfaceScalarField& phi() const - { - return phi_; - } - - //- Access function to the thermophysical properties model - inline const basicThermo& thermo() const - { - return thermoPhysicalModel_; - } - - //- Access the dictionary which provides info. about choice of - // models, and all related data (particularly model coefficients). - inline dictionary& coeffDict() - { - return coeffDict_; - } - - //- Access function to filter width - inline const volScalarField& delta() const - { - return delta_(); - } - - //- Return the value of k0 which k is not allowed to be less than - const dimensionedScalar& k0() const - { - return k0_; - } + //- Access the dictionary which provides info. about choice of + // models, and all related data (particularly model coefficients). + inline dictionary& coeffDict() + { + return coeffDict_; + } - //- Allow k0 to be changed - dimensionedScalar& k0() - { - return k0_; - } + //- Access function to filter width + inline const volScalarField& delta() const + { + return delta_(); + } - //- Access function to laminar viscosity - tmp<volScalarField> mu() const - { - return thermoPhysicalModel_.mu(); - } + //- Return the value of k0 which k is not allowed to be less than + const dimensionedScalar& k0() const + { + return k0_; + } - //- Access function to laminar thermal conductivity - tmp<volScalarField> alpha() const - { - return thermoPhysicalModel_.alpha(); - } + //- Allow k0 to be changed + dimensionedScalar& k0() + { + return k0_; + } //- Return the SGS turbulent kinetic energy. @@ -268,6 +218,34 @@ public: // This is the additional term due to the filtering of the NSE. virtual tmp<fvVectorMatrix> divDevRhoBeff(volVectorField& U) const = 0; + + // RAS compatibility functions for the turbulenceModel base class + + //- Return the turbulence viscosity + virtual tmp<volScalarField> mut() const + { + return muSgs(); + } + + //- Return the Reynolds stress tensor + virtual tmp<volSymmTensorField> R() const + { + return B(); + } + + //- Return the effective stress tensor including the laminar stress + virtual tmp<volSymmTensorField> devRhoReff() const + { + return devRhoBeff(); + } + + //- Return the source term for the momentum equation + virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const + { + return divDevRhoBeff(U); + } + + //- Correct Eddy-Viscosity and related properties. // This calls correct(const tmp<volTensorField>& gradU) by supplying // gradU calculated locally. diff --git a/src/turbulenceModels/compressible/LES/Make/options b/src/turbulenceModels/compressible/LES/Make/options index 4ccb52fba2eaef908a0bb34a37307ae2f5676b5d..b8d3ee786e8d4c103bfe4fd364558e798d565e65 100644 --- a/src/turbulenceModels/compressible/LES/Make/options +++ b/src/turbulenceModels/compressible/LES/Make/options @@ -1,11 +1,14 @@ EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ + -I../turbulenceModel/lnInclude \ -I../../LES/LESdeltas/lnInclude \ -I../../LES/LESfilters/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude LIB_LIBS = \ + -lcompressibleTurbulenceModel \ -lLESdeltas \ -lLESfilters \ + -lfiniteVolume \ -lmeshTools diff --git a/src/turbulenceModels/compressible/LES/Smagorinsky/Smagorinsky.C b/src/turbulenceModels/compressible/LES/Smagorinsky/Smagorinsky.C index 547fd60f5e5957363678a1546bd91734e2089a2f..1bb1098489c8fe41e458d69c1540fd5d200616d3 100644 --- a/src/turbulenceModels/compressible/LES/Smagorinsky/Smagorinsky.C +++ b/src/turbulenceModels/compressible/LES/Smagorinsky/Smagorinsky.C @@ -43,7 +43,6 @@ addToRunTimeSelectionTable(LESModel, Smagorinsky, dictionary); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// from components Smagorinsky::Smagorinsky ( const volScalarField& rho, diff --git a/src/turbulenceModels/compressible/LES/Smagorinsky/Smagorinsky.H b/src/turbulenceModels/compressible/LES/Smagorinsky/Smagorinsky.H index e5d786f94af8fb204c44bc1438ccc4bd65fcdcf5..03d056def05de361bb18fd34dc187a9f966e6b2f 100644 --- a/src/turbulenceModels/compressible/LES/Smagorinsky/Smagorinsky.H +++ b/src/turbulenceModels/compressible/LES/Smagorinsky/Smagorinsky.H @@ -98,19 +98,18 @@ public: ); - // Destructor - - ~Smagorinsky() - {} + //- Destructor + virtual ~Smagorinsky() + {} // Member Functions //- Correct Eddy-Viscosity and related properties - void correct(const tmp<volTensorField>& gradU); + virtual void correct(const tmp<volTensorField>& gradU); //- Read turbulenceProperties dictionary - bool read(); + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/LES/SpalartAllmaras/SpalartAllmaras.H b/src/turbulenceModels/compressible/LES/SpalartAllmaras/SpalartAllmaras.H index 67a1d7b8a83d3046fc26d702bec220edc7a6cdba..ca94bdd6134e724876915505ac4b61528fd027a7 100644 --- a/src/turbulenceModels/compressible/LES/SpalartAllmaras/SpalartAllmaras.H +++ b/src/turbulenceModels/compressible/LES/SpalartAllmaras/SpalartAllmaras.H @@ -106,36 +106,35 @@ public: ); - // Destructor - - ~SpalartAllmaras() - {} + //- Destructor + virtual ~SpalartAllmaras() + {} // Member Functions + tmp<volScalarField> nuTilda() const + { + return nuTilda_; + } + //- Return SGS kinetic energy - tmp<volScalarField> k() const + virtual tmp<volScalarField> k() const { return sqr(muSgs()/rho()/ck_/dTilda_); } //- Return sub-grid disipation rate - tmp<volScalarField> epsilon() const; - - tmp<volScalarField> nuTilda() const - { - return nuTilda_; - } + virtual tmp<volScalarField> epsilon() const; //- Return SGS viscosity - tmp<volScalarField> muSgs() const + virtual tmp<volScalarField> muSgs() const { return muSgs_; } //- Return thermal conductivity - tmp<volScalarField> alphaEff() const + virtual tmp<volScalarField> alphaEff() const { return tmp<volScalarField> ( @@ -152,13 +151,13 @@ public: //- Returns div(rho*dev(B)). // This is the additional term due to the filtering of the NSE. - tmp<fvVectorMatrix> divDevRhoBeff(volVectorField& U) const; + virtual tmp<fvVectorMatrix> divDevRhoBeff(volVectorField& U) const; //- Correct nuTilda and related properties - void correct(const tmp<volTensorField>& gradU); + virtual void correct(const tmp<volTensorField>& gradU); //- Read turbulenceProperties dictionary - bool read(); + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/LES/dynOneEqEddy/dynOneEqEddy.C b/src/turbulenceModels/compressible/LES/dynOneEqEddy/dynOneEqEddy.C index 96bf8abbc9e0adaae2a532a19aca982e8224d793..64f189d8d29b4f1029052118ed1fd07b24160b8c 100644 --- a/src/turbulenceModels/compressible/LES/dynOneEqEddy/dynOneEqEddy.C +++ b/src/turbulenceModels/compressible/LES/dynOneEqEddy/dynOneEqEddy.C @@ -76,7 +76,6 @@ dimensionedScalar dynOneEqEddy::ce_(const volSymmTensorField& D) const // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// from components dynOneEqEddy::dynOneEqEddy ( const volScalarField& rho, @@ -95,12 +94,6 @@ dynOneEqEddy::dynOneEqEddy } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -dynOneEqEddy::~dynOneEqEddy() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void dynOneEqEddy::correct(const tmp<volTensorField>& tgradU) diff --git a/src/turbulenceModels/compressible/LES/dynOneEqEddy/dynOneEqEddy.H b/src/turbulenceModels/compressible/LES/dynOneEqEddy/dynOneEqEddy.H index 3ffeb9c5dba02dce01791cc3089d025fb57ff8a7..3f0abdb544475baf20ac3b13c3388b2d48a57384 100644 --- a/src/turbulenceModels/compressible/LES/dynOneEqEddy/dynOneEqEddy.H +++ b/src/turbulenceModels/compressible/LES/dynOneEqEddy/dynOneEqEddy.H @@ -110,8 +110,8 @@ public: // Destructor - - ~dynOneEqEddy(); + virtual ~dynOneEqEddy() + {} // Member Functions @@ -119,17 +119,17 @@ public: //- Return the effective diffusivity for k tmp<volScalarField> DkEff() const { - return tmp<volScalarField> + return tmp<volScalarField> ( new volScalarField("DkEff", muSgs_ + mu()) ); } //- Correct Eddy-Viscosity and related properties - void correct(const tmp<volTensorField>& gradU); + virtual void correct(const tmp<volTensorField>& gradU); //- Read turbulenceProperties dictionary - bool read(); + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.C b/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.C index a626068335caa63e9ca5df35ae5b70c24933ad91..3d6b70f5baad9bc2850a1fd173c692f6c542e456 100644 --- a/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.C +++ b/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.C @@ -43,7 +43,6 @@ addToRunTimeSelectionTable(LESModel, lowReOneEqEddy, dictionary); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// from components lowReOneEqEddy::lowReOneEqEddy ( const volScalarField& rho, diff --git a/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.H b/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.H index 44d74f8ea9e079718a742ceef98004c4e86053c9..6ab246167e6eb039f3887e14ecc941485e036b74 100644 --- a/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.H +++ b/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.H @@ -100,10 +100,9 @@ public: ); - // Destructor - - ~lowReOneEqEddy() - {} + //- Destructor + virtual ~lowReOneEqEddy() + {} // Member Functions @@ -118,10 +117,10 @@ public: } //- Correct Eddy-Viscosity and related properties - void correct(const tmp<volTensorField>& gradU); + virtual void correct(const tmp<volTensorField>& gradU); //- Read turbulenceProperties dictionary - bool read(); + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/LES/oneEqEddy/oneEqEddy.H b/src/turbulenceModels/compressible/LES/oneEqEddy/oneEqEddy.H index edd2c04d371f4c86f9df6054b98fcaad004d807f..834983f7cfe979da1fc1baa4465b014a55dc8688 100644 --- a/src/turbulenceModels/compressible/LES/oneEqEddy/oneEqEddy.H +++ b/src/turbulenceModels/compressible/LES/oneEqEddy/oneEqEddy.H @@ -104,9 +104,8 @@ public: // Destructor - - ~oneEqEddy() - {} + virtual ~oneEqEddy() + {} // Member Functions @@ -121,10 +120,10 @@ public: } //- Correct Eddy-Viscosity and related properties - void correct(const tmp<volTensorField>& gradU); + virtual void correct(const tmp<volTensorField>& gradU); //- Read turbulenceProperties dictionary - bool read(); + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/RAS/LRR/LRR.C b/src/turbulenceModels/compressible/RAS/LRR/LRR.C index a22d495249797b6a0876abeff8b59422ab2a06e5..2398efc6809543b4f044791b6dac46e56cd0a349 100644 --- a/src/turbulenceModels/compressible/RAS/LRR/LRR.C +++ b/src/turbulenceModels/compressible/RAS/LRR/LRR.C @@ -46,13 +46,12 @@ addToRunTimeSelectionTable(RASModel, LRR, dictionary); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// from components LRR::LRR ( const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ) : RASModel(typeName, rho, U, phi, thermophysicalModel), diff --git a/src/turbulenceModels/compressible/RAS/LRR/LRR.H b/src/turbulenceModels/compressible/RAS/LRR/LRR.H index 0dc2ed2ad855323a71ef29572e200e06cb15e243..84016a132b74e2591ee9641143e90c0af521443b 100644 --- a/src/turbulenceModels/compressible/RAS/LRR/LRR.H +++ b/src/turbulenceModels/compressible/RAS/LRR/LRR.H @@ -107,29 +107,23 @@ public: // Constructors - //- from components + //- Construct from components LRR ( const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ); - // Destructor - - ~LRR(){} + //- Destructor + virtual ~LRR() + {} // Member Functions - //- Return the turbulence viscosity - tmp<volScalarField> mut() const - { - return mut_; - } - //- Return the effective diffusivity for R tmp<volScalarField> DREff() const { @@ -148,8 +142,14 @@ public: ); } + //- Return the turbulence viscosity + virtual tmp<volScalarField> mut() const + { + return mut_; + } + //- Return the effective turbulent thermal diffusivity - tmp<volScalarField> alphaEff() const + virtual tmp<volScalarField> alphaEff() const { return tmp<volScalarField> ( @@ -158,34 +158,34 @@ public: } //- Return the turbulence kinetic energy - tmp<volScalarField> k() const + virtual tmp<volScalarField> k() const { return k_; } //- Return the turbulence kinetic energy dissipation rate - tmp<volScalarField> epsilon() const + virtual tmp<volScalarField> epsilon() const { return epsilon_; } //- Return the Reynolds stress tensor - tmp<volSymmTensorField> R() const + virtual tmp<volSymmTensorField> R() const { return R_; } //- Return the effective stress tensor including the laminar stress - tmp<volSymmTensorField> devRhoReff() const; + virtual tmp<volSymmTensorField> devRhoReff() const; //- Return the source term for the momentum equation - tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; + virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; //- Solve the turbulence equations and correct the turbulence viscosity - void correct(); + virtual void correct(); //- Read turbulenceProperties dictionary - bool read(); + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C b/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C index 0181605fb1987101f180e70f951b005e7553b137..c71c3c510afb7dd55668be714be6b69f20d5f012 100644 --- a/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C +++ b/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C @@ -48,13 +48,12 @@ addToRunTimeSelectionTable(RASModel, LaunderGibsonRSTM, dictionary); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// from components LaunderGibsonRSTM::LaunderGibsonRSTM ( const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ) : RASModel(typeName, rho, U, phi, thermophysicalModel), diff --git a/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H b/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H index 4fa0e9315eadda5ac40784eac438db14b947e9fb..21e3f98b0c74adc286ab2f0fe319e9aab99ac599 100644 --- a/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H +++ b/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H @@ -114,31 +114,23 @@ public: // Constructors - //- from components + //- Construct from components LaunderGibsonRSTM ( const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ); - // Destructor - - ~LaunderGibsonRSTM(){} + //- Destructor + virtual ~LaunderGibsonRSTM() + {} // Member Functions - // Access - - //- Return the turbulence viscosity - tmp<volScalarField> mut() const - { - return mut_; - } - //- Return the effective diffusivity for R tmp<volScalarField> DREff() const { @@ -157,8 +149,14 @@ public: ); } + //- Return the turbulence viscosity + virtual tmp<volScalarField> mut() const + { + return mut_; + } + //- Return the effective turbulent thermal diffusivity - tmp<volScalarField> alphaEff() const + virtual tmp<volScalarField> alphaEff() const { return tmp<volScalarField> ( @@ -167,34 +165,34 @@ public: } //- Return the turbulence kinetic energy - tmp<volScalarField> k() const + virtual tmp<volScalarField> k() const { return k_; } //- Return the turbulence kinetic energy dissipation rate - tmp<volScalarField> epsilon() const + virtual tmp<volScalarField> epsilon() const { return epsilon_; } //- Return the Reynolds stress tensor - tmp<volSymmTensorField> R() const + virtual tmp<volSymmTensorField> R() const { return R_; } //- Return the effective stress tensor including the laminar stress - tmp<volSymmTensorField> devRhoReff() const; + virtual tmp<volSymmTensorField> devRhoReff() const; //- Return the source term for the momentum equation - tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; + virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; //- Solve the turbulence equations and correct the turbulence viscosity - void correct(); + virtual void correct(); //- Read turbulenceProperties dictionary - bool read(); + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C b/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C index b57741009732a83da63019243ed394d5a7c8dc3a..57461b3544ee561fe88875d4f25b97e63e8479b6 100644 --- a/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C +++ b/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C @@ -60,13 +60,12 @@ tmp<volScalarField> LaunderSharmaKE::f2() const // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// from components LaunderSharmaKE::LaunderSharmaKE ( const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ) : RASModel(typeName, rho, U, phi, thermophysicalModel), diff --git a/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.H b/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.H index 731e0cdb02a3fc2c658c7ee1a29db9e56de98b69..7b2add3ea693475f3358447b443f4d1bec1dd818 100644 --- a/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.H +++ b/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.H @@ -99,29 +99,23 @@ public: // Constructors - //- from components + //- Construct from components LaunderSharmaKE ( const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ); - // Destructor - - ~LaunderSharmaKE(){} + //- Destructor + virtual ~LaunderSharmaKE() + {} // Member Functions - //- Return the turbulence viscosity - tmp<volScalarField> mut() const - { - return mut_; - } - //- Return the effective diffusivity for k tmp<volScalarField> DkEff() const { @@ -140,8 +134,14 @@ public: ); } + //- Return the turbulence viscosity + virtual tmp<volScalarField> mut() const + { + return mut_; + } + //- Return the effective turbulent thermal diffusivity - tmp<volScalarField> alphaEff() const + virtual tmp<volScalarField> alphaEff() const { return tmp<volScalarField> ( @@ -150,31 +150,31 @@ public: } //- Return the turbulence kinetic energy - tmp<volScalarField> k() const + virtual tmp<volScalarField> k() const { return k_; } //- Return the turbulence kinetic energy dissipation rate - tmp<volScalarField> epsilon() const + virtual tmp<volScalarField> epsilon() const { return epsilon_; } //- Return the Reynolds stress tensor - tmp<volSymmTensorField> R() const; + virtual tmp<volSymmTensorField> R() const; //- Return the effective stress tensor including the laminar stress - tmp<volSymmTensorField> devRhoReff() const; + virtual tmp<volSymmTensorField> devRhoReff() const; //- Return the source term for the momentum equation - tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; + virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; //- Solve the turbulence equations and correct the turbulence viscosity - void correct(); + virtual void correct(); //- Read turbulenceProperties dictionary - bool read(); + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/RAS/Make/options b/src/turbulenceModels/compressible/RAS/Make/options index 6c12c9d781986396e914e1a95bb6c5b0d9737b78..996f328e699e52d89221645b6c8c7959b17b2fc4 100644 --- a/src/turbulenceModels/compressible/RAS/Make/options +++ b/src/turbulenceModels/compressible/RAS/Make/options @@ -1,8 +1,10 @@ EXE_INC = \ + -I../turbulenceModel/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude LIB_LIBS = \ + -lcompressibleTurbulenceModel \ -lfiniteVolume \ -lmeshTools diff --git a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.C b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.C index c1bbdc1684e330283676325ce9cd798ea5802324..22b646e55e2241cdc47b3264be9735efe9477199 100644 --- a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.C +++ b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.C @@ -25,9 +25,8 @@ License \*---------------------------------------------------------------------------*/ #include "RASModel.H" -#include "wallDist.H" #include "wallFvPatch.H" -#include "fixedValueFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -61,9 +60,11 @@ RASModel::RASModel const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ) : + turbulenceModel(rho, U, phi, thermophysicalModel), + IOdictionary ( IOobject @@ -76,14 +77,6 @@ RASModel::RASModel ) ), - runTime_(U.time()), - mesh_(U.mesh()), - - rho_(rho), - U_(U), - phi_(phi), - thermophysicalModel_(thermophysicalModel), - turbulence_(lookup("turbulence")), printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)), coeffDict_(subDict(type + "Coeffs")), diff --git a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H index 1be29e6e7926cb347cbd25913460d990246eed57..2ff398347dcb9c3f0f7ddb3e9f86267ed4d6a945 100644 --- a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H +++ b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H @@ -45,6 +45,7 @@ SourceFiles #ifndef compressibleRASModel_H #define compressibleRASModel_H +#include "turbulenceModel.H" #include "volFields.H" #include "surfaceFields.H" #include "nearWallDist.H" @@ -71,6 +72,7 @@ namespace compressible class RASModel : + public turbulenceModel, public IOdictionary { @@ -78,15 +80,6 @@ protected: // Protected data - const Time& runTime_; - const fvMesh& mesh_; - - const volScalarField& rho_; - const volVectorField& U_; - const surfaceScalarField& phi_; - - basicThermo& thermophysicalModel_; - Switch turbulence_; Switch printCoeffs_; dictionary coeffDict_; @@ -111,12 +104,6 @@ protected: //- Print model coefficients virtual void printCoeffs(); - //- Return the laminar thermal conductivity - const volScalarField& alpha() const - { - return thermophysicalModel_.alpha(); - } - private: @@ -146,7 +133,7 @@ public: const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermoPhysicalModel + const basicThermo& thermoPhysicalModel ), (rho, U, phi, thermoPhysicalModel) ); @@ -161,7 +148,7 @@ public: const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermoPhysicalModel + const basicThermo& thermoPhysicalModel ); @@ -173,14 +160,13 @@ public: const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermoPhysicalModel + const basicThermo& thermoPhysicalModel ); - // Destructor - - virtual ~RASModel() - {} + //- Destructor + virtual ~RASModel() + {} // Member Functions @@ -280,12 +266,6 @@ public: } - //- Return the laminar viscosity - const volScalarField& mu() const - { - return thermophysicalModel_.mu(); - } - //- Return the turbulence viscosity virtual tmp<volScalarField> mut() const = 0; diff --git a/src/turbulenceModels/compressible/RAS/RASModel/newRASModel.C b/src/turbulenceModels/compressible/RAS/RASModel/newRASModel.C index 339e9ad2d2a930296cf65a0389c7e41ecab22b79..4f5d8cea5ec97c222807907cfadb3383c0d6bb4c 100644 --- a/src/turbulenceModels/compressible/RAS/RASModel/newRASModel.C +++ b/src/turbulenceModels/compressible/RAS/RASModel/newRASModel.C @@ -40,7 +40,7 @@ autoPtr<RASModel> RASModel::New const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ) { word RASModelTypeName; diff --git a/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C b/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C index 8f6ba82321333b72f9c751c70a95d33269ba7e6d..fdc5b61763fe61ed7deb644dd449eb98f8247cf9 100644 --- a/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C +++ b/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C @@ -46,13 +46,12 @@ addToRunTimeSelectionTable(RASModel, RNGkEpsilon, dictionary); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// from components RNGkEpsilon::RNGkEpsilon ( const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ) : RASModel(typeName, rho, U, phi, thermophysicalModel), diff --git a/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.H b/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.H index 98445ced1db5b2462fb63460c0fc6f1e83f69247..da1c292a5bfb8e0c574900507606a670b64d2698 100644 --- a/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.H +++ b/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.H @@ -97,29 +97,23 @@ public: // Constructors - //- from components + //- Construct from components RNGkEpsilon ( const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ); - // Destructor - - ~RNGkEpsilon(){} + //- Destructor + virtual ~RNGkEpsilon() + {} // Member Functions - //- Return the turbulence viscosity - tmp<volScalarField> mut() const - { - return mut_; - } - //- Return the effective diffusivity for k tmp<volScalarField> DkEff() const { @@ -138,8 +132,14 @@ public: ); } + //- Return the turbulence viscosity + virtual tmp<volScalarField> mut() const + { + return mut_; + } + //- Return the effective turbulent thermal diffusivity - tmp<volScalarField> alphaEff() const + virtual tmp<volScalarField> alphaEff() const { return tmp<volScalarField> ( @@ -148,31 +148,31 @@ public: } //- Return the turbulence kinetic energy - tmp<volScalarField> k() const + virtual tmp<volScalarField> k() const { return k_; } //- Return the turbulence kinetic energy dissipation rate - tmp<volScalarField> epsilon() const + virtual tmp<volScalarField> epsilon() const { return epsilon_; } //- Return the Reynolds stress tensor - tmp<volSymmTensorField> R() const; + virtual tmp<volSymmTensorField> R() const; //- Return the effective stress tensor including the laminar stress - tmp<volSymmTensorField> devRhoReff() const; + virtual tmp<volSymmTensorField> devRhoReff() const; //- Return the effective stress tensor including the laminar stress - tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; + virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; //- Solve the turbulence equations and correct the turbulence viscosity - void correct(); + virtual void correct(); //- Read turbulenceProperties dictionary - bool read(); + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.C b/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.C index d0757ab14284f32430f7ebba981f0f9d066a44d4..7918372c812367faea7a27a9e5c4871f9f0e1151 100644 --- a/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.C +++ b/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.C @@ -110,7 +110,7 @@ SpalartAllmaras::SpalartAllmaras const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ) : RASModel(typeName, rho, U, phi, thermophysicalModel), diff --git a/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.H b/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.H index da3aa6fc2e51115bc9621aca8049299cddd26f5d..0565e05cefd2d93c82d4eeac7c5810eb51396772 100644 --- a/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.H +++ b/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.H @@ -132,30 +132,23 @@ public: // Constructors - //- from components + //- Construct from components SpalartAllmaras ( const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ); - // Destructor - - ~SpalartAllmaras() - {} + //- Destructor + virtual ~SpalartAllmaras() + {} // Member Functions - //- Return the turbulence viscosity - tmp<volScalarField> mut() const - { - return mut_; - } - //- Return the effective diffusivity for nuTilda tmp<volScalarField> DnuTildaEff() const { @@ -168,8 +161,15 @@ public: ) ); } - //- Return the effective turbulent thermal diffusivity - tmp<volScalarField> alphaEff() const + + //- Return the turbulence viscosity + virtual tmp<volScalarField> mut() const + { + return mut_; + } + + //- Return the effective turbulent thermal diffusivity + virtual tmp<volScalarField> alphaEff() const { return tmp<volScalarField> ( @@ -178,7 +178,7 @@ public: } //- Return the turbulence kinetic energy - tmp<volScalarField> k() const + virtual tmp<volScalarField> k() const { return tmp<volScalarField> ( @@ -197,7 +197,7 @@ public: } //- Return the turbulence kinetic energy dissipation rate - tmp<volScalarField> epsilon() const + virtual tmp<volScalarField> epsilon() const { return tmp<volScalarField> ( @@ -216,19 +216,19 @@ public: } //- Return the Reynolds stress tensor - tmp<volSymmTensorField> R() const; + virtual tmp<volSymmTensorField> R() const; //- Return the effective stress tensor including the laminar stress - tmp<volSymmTensorField> devRhoReff() const; + virtual tmp<volSymmTensorField> devRhoReff() const; //- Return the source term for the momentum equation - tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; + virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; //- Solve the turbulence equations and correct the turbulence viscosity - void correct(); + virtual void correct(); //- Read turbulenceProperties dictionary - bool read(); + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C index cb0fecc03dcbb3db26ce8a55b1f10d2dddd54036..7d07a8eff35e768307b8781923fe874117f20734 100644 --- a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C +++ b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C @@ -51,7 +51,7 @@ kEpsilon::kEpsilon const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ) : RASModel(typeName, rho, U, phi, thermophysicalModel), diff --git a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.H b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.H index 76d952d40da37d80720f923b2675ca4825679ec4..405ffaf20605e4c0fff1f20f05f623d322aba945 100644 --- a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.H +++ b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.H @@ -97,30 +97,23 @@ public: // Constructors - //- from components + //- Construct from components kEpsilon ( const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ); - // Destructor - - ~kEpsilon() - {} + //- Destructor + virtual ~kEpsilon() + {} // Member Functions - //- Return the turbulence viscosity - tmp<volScalarField> mut() const - { - return mut_; - } - //- Return the effective diffusivity for k tmp<volScalarField> DkEff() const { @@ -139,8 +132,14 @@ public: ); } + //- Return the turbulence viscosity + virtual tmp<volScalarField> mut() const + { + return mut_; + } + //- Return the effective turbulent thermal diffusivity - tmp<volScalarField> alphaEff() const + virtual tmp<volScalarField> alphaEff() const { return tmp<volScalarField> ( @@ -149,31 +148,31 @@ public: } //- Return the turbulence kinetic energy - tmp<volScalarField> k() const + virtual tmp<volScalarField> k() const { return k_; } //- Return the turbulence kinetic energy dissipation rate - tmp<volScalarField> epsilon() const + virtual tmp<volScalarField> epsilon() const { return epsilon_; } //- Return the Reynolds stress tensor - tmp<volSymmTensorField> R() const; + virtual tmp<volSymmTensorField> R() const; //- Return the effective stress tensor including the laminar stress - tmp<volSymmTensorField> devRhoReff() const; + virtual tmp<volSymmTensorField> devRhoReff() const; //- Return the source term for the momentum equation - tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; + virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; //- Solve the turbulence equations and correct the turbulence viscosity - void correct(); + virtual void correct(); //- Read turbulenceProperties dictionary - bool read(); + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C index 1181169f87915b806ff7a95ef558a567d083fd19..3164794e7f46a608cee59bf2329a5057af23ee5c 100644 --- a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C +++ b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C @@ -94,7 +94,7 @@ kOmegaSST::kOmegaSST const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ) : RASModel(typeName, rho, U, phi, thermophysicalModel), diff --git a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H index 3f9c1486d3e41361a447fb77f69f64a106fdfb00..950cfeeb928f1790ae9f3d84b4903422b7fc2dee 100644 --- a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H +++ b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H @@ -199,23 +199,17 @@ public: const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ); - // Destructor - - ~kOmegaSST() - {} + //- Destructor + virtual ~kOmegaSST() + {} // Member Functions - tmp<volScalarField> mut() const - { - return mut_; - } - //- Return the effective diffusivity for k tmp<volScalarField> DkEff(const volScalarField& F1) const { @@ -234,8 +228,13 @@ public: ); } + virtual tmp<volScalarField> mut() const + { + return mut_; + } + //- Return the effective turbulent thermal diffusivity - tmp<volScalarField> alphaEff() const + virtual tmp<volScalarField> alphaEff() const { return tmp<volScalarField> ( @@ -244,18 +243,18 @@ public: } //- Return the turbulence kinetic energy - tmp<volScalarField> k() const + virtual tmp<volScalarField> k() const { return k_; } - tmp<volScalarField> omega() const + virtual tmp<volScalarField> omega() const { return omega_; } //- Return the turbulence kinetic energy dissipation rate - tmp<volScalarField> epsilon() const + virtual tmp<volScalarField> epsilon() const { return tmp<volScalarField> ( @@ -274,19 +273,19 @@ public: } //- Return the Reynolds stress tensor - tmp<volSymmTensorField> R() const; + virtual tmp<volSymmTensorField> R() const; //- Return the effective stress tensor including the laminar stress - tmp<volSymmTensorField> devRhoReff() const; + virtual tmp<volSymmTensorField> devRhoReff() const; //- Return the source term for the momentum equation - tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; + virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; //- Solve the turbulence equations and correct the turbulence viscosity - void correct(); + virtual void correct(); //- Read turbulenceProperties dictionary - bool read(); + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/RAS/laminar/laminar.C b/src/turbulenceModels/compressible/RAS/laminar/laminar.C index 7a24cacc7ad8807613f7ace6d31ec82fcdf69b1b..2f5364fb2b4ee4eedcb566a8b2dcd6267498f721 100644 --- a/src/turbulenceModels/compressible/RAS/laminar/laminar.C +++ b/src/turbulenceModels/compressible/RAS/laminar/laminar.C @@ -48,7 +48,7 @@ laminar::laminar const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ) : RASModel(typeName, rho, U, phi, thermophysicalModel) @@ -171,7 +171,8 @@ tmp<fvVectorMatrix> laminar::divDevRhoReff(volVectorField& U) const { return ( - - fvm::laplacian(muEff(), U) - fvc::div(muEff()*dev2(fvc::grad(U)().T())) + - fvm::laplacian(muEff(), U) + - fvc::div(muEff()*dev2(fvc::grad(U)().T())) ); } diff --git a/src/turbulenceModels/compressible/RAS/laminar/laminar.H b/src/turbulenceModels/compressible/RAS/laminar/laminar.H index dda7f731179ae1603b68f89da8ca5225558f36fb..029a112cd5d0a20d0eceaefafe739ded21d872d9 100644 --- a/src/turbulenceModels/compressible/RAS/laminar/laminar.H +++ b/src/turbulenceModels/compressible/RAS/laminar/laminar.H @@ -64,20 +64,19 @@ public: // Constructors - //- from components + //- Construct from components laminar ( const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ); - // Destructor - - ~laminar() - {} + //- Destructor + virtual ~laminar() + {} // Member Functions diff --git a/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C b/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C index 1e762433f3efbc13193f682a57941e0a4fad15f5..085058c102d35ff13e0817575109885e856e4542 100644 --- a/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C +++ b/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C @@ -92,7 +92,7 @@ realizableKE::realizableKE const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ) : RASModel(typeName, rho, U, phi, thermophysicalModel), diff --git a/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.H b/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.H index f997efdd5f8f77aa6eb78125d9e8d2d64eb7c31d..168a72e88aec2bbcd797e04552ad6a2f7539ea6f 100644 --- a/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.H +++ b/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.H @@ -112,29 +112,23 @@ public: // Constructors - //- from components + //- Construct from components realizableKE ( const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - basicThermo& thermophysicalModel + const basicThermo& thermophysicalModel ); - // Destructor - - ~realizableKE(){} + //- Destructor + virtual ~realizableKE() + {} // Member Functions - //- Return the turbulence viscosity - tmp<volScalarField> mut() const - { - return mut_; - } - //- Return the effective diffusivity for k tmp<volScalarField> DkEff() const { @@ -153,8 +147,14 @@ public: ); } + //- Return the turbulence viscosity + virtual tmp<volScalarField> mut() const + { + return mut_; + } + //- Return the effective turbulent thermal diffusivity - tmp<volScalarField> alphaEff() const + virtual tmp<volScalarField> alphaEff() const { return tmp<volScalarField> ( @@ -163,31 +163,31 @@ public: } //- Return the turbulence kinetic energy - tmp<volScalarField> k() const + virtual tmp<volScalarField> k() const { return k_; } //- Return the turbulence kinetic energy dissipation rate - tmp<volScalarField> epsilon() const + virtual tmp<volScalarField> epsilon() const { return epsilon_; } //- Return the Reynolds stress tensor - tmp<volSymmTensorField> R() const; + virtual tmp<volSymmTensorField> R() const; //- Return the effective stress tensor including the laminar stress - tmp<volSymmTensorField> devRhoReff() const; + virtual tmp<volSymmTensorField> devRhoReff() const; //- Return the source term for the momentum equation - tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; + virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; //- Solve the turbulence equations and correct the turbulence viscosity - void correct(); + virtual void correct(); //- Read turbulenceProperties dictionary - bool read(); + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/turbulenceModel/Make/files b/src/turbulenceModels/compressible/turbulenceModel/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..3f01b203540f2e54e5d05e0ab46f66cd5284405a --- /dev/null +++ b/src/turbulenceModels/compressible/turbulenceModel/Make/files @@ -0,0 +1,4 @@ +turbulenceModel.C +laminar/laminar.C + +LIB = $(FOAM_LIBBIN)/libcompressibleTurbulenceModel diff --git a/src/turbulenceModels/compressible/turbulenceModel/Make/options b/src/turbulenceModels/compressible/turbulenceModel/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..65d3ed1e01ee63b42d20eb614bb992bba2fefa9c --- /dev/null +++ b/src/turbulenceModels/compressible/turbulenceModel/Make/options @@ -0,0 +1,7 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude + +LIB_LIBS = \ + -lfiniteVolume + diff --git a/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.C b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.C new file mode 100644 index 0000000000000000000000000000000000000000..3a9ae2a52bdc289a9e4e7303db5ad40910cd5edf --- /dev/null +++ b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.C @@ -0,0 +1,227 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 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 "laminar.H" +#include "Time.H" +#include "volFields.H" +#include "fvcGrad.H" +#include "fvcDiv.H" +#include "fvmLaplacian.H" +#include "addToRunTimeSelectionTable.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(laminar, 0); +addToRunTimeSelectionTable(turbulenceModel, laminar, turbulenceModel); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +laminar::laminar +( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phi, + const basicThermo& thermoPhysicalModel +) +: + turbulenceModel(rho, U, phi, thermoPhysicalModel) +{} + + +// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // + +autoPtr<laminar> laminar::New +( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phi, + const basicThermo& thermoPhysicalModel +) +{ + return autoPtr<laminar>(new laminar(rho, U, phi, thermoPhysicalModel)); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +tmp<volScalarField> laminar::mut() const +{ + return tmp<volScalarField> + ( + new volScalarField + ( + IOobject + ( + "mut", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedScalar("mut", mu().dimensions(), 0.0) + ) + ); +} + + +tmp<volScalarField> laminar::muEff() const +{ + return tmp<volScalarField>(new volScalarField("muEff", mu())); +} + + +tmp<volScalarField> laminar::alphaEff() const +{ + return tmp<volScalarField>(new volScalarField("alphaEff", alpha())); +} + + +tmp<volScalarField> laminar::k() const +{ + return tmp<volScalarField> + ( + new volScalarField + ( + IOobject + ( + "k", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedScalar("k", sqr(U_.dimensions()), 0.0) + ) + ); +} + + +tmp<volScalarField> laminar::epsilon() const +{ + return tmp<volScalarField> + ( + new volScalarField + ( + IOobject + ( + "epsilon", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedScalar + ( + "epsilon", sqr(U_.dimensions())/dimTime, 0.0 + ) + ) + ); +} + + +tmp<volSymmTensorField> laminar::R() const +{ + return tmp<volSymmTensorField> + ( + new volSymmTensorField + ( + IOobject + ( + "R", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedSymmTensor + ( + "R", sqr(U_.dimensions()), symmTensor::zero + ) + ) + ); +} + + +tmp<volSymmTensorField> laminar::devRhoReff() const +{ + return tmp<volSymmTensorField> + ( + new volSymmTensorField + ( + IOobject + ( + "devRhoReff", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + -mu()*dev(twoSymm(fvc::grad(U_))) + ) + ); +} + + +tmp<fvVectorMatrix> laminar::divDevRhoReff(volVectorField& U) const +{ + return + ( + - fvm::laplacian(muEff(), U) + - fvc::div(muEff()*dev2(fvc::grad(U)().T())) + ); +} + + +bool laminar::read() +{ + return true; +} + + +void laminar::correct() +{ + turbulenceModel::correct(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H new file mode 100644 index 0000000000000000000000000000000000000000..ac1829d84c66d4c19355a85c635897cba1f83464 --- /dev/null +++ b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 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::compressible::laminar + +Description + Turbulence model for laminar compressible flow. + +SourceFiles + laminar.C + +\*---------------------------------------------------------------------------*/ + +#ifndef laminar_H +#define laminar_H + +#include "turbulenceModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + +/*---------------------------------------------------------------------------*\ + Class laminar Declaration +\*---------------------------------------------------------------------------*/ + +class laminar +: + public turbulenceModel +{ + +public: + + //- Runtime type information + TypeName("laminar"); + + // Constructors + + //- Construct from components + laminar + ( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phi, + const basicThermo& thermoPhysicalModel + ); + + + // Selectors + + //- Return a reference to the selected turbulence model + static autoPtr<laminar> New + ( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phi, + const basicThermo& thermoPhysicalModel + ); + + + //- Destructor + virtual ~laminar() + {} + + + // Member Functions + + //- Return the turbulence viscosity, i.e. 0 for laminar flow + virtual tmp<volScalarField> mut() const; + + //- Return the effective viscosity, i.e. the laminar viscosity + virtual tmp<volScalarField> muEff() const; + + //- Return the effective turbulent thermal diffusivity + virtual tmp<volScalarField> alphaEff() const; + + //- Return the turbulence kinetic energy, i.e. 0 for laminar flow + virtual tmp<volScalarField> k() const; + + //- Return the turbulence kinetic energy dissipation rate, + // i.e. 0 for laminar flow + virtual tmp<volScalarField> epsilon() const; + + //- Return the Reynolds stress tensor, i.e. 0 for laminar flow + virtual tmp<volSymmTensorField> R() const; + + //- Return the effective stress tensor including the laminar stress + virtual tmp<volSymmTensorField> devRhoReff() const; + + //- Return the source term for the momentum equation + virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; + + //- Correct the laminar viscosity + virtual void correct(); + + //- Read turbulenceProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/turbulenceModel/newTurbulenceModel.C b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.C similarity index 69% rename from src/turbulenceModels/incompressible/turbulenceModel/newTurbulenceModel.C rename to src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.C index ef609c61f150501672382b1f12952a34d7fc82bf..28e5001b6ae2c24b2d842e17397a16d4e43f6585 100644 --- a/src/turbulenceModels/incompressible/turbulenceModel/newTurbulenceModel.C +++ b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.C @@ -26,21 +26,48 @@ License #include "turbulenceModel.H" #include "volFields.H" +#include "surfaceFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -namespace incompressible +namespace compressible { -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(turbulenceModel, 0); +defineRunTimeSelectionTable(turbulenceModel, turbulenceModel); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +turbulenceModel::turbulenceModel +( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phi, + const basicThermo& thermophysicalModel +) +: + runTime_(U.time()), + mesh_(U.mesh()), + + rho_(rho), + U_(U), + phi_(phi), + thermophysicalModel_(thermophysicalModel) +{} + + +// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // autoPtr<turbulenceModel> turbulenceModel::New ( + const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - transportModel& transport + const basicThermo& thermophysicalModel ) { word turbulenceModelTypeName; @@ -61,7 +88,7 @@ autoPtr<turbulenceModel> turbulenceModel::New ) ); - turbulencePropertiesDict.lookup("simulationType") + turbulencePropertiesDict.lookup("turbulenceModel") >> turbulenceModelTypeName; } @@ -75,8 +102,9 @@ autoPtr<turbulenceModel> turbulenceModel::New { FatalErrorIn ( - "turbulenceModel::New(const volVectorField&, " - "const surfaceScalarField&, transportModel&)" + "turbulenceModel::New(const volScalarField&, " + "const volVectorField&, const surfaceScalarField&, " + "basicThermo&)" ) << "Unknown turbulenceModel type " << turbulenceModelTypeName << endl << endl << "Valid turbulenceModel types are :" << endl @@ -84,13 +112,22 @@ autoPtr<turbulenceModel> turbulenceModel::New << exit(FatalError); } - return autoPtr<turbulenceModel>(cstrIter()(U, phi, transport)); + return autoPtr<turbulenceModel> + ( + cstrIter()(rho, U, phi, thermophysicalModel) + ); } +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +turbulenceModel::~turbulenceModel() +{} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace incompressible +} // End namespace compressible } // End namespace Foam // ************************************************************************* // diff --git a/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H new file mode 100644 index 0000000000000000000000000000000000000000..46c6b2a625c4f3ab4ccc70a6820d67a367c3f75e --- /dev/null +++ b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H @@ -0,0 +1,229 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 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::compressible::turbulenceModels + +Description + Namespace for compressible turbulence turbulence models. + + +Class + Foam::compressible::turbulenceModel + +Description + Abstract base class for compressible turbulence models + (RAS, LES and laminar). + + +SourceFiles + turbulenceModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef compressibleturbulenceModel_H +#define compressibleturbulenceModel_H + +#include "primitiveFieldsFwd.H" +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" +#include "fvMatricesFwd.H" +#include "basicThermo.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declarations +class fvMesh; + +namespace compressible +{ + +/*---------------------------------------------------------------------------*\ + Class turbulenceModel Declaration +\*---------------------------------------------------------------------------*/ + +class turbulenceModel +{ + +protected: + + // Protected data + + const Time& runTime_; + const fvMesh& mesh_; + + const volScalarField& rho_; + const volVectorField& U_; + const surfaceScalarField& phi_; + + const basicThermo& thermophysicalModel_; + + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + turbulenceModel(const turbulenceModel&); + + //- Disallow default bitwise assignment + void operator=(const turbulenceModel&); + + +public: + + //- Runtime type information + TypeName("turbulenceModel"); + + + // Declare run-time constructor selection table + + declareRunTimeNewSelectionTable + ( + autoPtr, + turbulenceModel, + turbulenceModel, + ( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phi, + const basicThermo& thermoPhysicalModel + ), + (rho, U, phi, thermoPhysicalModel) + ); + + + // Constructors + + //- Construct from components + turbulenceModel + ( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phi, + const basicThermo& thermoPhysicalModel + ); + + + // Selectors + + //- Return a reference to the selected turbulence model + static autoPtr<turbulenceModel> New + ( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phi, + const basicThermo& thermoPhysicalModel + ); + + + //- Destructor + virtual ~turbulenceModel(); + + + // Member Functions + + //- Access function to density field + const volScalarField& rho() const + { + return rho_; + } + + //- Access function to velocity field + const volVectorField& U() const + { + return U_; + } + + //- Access function to flux field + const surfaceScalarField& phi() const + { + return phi_; + } + + //- Access function to thermophysical model + const basicThermo& thermo() const + { + return thermophysicalModel_; + } + + //- Return the laminar viscosity + const volScalarField& mu() const + { + return thermophysicalModel_.mu(); + } + + //- Return the laminar thermal conductivity + const volScalarField& alpha() const + { + return thermophysicalModel_.alpha(); + } + + //- Return the turbulence viscosity + virtual tmp<volScalarField> mut() const = 0; + + //- Return the effective viscosity + virtual tmp<volScalarField> muEff() const = 0; + + //- Return the effective turbulent thermal diffusivity + virtual tmp<volScalarField> alphaEff() const = 0; + + //- Return the turbulence kinetic energy + virtual tmp<volScalarField> k() const = 0; + + //- Return the turbulence kinetic energy dissipation rate + virtual tmp<volScalarField> epsilon() const = 0; + + //- Return the Reynolds stress tensor + virtual tmp<volSymmTensorField> R() const = 0; + + //- Return the effective stress tensor including the laminar stress + virtual tmp<volSymmTensorField> devRhoReff() const = 0; + + //- Return the source term for the momentum equation + virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const = 0; + + //- Solve the turbulence equations and correct the turbulence viscosity + virtual void correct() = 0; + + //- Read turbulenceProperties dictionary + virtual bool read() = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/LES/LESModel/LESModel.H b/src/turbulenceModels/incompressible/LES/LESModel/LESModel.H index 776328d3a229f75a58792311256e85f1051f111b..94ee816164cfd35f291d946269e78ca104fb146f 100644 --- a/src/turbulenceModels/incompressible/LES/LESModel/LESModel.H +++ b/src/turbulenceModels/incompressible/LES/LESModel/LESModel.H @@ -157,18 +157,6 @@ public: // Member Functions - //- Access function to velocity field - inline const volVectorField& U() const - { - return U_; - } - - //- Access function to flux field - inline const surfaceScalarField& phi() const - { - return phi_; - } - //- Access the dictionary which provides info. about choice of // models, and all related data (particularly model coefficients). inline dictionary& coeffDict() diff --git a/src/turbulenceModels/incompressible/LES/spectEddyVisc/spectEddyVisc.C b/src/turbulenceModels/incompressible/LES/spectEddyVisc/spectEddyVisc.C index cda43a2ccf4f5230e409e7c2003a1118d37cdd26..67005d54fe1e9c10702e2bc105491b7228b27c8b 100644 --- a/src/turbulenceModels/incompressible/LES/spectEddyVisc/spectEddyVisc.C +++ b/src/turbulenceModels/incompressible/LES/spectEddyVisc/spectEddyVisc.C @@ -43,7 +43,6 @@ addToRunTimeSelectionTable(LESModel, spectEddyVisc, dictionary); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// from components spectEddyVisc::spectEddyVisc ( const volVectorField& U, diff --git a/src/turbulenceModels/incompressible/RAS/LRR/LRR.H b/src/turbulenceModels/incompressible/RAS/LRR/LRR.H index 8d515d4d56cfd92f0439ad61fa5306e478f8c740..9d0a4ceb0a8756e6d09bfa3ba26cb1127df2a193 100644 --- a/src/turbulenceModels/incompressible/RAS/LRR/LRR.H +++ b/src/turbulenceModels/incompressible/RAS/LRR/LRR.H @@ -102,7 +102,7 @@ public: // Constructors - //- from components + //- Construct from components LRR ( const volVectorField& U, diff --git a/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.H b/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.H index 422ddffdf60b01da8fb2ff95e619b14a1835a92e..0ec4d36cfb99212ebc57c221bbaf46b1d4ea69dc 100644 --- a/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.H +++ b/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.H @@ -82,7 +82,7 @@ public: // Constructors - //- from components + //- Construct from components LamBremhorstKE ( const volVectorField& U, diff --git a/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H b/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H index e3f5d7a0afd1eda44a1348e406f6c7b21d442a0a..ed94be0f2469765b974161519701f4d3eba1eda2 100644 --- a/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H +++ b/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H @@ -110,7 +110,7 @@ public: // Constructors - //- from components + //- Construct from components LaunderGibsonRSTM ( const volVectorField& U, diff --git a/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.H b/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.H index 22f5adf28f309e7a0a113bf566ec259d28307884..1e50f7ceb7310a6340fee3890d4bc2e4ff83c457 100644 --- a/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.H +++ b/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.H @@ -96,7 +96,7 @@ public: // Constructors - //- from components + //- Construct from components LaunderSharmaKE ( const volVectorField& U, diff --git a/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.H b/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.H index e1617389b7eb80716bed9329aabe3cb0b81d3a1e..b187473fa7dab61e2086ac707c60aac4150b29d2 100644 --- a/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.H +++ b/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.H @@ -90,7 +90,7 @@ public: // Constructors - //- from components + //- Construct from components LienCubicKE ( const volVectorField& U, diff --git a/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.H b/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.H index 02d0fc63cf6418b9db1643c3db45f917da812bf1..c71bf4fd03e7e0783e492005d4a17bbb6c999e5b 100644 --- a/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.H +++ b/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.H @@ -115,7 +115,7 @@ public: // Constructors - //- from components + //- Construct from components LienCubicKELowRe ( const volVectorField& U, diff --git a/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.H b/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.H index 41df680dd953a2a050266b64764a9987b838fb84..ce1e332d691b57e25253db43aa224d7ff71965ab 100644 --- a/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.H +++ b/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.H @@ -85,7 +85,7 @@ public: // Constructors - //- from components + //- Construct from components LienLeschzinerLowRe ( const volVectorField& U, diff --git a/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.H b/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.H index 091c99cadf27b89e29736eee5b0e6c09147c8b48..68f04d1322f405dfd0786ab194b3e93680f0b86d 100644 --- a/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.H +++ b/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.H @@ -89,7 +89,7 @@ public: // Constructors - //- from components + //- Construct from components NonlinearKEShih ( const volVectorField& U, diff --git a/src/turbulenceModels/incompressible/RAS/QZeta/QZeta.H b/src/turbulenceModels/incompressible/RAS/QZeta/QZeta.H index 0d76112835a22aee4cea9a37d13d98d51dddc25d..ed50b7f926666657c44d9be169b88633dc5e73f5 100644 --- a/src/turbulenceModels/incompressible/RAS/QZeta/QZeta.H +++ b/src/turbulenceModels/incompressible/RAS/QZeta/QZeta.H @@ -86,7 +86,7 @@ public: // Constructors - //- from components + //- Construct from components QZeta ( const volVectorField& U, diff --git a/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.H b/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.H index 7710c54bf16948dda107d0b2cd425cfa0ddef6ff..9d89294f8189985e499837385dd5137e6a8ad934 100644 --- a/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.H +++ b/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.H @@ -93,7 +93,7 @@ public: // Constructors - //- from components + //- Construct from components RNGkEpsilon ( const volVectorField& U, diff --git a/src/turbulenceModels/incompressible/RAS/SpalartAllmaras/SpalartAllmaras.H b/src/turbulenceModels/incompressible/RAS/SpalartAllmaras/SpalartAllmaras.H index abc946efeca57fe7a9686a5d87dc5784475d231c..54c418d483b40957a9c036ea4a2bf255e328d69d 100644 --- a/src/turbulenceModels/incompressible/RAS/SpalartAllmaras/SpalartAllmaras.H +++ b/src/turbulenceModels/incompressible/RAS/SpalartAllmaras/SpalartAllmaras.H @@ -130,7 +130,7 @@ public: // Constructors - //- from components + //- Construct from components SpalartAllmaras ( const volVectorField& U, diff --git a/src/turbulenceModels/incompressible/RAS/laminar/laminar.H b/src/turbulenceModels/incompressible/RAS/laminar/laminar.H index 6675a336cbd6d3b8fbc881be8eaa0566da7eb0eb..23af89574f79b8141682a67a9a8e94ef920c07a0 100644 --- a/src/turbulenceModels/incompressible/RAS/laminar/laminar.H +++ b/src/turbulenceModels/incompressible/RAS/laminar/laminar.H @@ -63,7 +63,7 @@ public: // Constructors - //- from components + //- Construct from components laminar ( const volVectorField& U, diff --git a/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.H b/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.H index 9a6330065373a942552e7399c7fd9bc82fbdb9b6..3b3795910f8a114cd9a792420fb7dd5fedf246eb 100644 --- a/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.H +++ b/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.H @@ -110,7 +110,7 @@ public: // Constructors - //- from components + //- Construct from components realizableKE ( const volVectorField& U, diff --git a/src/turbulenceModels/incompressible/turbulenceModel/Make/files b/src/turbulenceModels/incompressible/turbulenceModel/Make/files index 80aac8369019e68848657645c08fee6f304f5479..a77efed2ab7137c56185f25d100b11c48ab9cc6d 100644 --- a/src/turbulenceModels/incompressible/turbulenceModel/Make/files +++ b/src/turbulenceModels/incompressible/turbulenceModel/Make/files @@ -1,5 +1,4 @@ turbulenceModel.C -newTurbulenceModel.C laminar/laminar.C LIB = $(FOAM_LIBBIN)/libincompressibleTurbulenceModel diff --git a/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.C b/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.C index e3a4a00dafbd3ae14c12fad14ed57e632733213a..9ed06e844edf029129b8857ca54917192c39a69d 100644 --- a/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.C +++ b/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.C @@ -27,7 +27,6 @@ License #include "turbulenceModel.H" #include "volFields.H" #include "surfaceFields.H" -#include "wallFvPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -59,6 +58,62 @@ turbulenceModel::turbulenceModel {} +// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // + +autoPtr<turbulenceModel> turbulenceModel::New +( + const volVectorField& U, + const surfaceScalarField& phi, + transportModel& transport +) +{ + word turbulenceModelTypeName; + + // Enclose the creation of the turbulencePropertiesDict to ensure it is + // deleted before the turbulenceModel is created otherwise the dictionary + // is entered in the database twice + { + IOdictionary turbulencePropertiesDict + ( + IOobject + ( + "turbulenceProperties", + U.time().constant(), + U.db(), + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + turbulencePropertiesDict.lookup("simulationType") + >> turbulenceModelTypeName; + } + + Info<< "Selecting turbulence model type " + << turbulenceModelTypeName << endl; + + turbulenceModelConstructorTable::iterator cstrIter = + turbulenceModelConstructorTablePtr_->find(turbulenceModelTypeName); + + if (cstrIter == turbulenceModelConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "turbulenceModel::New(const volVectorField&, " + "const surfaceScalarField&, transportModel&)" + ) << "Unknown turbulenceModel type " << turbulenceModelTypeName + << endl << endl + << "Valid turbulenceModel types are :" << endl + << turbulenceModelConstructorTablePtr_->toc() + << exit(FatalError); + } + + return autoPtr<turbulenceModel>(cstrIter()(U, phi, transport)); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + turbulenceModel::~turbulenceModel() {} diff --git a/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H b/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H index 490b59e14e6487278f46896b3884e64eca267249..01380eacb8328b4524d172dee01ceab03da5b602 100644 --- a/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H +++ b/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H @@ -144,6 +144,18 @@ public: // Member Functions + //- Access function to velocity field + inline const volVectorField& U() const + { + return U_; + } + + //- Access function to flux field + inline const surfaceScalarField& phi() const + { + return phi_; + } + //- Access function to incompressible transport model inline transportModel& transport() const {