mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
TurbulenceModels: Created a general base-class and selection mechanism for laminar stress models
Renamed the original 'laminar' model to 'Stokes' to indicate it is a
linear stress model supporting both Newtonian and non-Newtonian
viscosity.
This general framework will support linear, non-linear, visco-elastic
etc. laminar transport models.
For backward compatibility the 'Stokes' laminar stress model can be
selected either the original 'laminar' 'simulationType'
specification in turbulenceProperties:
simulationType laminar;
or using the new more general 'laminarModel' specification:
simulationType laminar;
laminar
{
laminarModel Stokes;
}
which allows other laminar stress models to be selected.
This commit is contained in:
@ -28,8 +28,8 @@ License
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "makeTurbulenceModel.H"
|
||||
|
||||
#include "laminar.H"
|
||||
#include "turbulentTransportModel.H"
|
||||
#include "laminarModel.H"
|
||||
#include "RASModel.H"
|
||||
#include "LESModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -52,6 +52,10 @@ makeBaseTurbulenceModel
|
||||
singlePhaseTransportModel
|
||||
);
|
||||
|
||||
#define makeLaminarModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(singlePhaseTransportModelPhaseIncompressibleTurbulenceModel, laminar, Type)
|
||||
|
||||
#define makeRASModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(singlePhaseTransportModelPhaseIncompressibleTurbulenceModel, RAS, Type)
|
||||
@ -60,6 +64,9 @@ makeBaseTurbulenceModel
|
||||
makeTemplatedTurbulenceModel \
|
||||
(singlePhaseTransportModelPhaseIncompressibleTurbulenceModel, LES, Type)
|
||||
|
||||
#include "Stokes.H"
|
||||
makeLaminarModel(Stokes);
|
||||
|
||||
#include "kEpsilon.H"
|
||||
makeRASModel(kEpsilon);
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ License
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "makeTurbulenceModel.H"
|
||||
|
||||
#include "laminar.H"
|
||||
#include "laminarModel.H"
|
||||
#include "RASModel.H"
|
||||
#include "LESModel.H"
|
||||
|
||||
@ -52,6 +52,14 @@ makeBaseTurbulenceModel
|
||||
incompressibleTwoPhaseInteractingMixture
|
||||
);
|
||||
|
||||
#define makeLaminarModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
( \
|
||||
incompressibleTwoPhaseInteractingMixtureCompressibleTurbulenceModel, \
|
||||
laminar, \
|
||||
Type \
|
||||
)
|
||||
|
||||
#define makeRASModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
( \
|
||||
@ -68,6 +76,9 @@ makeBaseTurbulenceModel
|
||||
Type \
|
||||
)
|
||||
|
||||
#include "Stokes.H"
|
||||
makeLaminarModel(Stokes);
|
||||
|
||||
#include "kEpsilon.H"
|
||||
makeRASModel(kEpsilon);
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ License
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "makeTurbulenceModel.H"
|
||||
|
||||
#include "laminar.H"
|
||||
#include "laminarModel.H"
|
||||
#include "RASModel.H"
|
||||
#include "LESModel.H"
|
||||
|
||||
@ -53,6 +53,10 @@ makeBaseTurbulenceModel
|
||||
phaseModel
|
||||
);
|
||||
|
||||
#define makeLaminarModel(Type) \
|
||||
makeTemplatedLaminarModel \
|
||||
(phaseModelPhaseCompressibleTurbulenceModel, laminar, Type)
|
||||
|
||||
#define makeRASModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(phaseModelPhaseCompressibleTurbulenceModel, RAS, Type)
|
||||
@ -61,6 +65,9 @@ makeBaseTurbulenceModel
|
||||
makeTemplatedTurbulenceModel \
|
||||
(phaseModelPhaseCompressibleTurbulenceModel, LES, Type)
|
||||
|
||||
#include "Stokes.H"
|
||||
makeLaminarModel(Stokes);
|
||||
|
||||
#include "kEpsilon.H"
|
||||
makeRASModel(kEpsilon);
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ License
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "makeTurbulenceModel.H"
|
||||
|
||||
#include "laminar.H"
|
||||
#include "laminarModel.H"
|
||||
#include "RASModel.H"
|
||||
#include "LESModel.H"
|
||||
|
||||
@ -53,6 +53,10 @@ makeBaseTurbulenceModel
|
||||
phaseModel
|
||||
);
|
||||
|
||||
#define makeLaminarModel(Type) \
|
||||
makeTemplatedLaminarModel \
|
||||
(phaseModelPhaseCompressibleTurbulenceModel, laminar, Type)
|
||||
|
||||
#define makeRASModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(phaseModelPhaseCompressibleTurbulenceModel, RAS, Type)
|
||||
@ -61,6 +65,9 @@ makeBaseTurbulenceModel
|
||||
makeTemplatedTurbulenceModel \
|
||||
(phaseModelPhaseCompressibleTurbulenceModel, LES, Type)
|
||||
|
||||
#include "Stokes.H"
|
||||
makeLaminarModel(Stokes);
|
||||
|
||||
#include "kEpsilon.H"
|
||||
makeRASModel(kEpsilon);
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ License
|
||||
#include "ThermalDiffusivity.H"
|
||||
#include "EddyDiffusivity.H"
|
||||
|
||||
#include "laminar.H"
|
||||
#include "laminarModel.H"
|
||||
#include "RASModel.H"
|
||||
#include "LESModel.H"
|
||||
|
||||
@ -58,6 +58,10 @@ makeBaseTurbulenceModel
|
||||
phaseModel
|
||||
);
|
||||
|
||||
#define makeLaminarModel(Type) \
|
||||
makeTemplatedLaminarModel \
|
||||
(phaseModelPhaseCompressibleTurbulenceModel, laminar, Type)
|
||||
|
||||
#define makeRASModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(phaseModelPhaseCompressibleTurbulenceModel, RAS, Type)
|
||||
@ -66,6 +70,9 @@ makeBaseTurbulenceModel
|
||||
makeTemplatedTurbulenceModel \
|
||||
(phaseModelPhaseCompressibleTurbulenceModel, LES, Type)
|
||||
|
||||
#include "Stokes.H"
|
||||
makeLaminarModel(Stokes);
|
||||
|
||||
#include "kEpsilon.H"
|
||||
makeRASModel(kEpsilon);
|
||||
|
||||
|
||||
@ -34,7 +34,8 @@ License
|
||||
{ \
|
||||
typedef TDModel<BaseModel<Transport>> \
|
||||
Transport##BaseModel; \
|
||||
typedef laminar<Transport##BaseModel> Laminar##Transport##BaseModel; \
|
||||
typedef laminarModel<Transport##BaseModel> \
|
||||
laminar##Transport##BaseModel; \
|
||||
typedef RASModel<EddyDiffusivity<Transport##BaseModel>> \
|
||||
RAS##Transport##BaseModel; \
|
||||
typedef LESModel<EddyDiffusivity<Transport##BaseModel>> \
|
||||
@ -65,14 +66,18 @@ License
|
||||
Transport##BaseModel; \
|
||||
\
|
||||
\
|
||||
typedef laminar<Transport##BaseModel> Laminar##Transport##BaseModel; \
|
||||
typedef laminarModel<Transport##BaseModel> \
|
||||
laminar##Transport##BaseModel; \
|
||||
\
|
||||
defineNamedTemplateTypeNameAndDebug(Laminar##Transport##BaseModel, 0); \
|
||||
defineNamedTemplateTypeNameAndDebug(laminar##Transport##BaseModel, 0); \
|
||||
\
|
||||
defineTemplateRunTimeSelectionTable \
|
||||
(laminar##Transport##BaseModel, dictionary); \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
Transport##baseModel, \
|
||||
Laminar##Transport##BaseModel, \
|
||||
laminar##Transport##BaseModel, \
|
||||
dictionary \
|
||||
); \
|
||||
\
|
||||
@ -110,6 +115,27 @@ License
|
||||
}
|
||||
|
||||
|
||||
#define makeTemplatedLaminarModel(BaseModel, SType, Type) \
|
||||
typedef Foam::SType##Models::Type<Foam::BaseModel> \
|
||||
Type##SType##BaseModel; \
|
||||
defineNamedTemplateTypeNameAndDebug(Type##SType##BaseModel, 0); \
|
||||
\
|
||||
namespace Foam \
|
||||
{ \
|
||||
namespace SType##Models \
|
||||
{ \
|
||||
typedef Type<BaseModel> Type##SType##BaseModel; \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
SType##BaseModel, \
|
||||
Type##SType##BaseModel, \
|
||||
dictionary \
|
||||
); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define makeTemplatedTurbulenceModel(BaseModel, SType, Type) \
|
||||
typedef Foam::SType##Models::Type<Foam::EddyDiffusivity<Foam::BaseModel>> \
|
||||
Type##SType##BaseModel; \
|
||||
|
||||
@ -46,6 +46,7 @@ SourceFiles
|
||||
#include "CompressibleTurbulenceModel.H"
|
||||
#include "ThermalDiffusivity.H"
|
||||
#include "EddyDiffusivity.H"
|
||||
#include "laminarModel.H"
|
||||
#include "RASModel.H"
|
||||
#include "LESModel.H"
|
||||
#include "fluidThermo.H"
|
||||
@ -59,6 +60,7 @@ namespace Foam
|
||||
typedef ThermalDiffusivity<CompressibleTurbulenceModel<fluidThermo>>
|
||||
turbulenceModel;
|
||||
|
||||
typedef laminarModel<turbulenceModel> laminarModel;
|
||||
typedef RASModel<EddyDiffusivity<turbulenceModel>> RASModel;
|
||||
typedef LESModel<EddyDiffusivity<turbulenceModel>> LESModel;
|
||||
|
||||
|
||||
@ -37,6 +37,15 @@ makeBaseTurbulenceModel
|
||||
fluidThermo
|
||||
);
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// Laminar models
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
#include "Stokes.H"
|
||||
makeLaminarModel(Stokes);
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// RAS models
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
@ -32,7 +32,7 @@ License
|
||||
#include "ThermalDiffusivity.H"
|
||||
#include "EddyDiffusivity.H"
|
||||
|
||||
#include "laminar.H"
|
||||
#include "laminarModel.H"
|
||||
#include "RASModel.H"
|
||||
#include "LESModel.H"
|
||||
|
||||
@ -48,6 +48,10 @@ makeTurbulenceModelTypes
|
||||
fluidThermo
|
||||
);
|
||||
|
||||
#define makeLaminarModel(Type) \
|
||||
makeTemplatedLaminarModel \
|
||||
(fluidThermoCompressibleTurbulenceModel, laminar, Type)
|
||||
|
||||
#define makeRASModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(fluidThermoCompressibleTurbulenceModel, RAS, Type)
|
||||
|
||||
@ -44,6 +44,7 @@ SourceFiles
|
||||
#define turbulentTransportModel_H
|
||||
|
||||
#include "IncompressibleTurbulenceModel.H"
|
||||
#include "laminarModel.H"
|
||||
#include "RASModel.H"
|
||||
#include "LESModel.H"
|
||||
#include "incompressible/transportModel/transportModel.H"
|
||||
@ -56,6 +57,7 @@ namespace Foam
|
||||
{
|
||||
typedef IncompressibleTurbulenceModel<transportModel> turbulenceModel;
|
||||
|
||||
typedef laminarModel<turbulenceModel> laminarModel;
|
||||
typedef RASModel<turbulenceModel> RASModel;
|
||||
typedef LESModel<turbulenceModel> LESModel;
|
||||
|
||||
|
||||
@ -36,6 +36,15 @@ makeBaseTurbulenceModel
|
||||
transportModel
|
||||
);
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// Laminar models
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
#include "Stokes.H"
|
||||
makeLaminarModel(Stokes);
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
// RAS models
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
@ -28,7 +28,7 @@ License
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "makeTurbulenceModel.H"
|
||||
|
||||
#include "laminar.H"
|
||||
#include "laminarModel.H"
|
||||
#include "RASModel.H"
|
||||
#include "LESModel.H"
|
||||
|
||||
@ -43,6 +43,10 @@ makeTurbulenceModelTypes
|
||||
transportModel
|
||||
);
|
||||
|
||||
#define makeLaminarModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(transportModelIncompressibleTurbulenceModel, laminar, Type)
|
||||
|
||||
#define makeRASModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(transportModelIncompressibleTurbulenceModel, RAS, Type)
|
||||
|
||||
@ -23,17 +23,24 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "laminar.H"
|
||||
#include "Stokes.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "fvcGrad.H"
|
||||
#include "fvcDiv.H"
|
||||
#include "fvmLaplacian.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace laminarModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::laminar<BasicTurbulenceModel>::laminar
|
||||
Stokes<BasicTurbulenceModel>::Stokes
|
||||
(
|
||||
const alphaField& alpha,
|
||||
const rhoField& rho,
|
||||
@ -44,7 +51,7 @@ Foam::laminar<BasicTurbulenceModel>::laminar
|
||||
const word& propertiesName
|
||||
)
|
||||
:
|
||||
linearViscousStress<BasicTurbulenceModel>
|
||||
linearViscousStress<laminarModel<BasicTurbulenceModel>>
|
||||
(
|
||||
typeName,
|
||||
alpha,
|
||||
@ -58,57 +65,26 @@ Foam::laminar<BasicTurbulenceModel>::laminar
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::autoPtr<Foam::laminar<BasicTurbulenceModel>>
|
||||
Foam::laminar<BasicTurbulenceModel>::New
|
||||
(
|
||||
const alphaField& alpha,
|
||||
const rhoField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaRhoPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& transport,
|
||||
const word& propertiesName
|
||||
)
|
||||
{
|
||||
return autoPtr<laminar>
|
||||
(
|
||||
new laminar
|
||||
(
|
||||
alpha,
|
||||
rho,
|
||||
U,
|
||||
alphaRhoPhi,
|
||||
phi,
|
||||
transport,
|
||||
propertiesName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
const Foam::dictionary&
|
||||
Foam::laminar<BasicTurbulenceModel>::coeffDict() const
|
||||
const dictionary&
|
||||
Stokes<BasicTurbulenceModel>::coeffDict() const
|
||||
{
|
||||
return dictionary::null;
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
bool Foam::laminar<BasicTurbulenceModel>::read()
|
||||
bool Stokes<BasicTurbulenceModel>::read()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::laminar<BasicTurbulenceModel>::nut() const
|
||||
tmp<volScalarField>
|
||||
Stokes<BasicTurbulenceModel>::nut() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
@ -131,8 +107,8 @@ Foam::laminar<BasicTurbulenceModel>::nut() const
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::laminar<BasicTurbulenceModel>::nut
|
||||
tmp<scalarField>
|
||||
Stokes<BasicTurbulenceModel>::nut
|
||||
(
|
||||
const label patchi
|
||||
) const
|
||||
@ -145,8 +121,8 @@ Foam::laminar<BasicTurbulenceModel>::nut
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::laminar<BasicTurbulenceModel>::nuEff() const
|
||||
tmp<volScalarField>
|
||||
Stokes<BasicTurbulenceModel>::nuEff() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
@ -159,8 +135,8 @@ Foam::laminar<BasicTurbulenceModel>::nuEff() const
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::laminar<BasicTurbulenceModel>::nuEff
|
||||
tmp<scalarField>
|
||||
Stokes<BasicTurbulenceModel>::nuEff
|
||||
(
|
||||
const label patchi
|
||||
) const
|
||||
@ -170,8 +146,8 @@ Foam::laminar<BasicTurbulenceModel>::nuEff
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::laminar<BasicTurbulenceModel>::k() const
|
||||
tmp<volScalarField>
|
||||
Stokes<BasicTurbulenceModel>::k() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
@ -194,8 +170,8 @@ Foam::laminar<BasicTurbulenceModel>::k() const
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::laminar<BasicTurbulenceModel>::epsilon() const
|
||||
tmp<volScalarField>
|
||||
Stokes<BasicTurbulenceModel>::epsilon() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
@ -221,8 +197,8 @@ Foam::laminar<BasicTurbulenceModel>::epsilon() const
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::volSymmTensorField>
|
||||
Foam::laminar<BasicTurbulenceModel>::R() const
|
||||
tmp<volSymmTensorField>
|
||||
Stokes<BasicTurbulenceModel>::R() const
|
||||
{
|
||||
return tmp<volSymmTensorField>
|
||||
(
|
||||
@ -248,10 +224,15 @@ Foam::laminar<BasicTurbulenceModel>::R() const
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
void Foam::laminar<BasicTurbulenceModel>::correct()
|
||||
void Stokes<BasicTurbulenceModel>::correct()
|
||||
{
|
||||
BasicTurbulenceModel::correct();
|
||||
laminarModel<BasicTurbulenceModel>::correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace laminarModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -22,34 +22,37 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::laminar
|
||||
Foam::Stokes
|
||||
|
||||
Description
|
||||
Turbulence model for laminar flow.
|
||||
Turbulence model for Stokes flow.
|
||||
|
||||
SourceFiles
|
||||
laminar.C
|
||||
Stokes.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef laminar_H
|
||||
#define laminar_H
|
||||
#ifndef Stokes_H
|
||||
#define Stokes_H
|
||||
|
||||
#include "laminarModel.H"
|
||||
#include "linearViscousStress.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace laminarModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------* \
|
||||
Class laminar Declaration
|
||||
Class Stokes Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
class laminar
|
||||
class Stokes
|
||||
:
|
||||
public linearViscousStress<BasicTurbulenceModel>
|
||||
public linearViscousStress<laminarModel<BasicTurbulenceModel>>
|
||||
{
|
||||
|
||||
public:
|
||||
@ -60,13 +63,13 @@ public:
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("laminar");
|
||||
TypeName("Stokes");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
laminar
|
||||
Stokes
|
||||
(
|
||||
const alphaField& alpha,
|
||||
const rhoField& rho,
|
||||
@ -81,7 +84,7 @@ public:
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected turbulence model
|
||||
static autoPtr<laminar> New
|
||||
static autoPtr<Stokes> New
|
||||
(
|
||||
const alphaField& alpha,
|
||||
const rhoField& rho,
|
||||
@ -94,7 +97,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~laminar()
|
||||
virtual ~Stokes()
|
||||
{}
|
||||
|
||||
|
||||
@ -106,41 +109,42 @@ public:
|
||||
//- Read turbulenceProperties dictionary
|
||||
virtual bool read();
|
||||
|
||||
//- Return the turbulence viscosity, i.e. 0 for laminar flow
|
||||
//- Return the turbulence viscosity, i.e. 0 for Stokes flow
|
||||
virtual tmp<volScalarField> nut() const;
|
||||
|
||||
//- Return the turbulence viscosity on patch
|
||||
virtual tmp<scalarField> nut(const label patchi) const;
|
||||
|
||||
//- Return the effective viscosity, i.e. the laminar viscosity
|
||||
//- Return the effective viscosity, i.e. the Stokes viscosity
|
||||
virtual tmp<volScalarField> nuEff() const;
|
||||
|
||||
//- Return the effective viscosity on patch
|
||||
virtual tmp<scalarField> nuEff(const label patchi) const;
|
||||
|
||||
//- Return the turbulence kinetic energy, i.e. 0 for laminar flow
|
||||
//- Return the turbulence kinetic energy, i.e. 0 for Stokes flow
|
||||
virtual tmp<volScalarField> k() const;
|
||||
|
||||
//- Return the turbulence kinetic energy dissipation rate,
|
||||
// i.e. 0 for laminar flow
|
||||
// i.e. 0 for Stokes flow
|
||||
virtual tmp<volScalarField> epsilon() const;
|
||||
|
||||
//- Return the Reynolds stress tensor, i.e. 0 for laminar flow
|
||||
//- Return the Reynolds stress tensor, i.e. 0 for Stokes flow
|
||||
virtual tmp<volSymmTensorField> R() const;
|
||||
|
||||
//- Correct the laminar viscosity
|
||||
//- Correct the Stokes viscosity
|
||||
virtual void correct();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace laminarModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "laminar.C"
|
||||
#include "Stokes.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -0,0 +1,339 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "laminarModel.H"
|
||||
#include "Stokes.H"
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
void Foam::laminarModel<BasicTurbulenceModel>::printCoeffs(const word& type)
|
||||
{
|
||||
if (printCoeffs_)
|
||||
{
|
||||
Info<< type << "Coeffs" << coeffDict_ << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::laminarModel<BasicTurbulenceModel>::laminarModel
|
||||
(
|
||||
const word& type,
|
||||
const alphaField& alpha,
|
||||
const rhoField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaRhoPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& transport,
|
||||
const word& propertiesName
|
||||
)
|
||||
:
|
||||
BasicTurbulenceModel
|
||||
(
|
||||
type,
|
||||
alpha,
|
||||
rho,
|
||||
U,
|
||||
alphaRhoPhi,
|
||||
phi,
|
||||
transport,
|
||||
propertiesName
|
||||
),
|
||||
|
||||
laminarDict_(this->subOrEmptyDict("laminar")),
|
||||
printCoeffs_(laminarDict_.lookupOrDefault<Switch>("printCoeffs", false)),
|
||||
coeffDict_(laminarDict_.subOrEmptyDict(type + "Coeffs"))
|
||||
{
|
||||
// Force the construction of the mesh deltaCoeffs which may be needed
|
||||
// for the construction of the derived models and BCs
|
||||
this->mesh_.deltaCoeffs();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::autoPtr<Foam::laminarModel<BasicTurbulenceModel>>
|
||||
Foam::laminarModel<BasicTurbulenceModel>::New
|
||||
(
|
||||
const alphaField& alpha,
|
||||
const rhoField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaRhoPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& transport,
|
||||
const word& propertiesName
|
||||
)
|
||||
{
|
||||
IOdictionary modelDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName(propertiesName, U.group()),
|
||||
U.time().constant(),
|
||||
U.db(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
if (modelDict.found("laminar"))
|
||||
{
|
||||
// get model name, but do not register the dictionary
|
||||
// otherwise it is registered in the database twice
|
||||
const word modelType
|
||||
(
|
||||
modelDict.subDict("laminar").lookup("laminarModel")
|
||||
);
|
||||
|
||||
Info<< "Selecting laminar stress model " << modelType << endl;
|
||||
|
||||
typename dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown laminarModel type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid laminarModel types:" << endl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<laminarModel>
|
||||
(
|
||||
cstrIter()
|
||||
(
|
||||
alpha,
|
||||
rho,
|
||||
U,
|
||||
alphaRhoPhi,
|
||||
phi,
|
||||
transport, propertiesName)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Selecting laminar stress model "
|
||||
<< laminarModels::Stokes<BasicTurbulenceModel>::typeName << endl;
|
||||
|
||||
return autoPtr<laminarModel>
|
||||
(
|
||||
new laminarModels::Stokes<BasicTurbulenceModel>
|
||||
(
|
||||
alpha,
|
||||
rho,
|
||||
U,
|
||||
alphaRhoPhi,
|
||||
phi,
|
||||
transport,
|
||||
propertiesName
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
bool Foam::laminarModel<BasicTurbulenceModel>::read()
|
||||
{
|
||||
if (BasicTurbulenceModel::read())
|
||||
{
|
||||
laminarDict_ <<= this->subDict("laminar");
|
||||
|
||||
if
|
||||
(
|
||||
const dictionary* dictPtr =
|
||||
laminarDict_.subDictPtr(type() + "Coeffs")
|
||||
)
|
||||
{
|
||||
coeffDict_ <<= *dictPtr;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::laminarModel<BasicTurbulenceModel>::nut() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("nut", this->U_.group()),
|
||||
this->runTime_.timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedScalar("nut", dimViscosity, 0.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::laminarModel<BasicTurbulenceModel>::nut
|
||||
(
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
return tmp<scalarField>
|
||||
(
|
||||
new scalarField(this->mesh_.boundary()[patchi].size(), 0.0)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::laminarModel<BasicTurbulenceModel>::nuEff() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject::groupName("nuEff", this->U_.group()), this->nu()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::laminarModel<BasicTurbulenceModel>::nuEff
|
||||
(
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
return this->nu(patchi);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::laminarModel<BasicTurbulenceModel>::k() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("k", this->U_.group()),
|
||||
this->runTime_.timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedScalar("k", sqr(this->U_.dimensions()), 0.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::laminarModel<BasicTurbulenceModel>::epsilon() const
|
||||
{
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("epsilon", this->U_.group()),
|
||||
this->runTime_.timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedScalar
|
||||
(
|
||||
"epsilon", sqr(this->U_.dimensions())/dimTime, 0.0
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
Foam::tmp<Foam::volSymmTensorField>
|
||||
Foam::laminarModel<BasicTurbulenceModel>::R() const
|
||||
{
|
||||
return tmp<volSymmTensorField>
|
||||
(
|
||||
new volSymmTensorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("R", this->U_.group()),
|
||||
this->runTime_.timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedSymmTensor
|
||||
(
|
||||
"R", sqr(this->U_.dimensions()), Zero
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
void Foam::laminarModel<BasicTurbulenceModel>::correct()
|
||||
{
|
||||
BasicTurbulenceModel::correct();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,208 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::laminarModel
|
||||
|
||||
Description
|
||||
Templated abstract base class for laminar transport models
|
||||
|
||||
SourceFiles
|
||||
laminarModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef laminarModel_H
|
||||
#define laminarModel_H
|
||||
|
||||
#include "TurbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class laminarModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class BasicTurbulenceModel>
|
||||
class laminarModel
|
||||
:
|
||||
public BasicTurbulenceModel
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- laminar coefficients dictionary
|
||||
dictionary laminarDict_;
|
||||
|
||||
//- Flag to print the model coeffs at run-time
|
||||
Switch printCoeffs_;
|
||||
|
||||
//- Model coefficients dictionary
|
||||
dictionary coeffDict_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Print model coefficients
|
||||
virtual void printCoeffs(const word& type);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
laminarModel(const laminarModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const laminarModel&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
typedef typename BasicTurbulenceModel::alphaField alphaField;
|
||||
typedef typename BasicTurbulenceModel::rhoField rhoField;
|
||||
typedef typename BasicTurbulenceModel::transportModel transportModel;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("laminar");
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
laminarModel,
|
||||
dictionary,
|
||||
(
|
||||
const alphaField& alpha,
|
||||
const rhoField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaRhoPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& transport,
|
||||
const word& propertiesName
|
||||
),
|
||||
(alpha, rho, U, alphaRhoPhi, phi, transport, propertiesName)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
laminarModel
|
||||
(
|
||||
const word& type,
|
||||
const alphaField& alpha,
|
||||
const rhoField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaRhoPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& transport,
|
||||
const word& propertiesName
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected laminar model
|
||||
static autoPtr<laminarModel> New
|
||||
(
|
||||
const alphaField& alpha,
|
||||
const rhoField& rho,
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& alphaRhoPhi,
|
||||
const surfaceScalarField& phi,
|
||||
const transportModel& transport,
|
||||
const word& propertiesName = turbulenceModel::propertiesName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~laminarModel()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read model coefficients if they have changed
|
||||
virtual bool read();
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
//- Const access to the coefficients dictionary
|
||||
virtual const dictionary& coeffDict() const
|
||||
{
|
||||
return coeffDict_;
|
||||
}
|
||||
|
||||
//- Return the turbulence viscosity, i.e. 0 for laminar flow
|
||||
virtual tmp<volScalarField> nut() const;
|
||||
|
||||
//- Return the turbulence viscosity on patch
|
||||
virtual tmp<scalarField> nut(const label patchi) const;
|
||||
|
||||
//- Return the effective viscosity, i.e. the laminar viscosity
|
||||
virtual tmp<volScalarField> nuEff() const;
|
||||
|
||||
//- Return the effective viscosity on patch
|
||||
virtual tmp<scalarField> nuEff(const label patchi) 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;
|
||||
|
||||
//- Correct the laminar transport
|
||||
virtual void correct();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "laminarModel.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,32 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
\defgroup grpLaminar laminar transport model
|
||||
@{
|
||||
\ingroup grpTurbulence
|
||||
This group contains laminar models.
|
||||
@}
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -28,7 +28,8 @@ License
|
||||
namespace Foam \
|
||||
{ \
|
||||
typedef BaseModel<Transport> Transport##BaseModel; \
|
||||
typedef laminar<Transport##BaseModel> Laminar##Transport##BaseModel; \
|
||||
typedef laminarModel<Transport##BaseModel> \
|
||||
laminar##Transport##BaseModel; \
|
||||
typedef RASModel<Transport##BaseModel> RAS##Transport##BaseModel; \
|
||||
typedef LESModel<Transport##BaseModel> LES##Transport##BaseModel; \
|
||||
}
|
||||
@ -53,12 +54,15 @@ License
|
||||
); \
|
||||
\
|
||||
\
|
||||
defineNamedTemplateTypeNameAndDebug(Laminar##Transport##BaseModel, 0); \
|
||||
defineNamedTemplateTypeNameAndDebug(laminar##Transport##BaseModel, 0); \
|
||||
\
|
||||
defineTemplateRunTimeSelectionTable \
|
||||
(laminar##Transport##BaseModel, dictionary); \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
Transport##baseModel, \
|
||||
Laminar##Transport##BaseModel, \
|
||||
laminar##Transport##BaseModel, \
|
||||
dictionary \
|
||||
); \
|
||||
\
|
||||
|
||||
Reference in New Issue
Block a user