Commit 5109a8d2 authored by henry's avatar henry
Browse files

Added generic tumbulenceModel base class to the compressible RAS and LES models.

This allows the constructions of applications which are independent of the particular
type of turbulence modelling.
parent ecb510e9
......@@ -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&);
......
......@@ -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&);
......
......@@ -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&);
......
......@@ -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
......
......@@ -43,7 +43,6 @@ addToRunTimeSelectionTable(LESModel, DeardorffDiffStress, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
DeardorffDiffStress::DeardorffDiffStress
(
const volScalarField& rho,
......
......@@ -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();
};
......
......@@ -37,7 +37,6 @@ namespace LESModels
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
GenEddyVisc::GenEddyVisc
(
const volScalarField& rho,
......@@ -86,9 +85,7 @@ GenEddyVisc::GenEddyVisc
),
mesh_
)
{
// printCoeffs();
}
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
......
......@@ -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();
};
......
......@@ -37,7 +37,6 @@ namespace LESModels
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
GenSGSStress::GenSGSStress
(
const volScalarField& rho,
......@@ -90,9 +89,7 @@ GenSGSStress::GenSGSStress
),
mesh_
)
{
// printCoeffs();
}
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
......
......@@ -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();
};
......
......@@ -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")),
......
......@@ -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.
......
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
......@@ -43,7 +43,6 @@ addToRunTimeSelectionTable(LESModel, Smagorinsky, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// from components
Smagorinsky::Smagorinsky
(
const volScalarField& rho,
......
......@@ -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();
};
......
......@@ -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();
};
......
......@@ -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)
......
......@@ -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();
};
......