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 | $FOAM_CASE/<time>/<outField>
51 \endtable
52
53 where \c <Type>=Scalar/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 turbulenceFields1
68 {
69 // Mandatory entries (unmodifiable)
70 type turbulenceFields;
71 libs (fieldFunctionObjects);
72
73 // Mandatory entries (runtime modifiable)
74
75 // Either of the below
76 // Option-1
77 fields (R devRhoReff);
78
79 // Option-2
80 field R;
81
82 // Optional entries (runtime modifiable)
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
122 Minimal example by using the \c postProcess utility:
123 \verbatim
124 <solver> -postProcess -func turbulenceFields
125 \endverbatim
126
127Note
128 - Multiphase applications are not supported.
129 - The governing expression of \c nuTilda is
130 an approximation based on a dimensional analysis.
131
132See also
133 - Foam::functionObject
134 - Foam::functionObjects::fvMeshFunctionObject
135 - ExtendedCodeGuide::functionObjects::field::turbulenceFields
136
137SourceFiles
138 turbulenceFields.C
139 turbulenceFieldsTemplates.C
140
141\*---------------------------------------------------------------------------*/
142
143#ifndef functionObjects_turbulenceFields_H
144#define functionObjects_turbulenceFields_H
145
146#include "fvMeshFunctionObject.H"
147#include "HashSet.H"
148#include "Enum.H"
149#include "volFieldsFwd.H"
150#include "Switch.H"
151
152// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153
154namespace Foam
155{
156namespace functionObjects
157{
158
159/*---------------------------------------------------------------------------*\
160 Class turbulenceFields Declaration
161\*---------------------------------------------------------------------------*/
162
163class turbulenceFields
164:
165 public fvMeshFunctionObject
166{
167public:
168
169 // Public Enumerations
170
171 //- Options for the turbulence fields (compressible)
173 {
174 cfK,
175 cfEpsilon,
176 cfOmega,
177 cfNuTilda,
178 cfMut,
179 cfMuEff,
180 cfAlphat,
181 cfAlphaEff,
182 cfR,
184 cfL,
185 cfI
186 };
187
188 //- Names for compressibleField turbulence fields
189 static const Enum<compressibleField> compressibleFieldNames_;
190
191 //- Options for the turbulence fields (incompressible)
193 {
194 ifK,
195 ifEpsilon,
196 ifOmega,
197 ifNuTilda,
198 ifNut,
199 ifNuEff,
200 ifR,
201 ifDevReff,
202 ifL,
203 ifI
204 };
205
206 //- Names for incompressibleField turbulence fields
207 static const Enum<incompressibleField> incompressibleFieldNames_;
208
209 //- Name of the turbulence properties dictionary
210 static const word modelName_;
211
212
213protected:
215 // Protected Data
216
217 //- Flag to track initialisation
218 bool initialised_;
219
220 //- Name of output-field prefix
222
223 //- Fields to load
227 // Protected Member Functions
229 //- Unset duplicate fields already registered by other function objects
232 //- Return true if compressible turbulence model is identified
235 //- Process the turbulence field
236 template<class Type>
238 (
239 const word& fieldName,
241 );
242
243 //- Return nuTilda calculated from k and omega
244 template<class Model>
245 tmp<volScalarField> nuTilda(const Model& model) const;
247 //- Return integral length scale, L, calculated from k and epsilon
248 template<class Model>
249 tmp<volScalarField> L(const Model& model) const;
251 //- Return turbulence intensity, I, calculated from k and U
252 template<class Model>
253 tmp<volScalarField> I(const Model& model) const;
254
256public:
257
258 //- Runtime type information
259 TypeName("turbulenceFields");
260
262 // Constructors
263
264 //- Construct from Time and dictionary
266 (
267 const word& name,
268 const Time& runTime,
270 );
271
272 //- No copy construct
273 turbulenceFields(const turbulenceFields&) = delete;
274
275 //- No copy assignment
276 void operator=(const turbulenceFields&) = delete;
277
278
279 //- Destructor
280 virtual ~turbulenceFields() = default;
281
282
283 // Member Functions
284
285 //- Read the controls
286 virtual bool read(const dictionary&);
287
288 //- Calculate turbulence fields
289 virtual bool execute();
290
291 //- Do nothing.
292 // The turbulence fields are registered and written automatically
293 virtual bool write();
294};
295
297// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
298
299} // End namespace functionObjects
300} // End namespace Foam
301
302// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
303
304#ifdef NoRepository
306#endif
307
308// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
309
310#endif
311
312// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
Generic GeometricField class.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const word & name() const noexcept
Return the name of this functionObject.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
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.
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.
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"
@ 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"
@ ifL
"Integral-length/Mixing-length scale"
@ 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.
wordHashSet fieldSet_
Fields to load.
virtual bool execute()
Calculate turbulence fields.
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 read(const dictionary &)
Read the controls.
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
Namespace for OpenFOAM.
static const Identity< scalar > I
Definition: Identity.H:94
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73
const vector L(dict.get< vector >("L"))