Commit b3d794ee authored by Henry's avatar Henry
Browse files

TurbulenceModels: Added structure for LES model and the Smagorinsky model within this structure.

parent c4f83d91
......@@ -2,7 +2,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModel/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \
-IphaseIncompressibleTurbulenceModels/lnInclude \
......
......@@ -3,7 +3,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/transportModels/incompressible/transportModel \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModel/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \
-I../twoPhaseSystem/lnInclude \
......
......@@ -24,10 +24,8 @@ License
\*---------------------------------------------------------------------------*/
#include "kineticTheoryModel.H"
#include "surfaceInterpolate.H"
#include "mathematicalConstants.H"
#include "twoPhaseSystem.H"
#include "fvcDiv.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
......@@ -43,7 +41,7 @@ Foam::kineticTheoryModel::kineticTheoryModel
const word& type
)
:
RASModels::eddyViscosity<PhaseIncompressibleTurbulenceModel<phaseModel> >
eddyViscosity<RASModel<PhaseIncompressibleTurbulenceModel<phaseModel> > >
(
type,
alpha,
......@@ -517,9 +515,9 @@ bool Foam::kineticTheoryModel::read()
{
if
(
RASModels::eddyViscosity
eddyViscosity
<
PhaseIncompressibleTurbulenceModel<phaseModel>
RASModel<PhaseIncompressibleTurbulenceModel<phaseModel> >
>::read()
)
{
......
......@@ -34,11 +34,11 @@ SourceFiles
#ifndef kineticTheoryModel_H
#define kineticTheoryModel_H
#include "RASModel.H"
#include "eddyViscosity.H"
#include "PhaseIncompressibleTurbulenceModel.H"
#include "dragModel.H"
#include "phaseModel.H"
#include "autoPtr.H"
#include "dragModel.H"
#include "viscosityModel.H"
#include "conductivityModel.H"
#include "radialModel.H"
......@@ -57,9 +57,9 @@ namespace Foam
class kineticTheoryModel
:
public RASModels::eddyViscosity
public eddyViscosity
<
PhaseIncompressibleTurbulenceModel<phaseModel>
RASModel<PhaseIncompressibleTurbulenceModel<phaseModel> >
>
{
// Private data
......
......@@ -24,13 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "PhaseIncompressibleTurbulenceModel.H"
#include "laminar.H"
#include "RASModel.H"
#include "kEpsilon.H"
#include "LaheyKEpsilon.H"
#include "continuousGasKEpsilon.H"
#include "kineticTheoryModel.H"
#include "phasePressureModel.H"
#include "phaseModel.H"
#include "addToRunTimeSelectionTable.H"
......@@ -52,7 +45,13 @@ namespace Foam
typedef PhaseIncompressibleTurbulenceModel<phaseModel>
incompressibleTransportTurbulenceModel;
}
#include "laminar.H"
namespace Foam
{
typedef laminar<incompressibleTransportTurbulenceModel>
incompressibleLaminar;
......@@ -64,8 +63,16 @@ namespace Foam
incompressibleLaminar,
dictionary
);
}
#include "RASModel.H"
#include "kEpsilon.H"
#include "LaheyKEpsilon.H"
#include "continuousGasKEpsilon.H"
namespace Foam
{
typedef RASModel<incompressibleTransportTurbulenceModel>
incompressibleRASModel;
......@@ -131,6 +138,8 @@ namespace Foam
}
#include "kineticTheoryModel.H"
namespace Foam
{
typedef PhaseIncompressibleTurbulenceModel<phaseModel>
......@@ -150,6 +159,8 @@ namespace Foam
}
#include "phasePressureModel.H"
namespace Foam
{
typedef PhaseIncompressibleTurbulenceModel<phaseModel>
......@@ -169,4 +180,40 @@ namespace Foam
}
#include "LESModel.H"
#include "Smagorinsky.H"
namespace Foam
{
typedef LESModel<incompressibleTransportTurbulenceModel>
incompressibleLESModel;
defineNamedTemplateTypeNameAndDebug(incompressibleLESModel, 0);
defineTemplateRunTimeSelectionTable(incompressibleLESModel, dictionary);
addToRunTimeSelectionTable
(
basePhaseIncompressibleTransportTurbulenceModel,
incompressibleLESModel,
dictionary
);
namespace LESModels
{
typedef Smagorinsky<incompressibleTransportTurbulenceModel>
incompressibleSmagorinsky;
defineNamedTemplateTypeNameAndDebug(incompressibleSmagorinsky, 0);
addToRunTimeSelectionTable
(
incompressibleLESModel,
incompressibleSmagorinsky,
dictionary
);
}
}
// ************************************************************************* //
......@@ -24,9 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "phasePressureModel.H"
#include "surfaceInterpolate.H"
#include "twoPhaseSystem.H"
#include "dimensionedType.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
......@@ -42,7 +40,7 @@ Foam::phasePressureModel::phasePressureModel
const word& type
)
:
RASModels::eddyViscosity<PhaseIncompressibleTurbulenceModel<phaseModel> >
eddyViscosity<RASModel<PhaseIncompressibleTurbulenceModel<phaseModel> > >
(
type,
alpha,
......@@ -196,9 +194,9 @@ bool Foam::phasePressureModel::read()
{
if
(
RASModels::eddyViscosity
eddyViscosity
<
PhaseIncompressibleTurbulenceModel<phaseModel>
RASModel<PhaseIncompressibleTurbulenceModel<phaseModel> >
>::read()
)
{
......
......@@ -34,16 +34,10 @@ SourceFiles
#ifndef phasePressureModel_H
#define phasePressureModel_H
#include "RASModel.H"
#include "eddyViscosity.H"
#include "PhaseIncompressibleTurbulenceModel.H"
#include "dragModel.H"
#include "phaseModel.H"
#include "autoPtr.H"
#include "viscosityModel.H"
#include "conductivityModel.H"
#include "radialModel.H"
#include "granularPressureModel.H"
#include "frictionalStressModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -57,9 +51,9 @@ namespace Foam
class phasePressureModel
:
public RASModels::eddyViscosity
public eddyViscosity
<
PhaseIncompressibleTurbulenceModel<phaseModel>
RASModel<PhaseIncompressibleTurbulenceModel<phaseModel> >
>
{
// Private data
......
EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModel/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
......
EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModel/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/finiteVolume/cfdTools \
......
......@@ -3,7 +3,7 @@ cd ${0%/*} || exit 1 # run from this directory
makeType=${1:-libso}
set -x
wmake libso turbulenceModel
wmake libso turbulenceModels
wmake libso incompressible
wmake libso compressible
wmakeLnInclude phaseIncompressible
......
EXE_INC = \
-I../turbulenceModel/lnInclude \
-I../turbulenceModels/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
......@@ -9,4 +9,5 @@ LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \
-lfluidThermophysicalModels \
-lturbulenceModels \
-lspecie
EXE_INC = \
-I../turbulenceModel/lnInclude \
-I../turbulenceModels/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude
LIB_LIBS = \
-lincompressibleTransportModels \
-lturbulenceModels \
-lfiniteVolume \
-lmeshTools
......@@ -24,9 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "IncompressibleTurbulenceModel.H"
#include "laminar.H"
#include "RASModel.H"
#include "kEpsilon.H"
#include "transportModel.H"
#include "addToRunTimeSelectionTable.H"
......@@ -50,7 +47,13 @@ namespace Foam
<
transportModel
> incompressibleTransportTurbulenceModel;
}
#include "laminar.H"
namespace Foam
{
typedef laminar<incompressibleTransportTurbulenceModel>
incompressibleLaminar;
......@@ -62,8 +65,15 @@ namespace Foam
incompressibleLaminar,
dictionary
);
}
#include "RASModel.H"
#include "kEpsilon.H"
namespace Foam
{
typedef RASModel<incompressibleTransportTurbulenceModel>
incompressibleRASModel;
......@@ -95,4 +105,40 @@ namespace Foam
}
#include "LESModel.H"
#include "Smagorinsky.H"
namespace Foam
{
typedef LESModel<incompressibleTransportTurbulenceModel>
incompressibleLESModel;
defineNamedTemplateTypeNameAndDebug(incompressibleLESModel, 0);
defineTemplateRunTimeSelectionTable(incompressibleLESModel, dictionary);
addToRunTimeSelectionTable
(
baseIncompressibleTransportTurbulenceModel,
incompressibleLESModel,
dictionary
);
namespace LESModels
{
typedef Smagorinsky<incompressibleTransportTurbulenceModel>
incompressibleSmagorinsky;
defineNamedTemplateTypeNameAndDebug(incompressibleSmagorinsky, 0);
addToRunTimeSelectionTable
(
incompressibleLESModel,
incompressibleSmagorinsky,
dictionary
);
}
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "LESModel.H"
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class BasicTurbulenceModel>
void Foam::LESModel<BasicTurbulenceModel>::printCoeffs(const word& type)
{
if (printCoeffs_)
{
Info<< type << "Coeffs" << coeffDict_ << endl;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
Foam::LESModel<BasicTurbulenceModel>::LESModel
(
const word& type,
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName
)
:
BasicTurbulenceModel
(
alpha,
rho,
U,
alphaPhi,
phi,
transport,
propertiesName
),
LESDict_(this->subOrEmptyDict("LES")),
turbulence_(LESDict_.lookup("turbulence")),
printCoeffs_(LESDict_.lookupOrDefault<Switch>("printCoeffs", false)),
coeffDict_(LESDict_.subOrEmptyDict(type + "Coeffs")),
kMin_
(
dimensioned<scalar>::lookupOrAddToDict
(
"kMin",
LESDict_,
SMALL,
sqr(dimVelocity)
)
),
delta_(LESdelta::New("delta", U.mesh(), LESDict_))
{
// Force the construction of the mesh deltaCoeffs which may be needed
// for the construction of the derived models and BCs
this->mesh_.deltaCoeffs();
}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
Foam::autoPtr<Foam::LESModel<BasicTurbulenceModel> >
Foam::LESModel<BasicTurbulenceModel>::New
(
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName
)
{
// get model name, but do not register the dictionary
// otherwise it is registered in the database twice
const word modelType
(
IOdictionary
(
IOobject
(
IOobject::groupName(propertiesName, U.group()),
U.time().constant(),
U.db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
).subDict("LES").lookup("LESModel")
);
Info<< "Selecting LES turbulence model " << modelType << endl;
typename dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"LESModel::New"
"("
"const volScalarField&, "
"const volVectorField&, "
"const surfaceScalarField&, "
"transportModel&, "
"const word&"
")"
) << "Unknown LESModel type "
<< modelType << nl << nl
<< "Valid LESModel types:" << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<LESModel>
(
cstrIter()(alpha, rho, U, alphaPhi, phi, transport, propertiesName)
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
void Foam::LESModel<BasicTurbulenceModel>::correct()
{
BasicTurbulenceModel::correct();
}
template<class BasicTurbulenceModel>
bool Foam::LESModel<BasicTurbulenceModel>::read()
{
if (turbulenceModel::read())
{
LESDict_ <<= this->subDict("LES");
LESDict_.lookup("turbulence") >> turbulence_;
if (const dictionary* dictPtr = LESDict_.subDictPtr(type() + "Coeffs"))
{
coeffDict_ <<= *dictPtr;
}
kMin_.readIfPresent(LESDict_);
return true;
}
else
{
return false;
}
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Namespace
Foam::LESModels