turbulenceFields.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2025 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::functionObjects::turbulenceFields
26 
27 Description
28  Stores derived turbulence fields on the mesh database for further
29  manipulation.
30 
31 Usage
32  \table
33  Property | Description | Required | Default value
34  type | Type name: processorField | yes |
35  fields | Fields to store (see below) | yes |
36  prefix | If true prefix fields | no | no
37  phase | phase name | no |
38  \endtable
39 
40  Where \c fields can include:
41  \plaintable
42  k | turbulence kinetic energy
43  epsilon | turbulence kinetic energy dissipation rate
44  omega | turbulence specific dissipation rate
45  nut | turbulence viscosity (incompressible)
46  nuEff | effective turbulence viscosity (incompressible)
47  nut | turbulence viscosity (compressible)
48  nuEff | effective turbulence viscosity (compressible)
49  kappaEff | effective turbulence thermal diffusivity (compressible)
50  R | Reynolds stress tensor
51  \endplaintable
52 
53  If the optional \c prefix entry is set true the turbulence fields are stored
54  with the prefix "momentumTransportModel:", e.g.:
55  \verbatim
56  momentumTransportModel:R
57  \endverbatim
58 
59  Example of function object specification:
60  \verbatim
61  turbulenceFields1
62  {
63  type turbulenceFields;
64  libs ("libfieldFunctionObjects.so");
65  ...
66  fields
67  (
68  R
69  devTau
70  );
71  }
72  \endverbatim
73 
74 See also
75  Foam::functionObjects::fvMeshFunctionObject
76  Foam::functionObjects::timeControl
77 
78 SourceFiles
79  turbulenceFields.C
80 
81 \*---------------------------------------------------------------------------*/
82 
83 #ifndef turbulenceFields_functionObject_H
84 #define turbulenceFields_functionObject_H
85 
86 #include "fvMeshFunctionObject.H"
87 #include "HashSet.H"
88 #include "NamedEnum.H"
89 #include "volFieldsFwd.H"
90 
91 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92 
93 namespace Foam
94 {
95 namespace functionObjects
96 {
97 
98 /*---------------------------------------------------------------------------*\
99  Class turbulenceFields Declaration
100 \*---------------------------------------------------------------------------*/
101 
102 class turbulenceFields
103 :
104  public fvMeshFunctionObject
105 {
106 public:
107 
108  enum class compressibleField
109  {
110  k,
111  epsilon,
112  omega,
113  nut,
114  nuEff,
115  kappaEff,
116  R
117  };
118  static const NamedEnum<compressibleField, 7> compressibleFieldNames_;
119 
120  enum class incompressibleField
121  {
122  k,
123  epsilon,
124  omega,
125  nut,
126  nuEff,
127  R
128  };
129  static const NamedEnum<incompressibleField, 6> incompressibleFieldNames_;
130 
131 
132 protected:
133 
134  // Protected data
135 
136  //- Fields to load
138 
139  //- Optional field prefix to avoid name clashes
140  // Defaults to null
141  word prefix_;
142 
143  //- Optional phase name
144  word phaseName_;
145 
146 
147  // Protected Member Functions
148 
149  word modelName();
150 
151  //- Process the turbulence field
152  template<class Type>
153  void processField
154  (
155  const word& fieldName,
156  const tmp<VolField<Type>>& tvalue
157  );
158 
159 
160 public:
161 
162  //- Runtime type information
163  TypeName("turbulenceFields");
164 
165 
166  // Constructors
167 
168  //- Construct from Time and dictionary
170  (
171  const word& name,
172  const Time& runTime,
173  const dictionary& dict
174  );
175 
176  //- Disallow default bitwise copy construction
177  turbulenceFields(const turbulenceFields&) = delete;
178 
179 
180  //- Destructor
181  virtual ~turbulenceFields();
182 
183 
184  // Member Functions
185 
186  //- Read the controls
187  virtual bool read(const dictionary&);
188 
189  //- Return the list of fields required
190  virtual wordList fields() const
191  {
192  return wordList::null();
193  }
194 
195  //- Calculate turbulence fields
196  virtual bool execute();
197 
198  //- Write the turbulence fields
199  virtual bool write();
200 
201 
202  // Member Operators
203 
204  //- Disallow default bitwise assignment
205  void operator=(const turbulenceFields&) = delete;
206 };
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace functionObjects
212 } // End namespace Foam
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #ifdef NoRepository
217  #include "turbulenceFieldsTemplates.C"
218 #endif
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 #endif
223 
224 // ************************************************************************* //
static const List< word > & null()
Return a null List.
Definition: ListI.H:118
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
const word & name() const
Return the name of this functionObject.
Stores derived turbulence fields on the mesh database for further manipulation.
word prefix_
Optional field prefix to avoid name clashes.
turbulenceFields(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual wordList fields() const
Return the list of fields required.
void operator=(const turbulenceFields &)=delete
Disallow default bitwise assignment.
static const NamedEnum< incompressibleField, 6 > incompressibleFieldNames_
static const NamedEnum< compressibleField, 7 > compressibleFieldNames_
TypeName("turbulenceFields")
Runtime type information.
wordHashSet fieldSet_
Fields to load.
void processField(const word &fieldName, const tmp< VolField< Type >> &tvalue)
Process the turbulence field.
virtual bool execute()
Calculate turbulence fields.
virtual bool write()
Write the turbulence fields.
virtual bool read(const dictionary &)
Read the controls.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
HashSet wordHashSet
A HashSet with word keys.
Definition: HashSet.H:210
dictionary dict