Commit 6b074985 authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: improve separation of turbulence models macros (define vs make)

parent 65d9cd50
...@@ -36,7 +36,7 @@ License ...@@ -36,7 +36,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeTurbulenceModelTypes defineTurbulenceModelTypes
( (
volScalarField, volScalarField,
geometricOneField, geometricOneField,
......
...@@ -33,7 +33,9 @@ License ...@@ -33,7 +33,9 @@ License
#include "turbulentTransportModel.H" #include "turbulentTransportModel.H"
#include "LESModel.H" #include "LESModel.H"
makeTurbulenceModelTypes // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTurbulenceModelTypes
( (
volScalarField, volScalarField,
geometricOneField, geometricOneField,
......
...@@ -39,7 +39,7 @@ License ...@@ -39,7 +39,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeTurbulenceModelTypes defineTurbulenceModelTypes
( (
volScalarField, volScalarField,
volScalarField, volScalarField,
...@@ -71,22 +71,38 @@ makeBaseTurbulenceModel ...@@ -71,22 +71,38 @@ makeBaseTurbulenceModel
makeTemplatedTurbulenceModel \ makeTemplatedTurbulenceModel \
(fluidThermoPhaseCompressibleTurbulenceModel, LES, Type) (fluidThermoPhaseCompressibleTurbulenceModel, LES, Type)
// -------------------------------------------------------------------------- //
// Laminar models
// -------------------------------------------------------------------------- //
#include "Stokes.H" #include "Stokes.H"
makeLaminarModel(Stokes); makeLaminarModel(Stokes);
#include "Maxwell.H" #include "Maxwell.H"
makeLaminarModel(Maxwell); makeLaminarModel(Maxwell);
// -------------------------------------------------------------------------- //
// RAS models
// -------------------------------------------------------------------------- //
#include "kEpsilon.H" #include "kEpsilon.H"
makeRASModel(kEpsilon); makeRASModel(kEpsilon);
#include "kOmegaSST.H" #include "kOmegaSST.H"
makeRASModel(kOmegaSST); makeRASModel(kOmegaSST);
// -------------------------------------------------------------------------- //
// LES models
// -------------------------------------------------------------------------- //
#include "Smagorinsky.H" #include "Smagorinsky.H"
makeLESModel(Smagorinsky); makeLESModel(Smagorinsky);
#include "kEqn.H" #include "kEqn.H"
makeLESModel(kEqn); makeLESModel(kEqn);
// ************************************************************************* // // ************************************************************************* //
...@@ -36,7 +36,7 @@ License ...@@ -36,7 +36,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeTurbulenceModelTypes defineTurbulenceModelTypes
( (
geometricOneField, geometricOneField,
volScalarField, volScalarField,
...@@ -78,15 +78,29 @@ makeBaseTurbulenceModel ...@@ -78,15 +78,29 @@ makeBaseTurbulenceModel
Type \ Type \
) )
// -------------------------------------------------------------------------- //
// Laminar models
// -------------------------------------------------------------------------- //
#include "Stokes.H" #include "Stokes.H"
makeLaminarModel(Stokes); makeLaminarModel(Stokes);
// -------------------------------------------------------------------------- //
// RAS models
// -------------------------------------------------------------------------- //
#include "kEpsilon.H" #include "kEpsilon.H"
makeRASModel(kEpsilon); makeRASModel(kEpsilon);
#include "buoyantKEpsilon.H" #include "buoyantKEpsilon.H"
makeRASModel(buoyantKEpsilon); makeRASModel(buoyantKEpsilon);
// -------------------------------------------------------------------------- //
// LES models
// -------------------------------------------------------------------------- //
#include "Smagorinsky.H" #include "Smagorinsky.H"
makeLESModel(Smagorinsky); makeLESModel(Smagorinsky);
......
...@@ -37,6 +37,18 @@ License ...@@ -37,6 +37,18 @@ License
#include "RASModel.H" #include "RASModel.H"
#include "LESModel.H" #include "LESModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTurbulenceModelTypes
(
geometricOneField,
volScalarField,
compressibleTurbulenceModel,
CompressibleTurbulenceModel,
ThermalDiffusivity,
multiphaseSystem
);
makeBaseTurbulenceModel makeBaseTurbulenceModel
( (
geometricOneField, geometricOneField,
...@@ -59,16 +71,32 @@ makeBaseTurbulenceModel ...@@ -59,16 +71,32 @@ makeBaseTurbulenceModel
makeTemplatedTurbulenceModel \ makeTemplatedTurbulenceModel \
(multiphaseSystemCompressibleTurbulenceModel, LES, Type) (multiphaseSystemCompressibleTurbulenceModel, LES, Type)
// -------------------------------------------------------------------------- //
// Laminar models
// -------------------------------------------------------------------------- //
#include "Stokes.H" #include "Stokes.H"
makeLaminarModel(Stokes); makeLaminarModel(Stokes);
// -------------------------------------------------------------------------- //
// RAS models
// -------------------------------------------------------------------------- //
#include "kEpsilon.H" #include "kEpsilon.H"
makeRASModel(kEpsilon); makeRASModel(kEpsilon);
// -------------------------------------------------------------------------- //
// LES models
// -------------------------------------------------------------------------- //
#include "Smagorinsky.H" #include "Smagorinsky.H"
makeLESModel(Smagorinsky); makeLESModel(Smagorinsky);
#include "kEqn.H" #include "kEqn.H"
makeLESModel(kEqn); makeLESModel(kEqn);
// ************************************************************************* // // ************************************************************************* //
...@@ -40,7 +40,7 @@ License ...@@ -40,7 +40,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeTurbulenceModelTypes defineTurbulenceModelTypes
( (
volScalarField, volScalarField,
volScalarField, volScalarField,
...@@ -72,9 +72,19 @@ makeBaseTurbulenceModel ...@@ -72,9 +72,19 @@ makeBaseTurbulenceModel
makeTemplatedTurbulenceModel \ makeTemplatedTurbulenceModel \
(phaseModelPhaseCompressibleTurbulenceModel, LES, Type) (phaseModelPhaseCompressibleTurbulenceModel, LES, Type)
// -------------------------------------------------------------------------- //
// Laminar models
// -------------------------------------------------------------------------- //
#include "Stokes.H" #include "Stokes.H"
makeLaminarModel(Stokes); makeLaminarModel(Stokes);
// -------------------------------------------------------------------------- //
// RAS models
// -------------------------------------------------------------------------- //
#include "kEpsilon.H" #include "kEpsilon.H"
makeRASModel(kEpsilon); makeRASModel(kEpsilon);
...@@ -93,6 +103,11 @@ makeRASModel(LaheyKEpsilon); ...@@ -93,6 +103,11 @@ makeRASModel(LaheyKEpsilon);
#include "continuousGasKEpsilon.H" #include "continuousGasKEpsilon.H"
makeRASModel(continuousGasKEpsilon); makeRASModel(continuousGasKEpsilon);
// -------------------------------------------------------------------------- //
// LES models
// -------------------------------------------------------------------------- //
#include "Smagorinsky.H" #include "Smagorinsky.H"
makeLESModel(Smagorinsky); makeLESModel(Smagorinsky);
...@@ -108,6 +123,11 @@ makeLESModel(NicenoKEqn); ...@@ -108,6 +123,11 @@ makeLESModel(NicenoKEqn);
#include "continuousGasKEqn.H" #include "continuousGasKEqn.H"
makeLESModel(continuousGasKEqn); makeLESModel(continuousGasKEqn);
// -------------------------------------------------------------------------- //
// Additional models
// -------------------------------------------------------------------------- //
#include "kineticTheoryModel.H" #include "kineticTheoryModel.H"
makeTurbulenceModel makeTurbulenceModel
(phaseModelPhaseCompressibleTurbulenceModel, RAS, kineticTheoryModel); (phaseModelPhaseCompressibleTurbulenceModel, RAS, kineticTheoryModel);
...@@ -116,4 +136,5 @@ makeTurbulenceModel ...@@ -116,4 +136,5 @@ makeTurbulenceModel
makeTurbulenceModel makeTurbulenceModel
(phaseModelPhaseCompressibleTurbulenceModel, RAS, phasePressureModel); (phaseModelPhaseCompressibleTurbulenceModel, RAS, phasePressureModel);
// ************************************************************************* // // ************************************************************************* //
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015-2016 OpenFOAM Foundation Copyright (C) 2015-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
...@@ -29,48 +30,52 @@ License ...@@ -29,48 +30,52 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeTurbulenceModelTypes( \ //- Define turbulence model typedefs, with EddyDiffusivity
#define defineTurbulenceModelTypes( \
Alpha, Rho, baseModel, BaseModel, TDModel, Transport) \ Alpha, Rho, baseModel, BaseModel, TDModel, Transport) \
\ \
namespace Foam \ namespace Foam \
{ \ { \
typedef TurbulenceModel \
< \
Alpha, \
Rho, \
baseModel, \
Transport \
> Transport##baseModel; \
\
typedef TDModel<BaseModel<Transport>> \ typedef TDModel<BaseModel<Transport>> \
Transport##BaseModel; \ Transport##BaseModel; \
\
typedef laminarModel<Transport##BaseModel> \ typedef laminarModel<Transport##BaseModel> \
laminar##Transport##BaseModel; \ laminar##Transport##BaseModel; \
\
typedef RASModel<EddyDiffusivity<Transport##BaseModel>> \ typedef RASModel<EddyDiffusivity<Transport##BaseModel>> \
RAS##Transport##BaseModel; \ RAS##Transport##BaseModel; \
\
typedef LESModel<EddyDiffusivity<Transport##BaseModel>> \ typedef LESModel<EddyDiffusivity<Transport##BaseModel>> \
LES##Transport##BaseModel; \ LES##Transport##BaseModel; \
} }
// Legacy name
#define makeTurbulenceModelTypes(a, b, c, d, e, f) \
defineTurbulenceModelTypes(a, b, c, d, e, f)
#define makeBaseTurbulenceModel( \ #define makeBaseTurbulenceModel( \
Alpha, Rho, baseModel, BaseModel, TDModel, Transport) \ Alpha, Rho, baseModel, BaseModel, TDModel, Transport) \
\ \
/* Uses previously defined typedefs */ \
namespace Foam \ namespace Foam \
{ \ { \
typedef TurbulenceModel \ /* Turbulence selection table */ \
< \
Alpha, \
Rho, \
baseModel, \
Transport \
> Transport##baseModel; \
\
defineTemplateRunTimeSelectionTable \ defineTemplateRunTimeSelectionTable \
( \ ( \
Transport##baseModel, \ Transport##baseModel, \
dictionary \ dictionary \
); \ ); \
\ \
typedef TDModel<BaseModel<Transport>> \ /* Laminar models */ \
Transport##BaseModel; \
\
\
typedef laminarModel<Transport##BaseModel> \
laminar##Transport##BaseModel; \
\
defineNamedTemplateTypeNameAndDebug(laminar##Transport##BaseModel, 0); \ defineNamedTemplateTypeNameAndDebug(laminar##Transport##BaseModel, 0); \
\ \
defineTemplateRunTimeSelectionTable \ defineTemplateRunTimeSelectionTable \
...@@ -83,10 +88,7 @@ License ...@@ -83,10 +88,7 @@ License
dictionary \ dictionary \
); \ ); \
\ \
\ /* RAS models */ \
typedef RASModel<EddyDiffusivity<Transport##BaseModel>> \
RAS##Transport##BaseModel; \
\
defineNamedTemplateTypeNameAndDebug(RAS##Transport##BaseModel, 0); \ defineNamedTemplateTypeNameAndDebug(RAS##Transport##BaseModel, 0); \
\ \
defineTemplateRunTimeSelectionTable \ defineTemplateRunTimeSelectionTable \
...@@ -100,9 +102,7 @@ License ...@@ -100,9 +102,7 @@ License
); \ ); \
\ \
\ \
typedef LESModel<EddyDiffusivity<Transport##BaseModel>> \ /* LES model types */ \
LES##Transport##BaseModel; \
\
defineNamedTemplateTypeNameAndDebug(LES##Transport##BaseModel, 0); \ defineNamedTemplateTypeNameAndDebug(LES##Transport##BaseModel, 0); \
\ \
defineTemplateRunTimeSelectionTable \ defineTemplateRunTimeSelectionTable \
...@@ -139,7 +139,7 @@ License ...@@ -139,7 +139,7 @@ License
#define makeTemplatedTurbulenceModel(BaseModel, SType, Type) \ #define makeTemplatedTurbulenceModel(BaseModel, SType, Type) \
typedef Foam::SType##Models::Type<Foam::EddyDiffusivity<Foam::BaseModel>> \ typedef Foam::SType##Models::Type<Foam::EddyDiffusivity<Foam::BaseModel>> \
Type##SType##BaseModel; \ Type##SType##BaseModel; \
defineNamedTemplateTypeNameAndDebug(Type##SType##BaseModel, 0); \ defineNamedTemplateTypeNameAndDebug(Type##SType##BaseModel, 0); \
\ \
......
...@@ -29,6 +29,16 @@ License ...@@ -29,6 +29,16 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTurbulenceModelTypes
(
geometricOneField,
volScalarField,
compressibleTurbulenceModel,
CompressibleTurbulenceModel,
ThermalDiffusivity,
fluidThermo
);
makeBaseTurbulenceModel makeBaseTurbulenceModel
( (
geometricOneField, geometricOneField,
......
...@@ -29,6 +29,15 @@ License ...@@ -29,6 +29,15 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTurbulenceModelTypes
(
geometricOneField,
geometricOneField,
incompressibleTurbulenceModel,
IncompressibleTurbulenceModel,
transportModel
);
makeBaseTurbulenceModel makeBaseTurbulenceModel
( (
geometricOneField, geometricOneField,
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
...@@ -25,37 +26,52 @@ License ...@@ -25,37 +26,52 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#define makeTurbulenceModelTypes(Alpha, Rho, baseModel, BaseModel, Transport) \ //- Define turbulence model typedefs, with EddyDiffusivity
#define defineTurbulenceModelTypes( \
Alpha, Rho, baseModel, BaseModel, Transport) \
\ \
namespace Foam \ namespace Foam \
{ \ { \
typedef BaseModel<Transport> Transport##BaseModel; \ typedef TurbulenceModel \
< \
Alpha, \
Rho, \
baseModel, \
Transport \
> Transport##baseModel; \
\
typedef BaseModel<Transport> \
Transport##BaseModel; \
\
typedef laminarModel<Transport##BaseModel> \ typedef laminarModel<Transport##BaseModel> \
laminar##Transport##BaseModel; \ laminar##Transport##BaseModel; \
typedef RASModel<Transport##BaseModel> RAS##Transport##BaseModel; \ \
typedef LESModel<Transport##BaseModel> LES##Transport##BaseModel; \ typedef RASModel<Transport##BaseModel> \
RAS##Transport##BaseModel; \
\
typedef LESModel<Transport##BaseModel> \
LES##Transport##BaseModel; \
} }
// Legacy name
#define makeTurbulenceModelTypes(a, b, c, d, e) \
defineTurbulenceModelTypes(a, b, c, d, e)
#define makeBaseTurbulenceModel(Alpha, Rho, baseModel, BaseModel, Transport) \ #define makeBaseTurbulenceModel(Alpha, Rho, baseModel, BaseModel, Transport) \
/* Turbulence typedefs */ \
defineTurbulenceModelTypes(Alpha, Rho, baseModel, BaseModel, Transport) \
\ \
namespace Foam \ namespace Foam \
{ \ { \
typedef TurbulenceModel \ /* Turbulence selection table */ \
< \
Alpha, \
Rho, \
baseModel, \
Transport \
> Transport##baseModel; \
\