52 { compressibleField::cfK,
"k" },
53 { compressibleField::cfEpsilon,
"epsilon" },
54 { compressibleField::cfOmega,
"omega" },
55 { compressibleField::cfNuTilda,
"nuTilda" },
56 { compressibleField::cfMut,
"mut" },
57 { compressibleField::cfMuEff,
"muEff" },
58 { compressibleField::cfAlphat,
"alphat" },
59 { compressibleField::cfAlphaEff,
"alphaEff" },
60 { compressibleField::cfR,
"R" },
61 { compressibleField::cfDevRhoReff,
"devRhoReff" },
62 { compressibleField::cfL,
"L" },
63 { compressibleField::cfI,
"I" },
64 { compressibleField::cfLESRegion,
"LESRegion" },
65 { compressibleField::cffd,
"fd" },
75 { incompressibleField::ifK,
"k" },
76 { incompressibleField::ifEpsilon,
"epsilon" },
77 { incompressibleField::ifOmega,
"omega" },
78 { incompressibleField::ifNuTilda,
"nuTilda" },
79 { incompressibleField::ifNut,
"nut" },
80 { incompressibleField::ifNuEff,
"nuEff" },
81 { incompressibleField::ifR,
"R" },
82 { incompressibleField::ifDevReff,
"devReff" },
83 { incompressibleField::ifL,
"L" },
84 { incompressibleField::ifI,
"I" },
85 { incompressibleField::ifLESRegion,
"LESRegion" },
86 { incompressibleField::iffd,
"fd" },
104 if (
obr_.found(localName))
107 <<
"Cannot store turbulence field " << localName
108 <<
" since an object with that name already exists"
131 <<
"Turbulence model not found in database, deactivating"
149 prefix_(
dict.getOrDefault<
word>(
"prefix",
"turbulenceProperties")),
162 dict.readIfPresent(
"prefix", prefix_);
164 if (
dict.found(
"field"))
166 fieldSet_.insert(
dict.get<
word>(
"field"));
174 if (fieldSet_.size())
176 Info<<
"storing fields:" <<
nl;
177 for (
const word&
f : fieldSet_)
185 Info<<
"no fields requested to be stored" <<
nl <<
endl;
211 for (
const word&
f : fieldSet_)
213 switch (compressibleFieldNames_[
f])
217 processField<scalar>(
f, model.k());
222 processField<scalar>(
f, model.epsilon());
227 processField<scalar>(
f, model.omega());
232 processField<scalar>(
f, nuTilda(model));
237 processField<scalar>(
f, model.mut());
242 processField<scalar>(
f, model.muEff());
247 processField<scalar>(
f, model.alphat());
252 processField<scalar>(
f, model.alphaEff());
257 processField<symmTensor>(
f, model.R());
262 processField<symmTensor>(
f, model.devRhoReff());
267 processField<scalar>(
f,
L(model));
272 processField<scalar>(
f,
I(model));
277 auto* DESPtr = mesh_.cfindObject<DESModelBase>(modelName_);
281 <<
"Turbulence model is not a DES model - "
282 <<
"skipping request for LESRegion" <<
endl;
287 processField<scalar>(
f, DESPtr->LESRegion());
292 auto* DESPtr = mesh_.cfindObject<DESModelBase>(modelName_);
296 <<
"Turbulence model is not a DES model - "
297 <<
"skipping request for fd" <<
endl;
302 processField<scalar>(
f, DESPtr->fd());
318 for (
const word&
f : fieldSet_)
320 switch (incompressibleFieldNames_[
f])
324 processField<scalar>(
f, model.k());
329 processField<scalar>(
f, model.epsilon());
334 processField<scalar>(
f, model.omega());
339 processField<scalar>(
f, nuTilda(model));
344 processField<scalar>(
f, model.nut());
349 processField<scalar>(
f, model.nuEff());
354 processField<symmTensor>(
f, model.R());
359 processField<symmTensor>(
f, model.devReff());
364 processField<scalar>(
f,
L(model));
369 processField<scalar>(
f,
I(model));
374 auto* DESPtr = mesh_.cfindObject<DESModelBase>(modelName_);
378 <<
"Turbulence model is not a DES model - "
379 <<
"skipping request for LESRegion" <<
endl;
384 processField<scalar>(
f, DESPtr->LESRegion());
389 auto* DESPtr = mesh_.cfindObject<DESModelBase>(modelName_);
393 <<
"Turbulence model is not a DES model - "
394 <<
"skipping request for fd" <<
endl;
399 processField<scalar>(
f, DESPtr->fd());
417 for (
const word&
f : fieldSet_)
421 writeObject(localName);
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Base class for DES models providing an interfaces to DES fields.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Abstract base-class for Time/database function objects.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const fvMesh & mesh_
Reference to the fvMesh.
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
const objectRegistry & obr_
Reference to the region objectRegistry.
bool writeObject(const word &fieldName)
Write field if present in the (sub) objectRegistry.
Computes various turbulence-related quantities that are not typically output during calculations,...
static const word modelName_
Name of the turbulence properties dictionary.
word prefix_
Name of output-field prefix.
void initialise()
Unset duplicate fields already registered by other function objects.
turbulenceFields(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
bool compressible()
Return true if compressible turbulence model is identified.
bool initialised_
Flag to track initialisation.
tmp< volScalarField > nuTilda(const Model &model) const
Return nuTilda calculated from k and omega.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
static const Enum< incompressibleField > incompressibleFieldNames_
Names for incompressibleField turbulence fields.
compressibleField
Options for the turbulence fields (compressible).
@ cfK
"Turbulent kinetic energy"
@ cfAlphat
"Turbulence thermal diffusivity"
@ cfL
"Integral-length/Mixing-length scale"
@ cfNuTilda
"Modified turbulent viscosity"
@ cfDevRhoReff
"Divergence of the Reynolds stress"
@ cffd
"DES model shielding function"
@ cfLESRegion
"DES model LES region indicator field"
@ cfMuEff
"Effective turbulent dynamic viscosity"
@ cfAlphaEff
"Effective turbulence thermal diffusivity"
@ cfI
"Turbulence intensity"
@ cfOmega
"Specific dissipation rate"
@ cfMut
"Turbulent dynamic viscosity"
@ cfR
"Reynolds stress tensor"
@ cfEpsilon
"Turbulent kinetic energy dissipation rate"
incompressibleField
Options for the turbulence fields (incompressible).
@ ifK
"Turbulent kinetic energy"
@ ifI
"Turbulence intensity"
@ ifEpsilon
"Turbulent kinetic energy dissipation rate"
@ ifNut
"Turbulent viscosity"
@ iffd
"DES model shielding function"
@ ifL
"Integral-length/Mixing-length scale"
@ ifLESRegion
"DES model LES region indicator field"
@ ifNuTilda
"Modified turbulent viscosity"
@ ifR
"Reynolds stress tensor"
@ ifOmega
"Specific dissipation rate"
@ ifDevReff
"Deviatoric part of the effective Reynolds stress"
@ ifNuEff
"Effective turbulent viscosity"
void processField(const word &fieldName, const tmp< GeometricField< Type, fvPatchField, volMesh > > &tvalue)
Process the turbulence field.
wordHashSet fieldSet_
Fields to load.
virtual bool execute()
Execute the function-object operations.
static const Enum< compressibleField > compressibleFieldNames_
Names for compressibleField turbulence fields.
virtual bool write()
Write the function-object results.
static const word propertiesName
Default name of the turbulence properties dictionary.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
ThermalDiffusivity< CompressibleTurbulenceModel< fluidThermo > > turbulenceModel
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
IncompressibleTurbulenceModel< transportModel > turbulenceModel
List< word > wordList
List of word.
bool read(const char *buf, int32_t &val)
Same as readInt32.
messageStream Info
Information stream (stdout output on master, null elsewhere).
static const Identity< scalar > I
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
static bool initialised_(false)
const vector L(dict.get< vector >("L"))