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-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::functionObjects::turbulenceFields
29 
30 Group
31  grpFieldFunctionObjects
32 
33 Description
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 the prefix
39  "turbulenceModel:", e.g.:
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 Usage
56  Minimal example by using \c system/controlDict.functions:
57  \verbatim
58  turbulenceFields1
59  {
60  // Mandatory entries (unmodifiable)
61  type turbulenceFields;
62  libs (fieldFunctionObjects);
63 
64  // Mandatory entries (runtime modifiable)
65  // Either field or fields entries
66  fields (R devRhoReff);
67  field R;
68 
69  // Optional (inherited) entries
70  ...
71  }
72  \endverbatim
73 
74  where the entries mean:
75  \table
76  Property | Description | Type | Req'd | Dflt
77  type | Type name: turbulenceFields | word | yes | -
78  libs | Library name: fieldFunctionObjects | word | yes | -
79  fields | Names of fields to store (see below) | wordList | yes | -
80  field | Name of a field to store (see below) | word | yes | -
81  \endtable
82 
83  where \c fields can include:
84  \verbatim
85  k | turbulent kinetic energy
86  epsilon | turbulent kinetic energy dissipation rate
87  omega | specific dissipation rate
88  nuTilda | modified turbulent viscosity
89  nut | turbulent viscosity (incompressible)
90  nuEff | effective turbulent viscosity (incompressible)
91  mut | turbulent viscosity (compressible)
92  muEff | effective turbulent viscosity (compressible)
93  alphat | turbulence thermal diffusivity (compressible)
94  alphaEff | effective turbulence thermal diffusivity (compressible)
95  R | Reynolds stress tensor
96  devReff | deviatoric part of the effective Reynolds stress
97  devRhoReff | divergence of the Reynolds stress
98  L | integral-length scale / mixing-length scale
99  I | turbulence intensity
100  \endverbatim
101 
102  The inherited entries are elaborated in:
103  - \link functionObject.H \endlink
104 
105  Minimal example by using the \c postProcess utility:
106  \verbatim
107  <solver> -postProcess -func turbulenceFields
108  \endverbatim
109 
110 See also
111  - Foam::functionObject
112  - Foam::functionObjects::fvMeshFunctionObject
113  - ExtendedCodeGuide::functionObjects::field::turbulenceFields
114 
115 SourceFiles
116  turbulenceFields.C
117  turbulenceFieldsTemplates.C
118 
119 \*---------------------------------------------------------------------------*/
120 
121 #ifndef functionObjects_turbulenceFields_H
122 #define functionObjects_turbulenceFields_H
123 
124 #include "fvMeshFunctionObject.H"
125 #include "HashSet.H"
126 #include "Enum.H"
127 #include "volFieldsFwd.H"
128 #include "Switch.H"
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 namespace Foam
133 {
134 namespace functionObjects
135 {
136 
137 /*---------------------------------------------------------------------------*\
138  Class turbulenceFields Declaration
139 \*---------------------------------------------------------------------------*/
140 
141 class turbulenceFields
142 :
143  public fvMeshFunctionObject
144 {
145 public:
146 
147  // Public Enumerations
148 
149  //- Options for the turbulence fields (compressible)
150  enum compressibleField
151  {
152  cfK,
153  cfEpsilon,
154  cfOmega,
155  cfNuTilda,
156  cfMut,
157  cfMuEff,
158  cfAlphat,
159  cfAlphaEff,
160  cfR,
161  cfDevRhoReff,
162  cfL,
163  cfI
164  };
165 
166  //- Names for compressibleField turbulence fields
167  static const Enum<compressibleField> compressibleFieldNames_;
168 
169  //- Options for the turbulence fields (incompressible)
171  {
172  ifK,
173  ifEpsilon,
174  ifOmega,
175  ifNuTilda,
176  ifNut,
177  ifNuEff,
178  ifR,
179  ifDevReff,
180  ifL,
181  ifI
182  };
183 
184  //- Names for incompressibleField turbulence fields
185  static const Enum<incompressibleField> incompressibleFieldNames_;
186 
187  //- Turbulence closure model name
188  static const word modelName_;
189 
190 protected:
191 
192  // Protected Data
193 
194  //- Fields to load
196 
197 
198  // Protected Member Functions
199 
200  //- Return true if compressible turbulence model is identified
201  bool compressible();
202 
203  //- Process the turbulence field
204  template<class Type>
206  (
207  const word& fieldName,
209  );
210 
211  //- Return omega calculated from k and epsilon
212  template<class Model>
213  tmp<volScalarField> omega(const Model& model) const;
214 
215  //- Return nuTilda calculated from k and omega
216  template<class Model>
217  tmp<volScalarField> nuTilda(const Model& model) const;
218 
219  //- Return integral length scale, L, calculated from k and epsilon
220  template<class Model>
221  tmp<volScalarField> L(const Model& model) const;
222 
223  //- Return turbulence intensity, I, calculated from k and U
224  template<class Model>
225  tmp<volScalarField> I(const Model& model) const;
226 
227 
228 public:
229 
230  //- Runtime type information
231  TypeName("turbulenceFields");
232 
233 
234  // Constructors
235 
236  //- Construct from Time and dictionary
238  (
239  const word& name,
240  const Time& runTime,
241  const dictionary& dict
242  );
243 
244  //- No copy construct
245  turbulenceFields(const turbulenceFields&) = delete;
246 
247  //- No copy assignment
248  void operator=(const turbulenceFields&) = delete;
249 
250 
251  //- Destructor
252  virtual ~turbulenceFields() = default;
253 
254 
255  // Member Functions
256 
257  //- Read the controls
258  virtual bool read(const dictionary&);
259 
260  //- Calculate turbulence fields
261  virtual bool execute();
262 
263  //- Do nothing.
264  // The turbulence fields are registered and written automatically
265  virtual bool write();
266 };
267 
268 
269 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
270 
271 } // End namespace functionObjects
272 } // End namespace Foam
273 
274 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275 
276 #ifdef NoRepository
277  #include "turbulenceFieldsTemplates.C"
278 #endif
279 
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281 
282 #endif
283 
284 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
volFieldsFwd.H
Foam::functionObjects::turbulenceFields::processField
void processField(const word &fieldName, const tmp< GeometricField< Type, fvPatchField, volMesh >> &tvalue)
Process the turbulence field.
Definition: turbulenceFieldsTemplates.C:35
Foam::functionObjects::turbulenceFields::ifK
"Turbulent kinetic energy"
Definition: turbulenceFields.H:217
Foam::Enum< compressibleField >
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::functionObjects::turbulenceFields::ifL
"Integral-length/Mixing-length scale"
Definition: turbulenceFields.H:225
turbulenceFieldsTemplates.C
fvMeshFunctionObject.H
Foam::functionObjects::turbulenceFields::incompressibleFieldNames_
static const Enum< incompressibleField > incompressibleFieldNames_
Names for incompressibleField turbulence fields.
Definition: turbulenceFields.H:230
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::functionObjects::turbulenceFields::modelName_
static const word modelName_
Turbulence closure model name.
Definition: turbulenceFields.H:233
Foam::functionObjects::turbulenceFields::cfI
"Turbulence intensity"
Definition: turbulenceFields.H:208
Foam::functionObjects::turbulenceFields::compressibleField
compressibleField
Options for the turbulence fields (compressible)
Definition: turbulenceFields.H:195
Foam::functionObjects::turbulenceFields::turbulenceFields
turbulenceFields(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: turbulenceFields.C:115
Foam::functionObjects::turbulenceFields::cfAlphat
"Turbulence thermal diffusivity"
Definition: turbulenceFields.H:203
Foam::functionObjects::turbulenceFields::ifOmega
"Specific dissipation rate"
Definition: turbulenceFields.H:219
Foam::functionObjects::turbulenceFields::cfL
"Integral-length/Mixing-length scale"
Definition: turbulenceFields.H:207
Foam::HashSet< word >
Foam::functionObjects::fvMeshFunctionObject
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Definition: fvMeshFunctionObject.H:64
Foam::functionObjects::turbulenceFields::cfOmega
"Specific dissipation rate"
Definition: turbulenceFields.H:199
Foam::functionObjects::turbulenceFields::L
tmp< volScalarField > L(const Model &model) const
Return integral length scale, L, calculated from k and epsilon.
Foam::functionObjects::turbulenceFields::ifNuTilda
"Modified turbulent viscosity"
Definition: turbulenceFields.H:220
Foam::functionObjects::turbulenceFields::cfDevRhoReff
"Divergence of the Reynolds stress"
Definition: turbulenceFields.H:206
Foam::functionObjects::turbulenceFields::cfMuEff
"Effective turbulent viscosity"
Definition: turbulenceFields.H:202
Foam::functionObjects::turbulenceFields::fieldSet_
wordHashSet fieldSet_
Fields to load.
Definition: turbulenceFields.H:240
Foam::functionObjects::turbulenceFields::write
virtual bool write()
Do nothing.
Definition: turbulenceFields.C:315
Foam::functionObjects::turbulenceFields::~turbulenceFields
virtual ~turbulenceFields()=default
Destructor.
Foam::functionObjects::turbulenceFields::ifDevReff
"Deviatoric part of the effective Reynolds stress"
Definition: turbulenceFields.H:224
Switch.H
Foam::functionObjects::turbulenceFields::cfNuTilda
"Modified turbulent viscosity"
Definition: turbulenceFields.H:200
Foam::functionObjects::turbulenceFields::TypeName
TypeName("turbulenceFields")
Runtime type information.
Foam::functionObjects::turbulenceFields::cfEpsilon
"Turbulent kinetic energy dissipation rate"
Definition: turbulenceFields.H:198
HashSet.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::functionObjects::turbulenceFields::read
virtual bool read(const dictionary &)
Read the controls.
Definition: turbulenceFields.C:130
Foam::functionObjects::turbulenceFields::operator=
void operator=(const turbulenceFields &)=delete
No copy assignment.
Foam::functionObjects::turbulenceFields::ifNuEff
"Effective turbulent viscosity"
Definition: turbulenceFields.H:222
Foam::functionObjects::turbulenceFields::nuTilda
tmp< volScalarField > nuTilda(const Model &model) const
Return nuTilda calculated from k and omega.
Foam::functionObjects::turbulenceFields::compressibleFieldNames_
static const Enum< compressibleField > compressibleFieldNames_
Names for compressibleField turbulence fields.
Definition: turbulenceFields.H:212
Foam::functionObjects::turbulenceFields::cfK
"Turbulent kinetic energy"
Definition: turbulenceFields.H:197
Foam::functionObjects::turbulenceFields::I
tmp< volScalarField > I(const Model &model) const
Return turbulence intensity, I, calculated from k and U.
Foam::functionObjects::turbulenceFields::incompressibleField
incompressibleField
Options for the turbulence fields (incompressible)
Definition: turbulenceFields.H:215
Foam::functionObjects::turbulenceFields::ifNut
"Turbulent viscosity"
Definition: turbulenceFields.H:221
Foam::functionObject::name
const word & name() const
Return the name of this functionObject.
Definition: functionObject.C:131
Foam::functionObjects::turbulenceFields::ifEpsilon
"Turbulent kinetic energy dissipation rate"
Definition: turbulenceFields.H:218
Foam::functionObjects::turbulenceFields::cfAlphaEff
"Effective turbulence thermal diffusivity"
Definition: turbulenceFields.H:204
Foam::functionObjects::turbulenceFields::omega
tmp< volScalarField > omega(const Model &model) const
Return omega calculated from k and epsilon.
Foam::functionObjects::turbulenceFields::compressible
bool compressible()
Return true if compressible turbulence model is identified.
Definition: turbulenceFields.C:93
Foam::functionObjects::turbulenceFields::execute
virtual bool execute()
Calculate turbulence fields.
Definition: turbulenceFields.C:162
Foam::GeometricField< Type, fvPatchField, volMesh >
Foam::functionObjects::turbulenceFields::ifI
"Turbulence intensity"
Definition: turbulenceFields.H:226
Foam::functionObjects::turbulenceFields::ifR
"Reynolds stress tensor"
Definition: turbulenceFields.H:223
Foam::functionObjects::turbulenceFields::cfR
"Reynolds stress tensor"
Definition: turbulenceFields.H:205
Foam::functionObjects::turbulenceFields::cfMut
"Turbulent viscosity"
Definition: turbulenceFields.H:201
Enum.H
Foam::functionObjects::turbulenceFields
Computes various turbulence-related quantities that are not typically output during calculations,...
Definition: turbulenceFields.H:186