Loading...
Searching...
No Matches
turbulenceFields.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2013-2016 OpenFOAM Foundation
9 Copyright (C) 2015-2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::functionObjects::turbulenceFields
29
30Group
31 grpFieldFunctionObjects
32
33Description
34 Computes various turbulence-related quantities that are not typically
35 output during calculations, and stores/writes them on the mesh database
36 for further manipulation.
37
38 Fields are stored as copies of the original with a user-defined prefix
39 e.g. a prefix of \c turbulenceModel yields the following for field \c R:
40
41 \verbatim
42 turbulenceModel:R
43 \endverbatim
44
45 Operands:
46 \table
47 Operand | Type | Location
48 input | - | -
49 output file | - | -
50 output field | vol<Type>Field | <time>/outputFields
51 \endtable
52
53 where \c Type can be one of: \c Scalar or \c SymmTensor.
54
55 References:
56 \verbatim
57 Estimation expressions for L (tag:P), Eq. 10.37:
58 Pope, S. B. (2000).
59 Turbulent flows.
60 Cambridge, UK: Cambridge Univ. Press
61 DOI:10.1017/CBO9780511840531
62 \endverbatim
63
64Usage
65 Minimal example by using \c system/controlDict.functions:
66 \verbatim
67 turbulenceFieldsFO
68 {
69 // Mandatory entries
70 type turbulenceFields;
71 libs (fieldFunctionObjects);
72
73 // Conditional entries
74
75 // Either of the below
76 // Option-1
77 fields (R devRhoReff);
78
79 // Option-2
80 field R;
81
82 // Optional entries
83 prefix <word>;
84
85 // Inherited entries
86 ...
87 }
88 \endverbatim
89
90 where the entries mean:
91 \table
92 Property | Description | Type | Reqd | Deflt
93 type | Type name: turbulenceFields | word | yes | -
94 libs | Library name: fieldFunctionObjects | word | yes | -
95 fields | Names of fields to store (see below) | wordList | yes | -
96 field | Name of a field to store (see below) | word | yes | -
97 prefix | Name of output-field prefix | word | no | turbulenceProperties
98 \endtable
99
100 where \c fields can include:
101 \verbatim
102 k | turbulent kinetic energy
103 epsilon | turbulent kinetic energy dissipation rate
104 omega | specific dissipation rate
105 nuTilda | modified turbulent viscosity
106 nut | turbulent viscosity (incompressible)
107 nuEff | effective turbulent viscosity (incompressible)
108 mut | turbulent viscosity (compressible)
109 muEff | effective turbulent viscosity (compressible)
110 alphat | turbulence thermal diffusivity (compressible)
111 alphaEff | effective turbulence thermal diffusivity (compressible)
112 R | Reynolds stress tensor
113 devReff | deviatoric part of the effective Reynolds stress
114 devRhoReff | divergence of the Reynolds stress
115 L | integral-length scale / mixing-length scale
116 I | turbulence intensity
117 \endverbatim
118
119 The inherited entries are elaborated in:
120 - \link functionObject.H \endlink
121
122Note
123 - Multiphase applications are not supported.
124 - The governing expression of \c nuTilda is
125 an approximation based on a dimensional analysis.
126
127SourceFiles
128 turbulenceFields.C
129 turbulenceFieldsTemplates.C
130
131\*---------------------------------------------------------------------------*/
132
133#ifndef Foam_functionObjects_turbulenceFields_H
134#define Foam_functionObjects_turbulenceFields_H
135
136#include "fvMeshFunctionObject.H"
137#include "HashSet.H"
138#include "Enum.H"
139#include "volFieldsFwd.H"
140#include "Switch.H"
141
142// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143
144namespace Foam
145{
146namespace functionObjects
147{
148
149/*---------------------------------------------------------------------------*\
150 Class turbulenceFields Declaration
151\*---------------------------------------------------------------------------*/
152
154:
156{
157public:
158
159 // Public Enumerations
160
161 //- Options for the turbulence fields (compressible)
163 {
164 cfK,
165 cfEpsilon,
166 cfOmega,
167 cfNuTilda,
168 cfMut,
169 cfMuEff,
170 cfAlphat,
171 cfAlphaEff,
172 cfR,
174 cfL,
175 cfI,
177 cffd
178 };
179
180 //- Names for compressibleField turbulence fields
181 static const Enum<compressibleField> compressibleFieldNames_;
182
183 //- Options for the turbulence fields (incompressible)
185 {
186 ifK,
187 ifEpsilon,
188 ifOmega,
189 ifNuTilda,
190 ifNut,
191 ifNuEff,
192 ifR,
193 ifDevReff,
194 ifL,
195 ifI,
197 iffd
198 };
199
200 //- Names for incompressibleField turbulence fields
202
203 //- Name of the turbulence properties dictionary
204 static const word modelName_;
205
206
207protected:
208
209 // Protected Data
210
211 //- Flag to track initialisation
212 bool initialised_;
214 //- Name of output-field prefix
217 //- Fields to load
221 // Protected Member Functions
223 //- Unset duplicate fields already registered by other function objects
226 //- Return true if compressible turbulence model is identified
227 bool compressible();
228
229 //- Process the turbulence field
230 template<class Type>
231 void processField
233 const word& fieldName,
235 );
236
237 //- Return nuTilda calculated from k and omega
238 template<class Model>
239 tmp<volScalarField> nuTilda(const Model& model) const;
241 //- Return integral length scale, L, calculated from k and epsilon
242 template<class Model>
243 tmp<volScalarField> L(const Model& model) const;
245 //- Return turbulence intensity, I, calculated from k and U
246 template<class Model>
247 tmp<volScalarField> I(const Model& model) const;
250public:
251
252 //- Runtime type information
253 TypeName("turbulenceFields");
254
255
256 // Constructors
257
258 //- Construct from name, Time and dictionary
260 (
261 const word& name,
262 const Time& runTime,
263 const dictionary& dict
264 );
265
266 //- No copy construct
267 turbulenceFields(const turbulenceFields&) = delete;
268
269 //- No copy assignment
270 void operator=(const turbulenceFields&) = delete;
272
273 //- Destructor
274 virtual ~turbulenceFields() = default;
275
277 // Member Functions
278
279 //- Read the function-object dictionary
280 virtual bool read(const dictionary& dict);
282 //- Execute the function-object operations
283 virtual bool execute();
284
285 //- Write the function-object results
286 // The turbulence fields are registered and written automatically
287 virtual bool write();
288};
289
290
291// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
292
293} // End namespace functionObjects
294} // End namespace Foam
295
296// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
297
298#ifdef NoRepository
300#endif
301
302// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
303
304#endif
305
306// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition Enum.H:57
Generic GeometricField class.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
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.
void operator=(const turbulenceFields &)=delete
No copy assignment.
bool compressible()
Return true if compressible turbulence model is identified.
bool initialised_
Flag to track initialisation.
tmp< volScalarField > I(const Model &model) const
Return turbulence intensity, I, calculated from k and U.
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).
@ 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"
@ cfOmega
"Specific dissipation rate"
@ cfMut
"Turbulent dynamic viscosity"
@ cfEpsilon
"Turbulent kinetic energy dissipation rate"
incompressibleField
Options for the turbulence fields (incompressible).
@ ifEpsilon
"Turbulent kinetic energy dissipation rate"
@ iffd
"DES model shielding function"
@ ifL
"Integral-length/Mixing-length scale"
@ ifLESRegion
"DES model LES region indicator field"
@ ifNuTilda
"Modified turbulent viscosity"
@ 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.
turbulenceFields(const turbulenceFields &)=delete
No copy construct.
TypeName("turbulenceFields")
Runtime type information.
virtual bool execute()
Execute the function-object operations.
tmp< volScalarField > L(const Model &model) const
Return integral length scale, L, calculated from k and epsilon.
virtual ~turbulenceFields()=default
Destructor.
static const Enum< compressibleField > compressibleFieldNames_
Names for compressibleField turbulence fields.
virtual bool write()
Write the function-object results.
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
Definition HashSet.H:80
static const Identity< scalar > I
Definition Identity.H:100
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68
const vector L(dict.get< vector >("L"))
Forwards and collection of common volume field types.