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-2022 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 turbulence fields on the mesh database for further manipulation.
29 
30  Fields are stored as copies of the original, with the prefix
31  "momentumTransportModel:", e.g.:
32 
33  \verbatim
34  momentumTransportModel:R
35  \endverbatim
36 
37  Example of function object specification:
38  \verbatim
39  turbulenceFields1
40  {
41  type turbulenceFields;
42  libs ("libfieldFunctionObjects.so");
43  ...
44  fields
45  (
46  R
47  devTau
48  );
49  }
50  \endverbatim
51 
52 Usage
53  \table
54  Property | Description | Required | Default value
55  type | Type name: processorField | yes |
56  fields | Fields to store (see below) | yes |
57  prefix | If true prefix fields | no | no
58  phase | phase name | no |
59  \endtable
60 
61  Where \c fields can include:
62  \plaintable
63  k | turbulence kinetic energy
64  epsilon | turbulence kinetic energy dissipation rate
65  omega | turbulence specific dissipation rate
66  nut | turbulence viscosity (incompressible)
67  nuEff | effective turbulence viscosity (incompressible)
68  nut | turbulence viscosity (compressible)
69  nuEff | effective turbulence viscosity (compressible)
70  alphaEff | effective turbulence thermal diffusivity (compressible)
71  R | Reynolds stress tensor
72  devSigma | Deviatoric part of the effective Reynolds stress \
73  (incompressible)
74  devTau | Divergence of the Reynolds stress (compressible)
75  \endplaintable
76 
77 See also
78  Foam::functionObjects::fvMeshFunctionObject
79  Foam::functionObjects::timeControl
80 
81 SourceFiles
82  turbulenceFields.C
83 
84 \*---------------------------------------------------------------------------*/
85 
86 #ifndef functionObjects_turbulenceFields_H
87 #define functionObjects_turbulenceFields_H
88 
89 #include "fvMeshFunctionObject.H"
90 #include "HashSet.H"
91 #include "NamedEnum.H"
92 #include "volFieldsFwd.H"
93 
94 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95 
96 namespace Foam
97 {
98 namespace functionObjects
99 {
100 
101 /*---------------------------------------------------------------------------*\
102  Class turbulenceFields Declaration
103 \*---------------------------------------------------------------------------*/
104 
105 class turbulenceFields
106 :
107  public fvMeshFunctionObject
108 {
109 public:
110 
111  enum class compressibleField
112  {
113  k,
114  epsilon,
115  omega,
116  nut,
117  nuEff,
118  alphaEff,
119  R,
120  devTau
121  };
122  static const NamedEnum<compressibleField, 8> compressibleFieldNames_;
123 
124  enum class incompressibleField
125  {
126  k,
127  epsilon,
128  omega,
129  nut,
130  nuEff,
131  R,
132  devSigma
133  };
134  static const NamedEnum<incompressibleField, 7> incompressibleFieldNames_;
135 
136 
137 protected:
138 
139  // Protected data
140 
141  //- Fields to load
143 
144  //- Optional field prefix to avoid name clashes
145  // Defaults to null
146  word prefix_;
147 
148  //- Optional phase name
149  word phaseName_;
150 
151 
152  // Protected Member Functions
153 
154  word modelName();
155 
156  //- Process the turbulence field
157  template<class Type>
158  void processField
159  (
160  const word& fieldName,
161  const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvalue
162  );
163 
164 
165 public:
166 
167  //- Runtime type information
168  TypeName("turbulenceFields");
169 
170 
171  // Constructors
172 
173  //- Construct from Time and dictionary
175  (
176  const word& name,
177  const Time& runTime,
178  const dictionary& dict
179  );
180 
181  //- Disallow default bitwise copy construction
183 
184 
185  //- Destructor
186  virtual ~turbulenceFields();
187 
188 
189  // Member Functions
190 
191  //- Read the controls
192  virtual bool read(const dictionary&);
194  //- Return the list of fields required
195  virtual wordList fields() const
196  {
197  return wordList::null();
198  }
199 
200  //- Calculate turbulence fields
201  virtual bool execute();
202 
203  //- Do nothing.
204  // The turbulence fields are registered and written automatically
205  virtual bool write();
206 
207 
208  // Member Operators
209 
210  //- Disallow default bitwise assignment
211  void operator=(const turbulenceFields&) = delete;
212 };
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 } // End namespace functionObjects
218 } // End namespace Foam
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 #ifdef NoRepository
223  #include "turbulenceFieldsTemplates.C"
224 #endif
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 #endif
229 
230 // ************************************************************************* //
dictionary dict
const word & name() const
Return the name of this functionObject.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
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.
TypeName("turbulenceFields")
Runtime type information.
static const NamedEnum< incompressibleField, 7 > incompressibleFieldNames_
static const List< T > & null()
Return a null List.
Definition: ListI.H:118
word prefix_
Optional field prefix to avoid name clashes.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
wordHashSet fieldSet_
Fields to load.
static const NamedEnum< compressibleField, 8 > compressibleFieldNames_
A class for handling words, derived from string.
Definition: word.H:59
void operator=(const turbulenceFields &)=delete
Disallow default bitwise assignment.
virtual bool read(const dictionary &)
Read the controls.
HashSet wordHashSet
A HashSet with word keys.
Definition: HashSet.H:208
Stores turbulence fields on the mesh database for further manipulation.
void processField(const word &fieldName, const tmp< GeometricField< Type, fvPatchField, volMesh >> &tvalue)
Process the turbulence field.
virtual bool execute()
Calculate turbulence fields.
Namespace for OpenFOAM.