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  kappaEff | 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  kappaEff,
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<VolField<Type>>& 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&);
193 
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  //- Write the turbulence fields
204  virtual bool write();
205 
206 
207  // Member Operators
208 
209  //- Disallow default bitwise assignment
210  void operator=(const turbulenceFields&) = delete;
211 };
212 
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 } // End namespace functionObjects
217 } // End namespace Foam
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #ifdef NoRepository
222  #include "turbulenceFieldsTemplates.C"
223 #endif
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #endif
228 
229 // ************************************************************************* //
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 keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
const word & name() const
Return the name of this functionObject.
Stores 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.
static const NamedEnum< compressibleField, 8 > compressibleFieldNames_
void operator=(const turbulenceFields &)=delete
Disallow default bitwise assignment.
static const NamedEnum< incompressibleField, 7 > incompressibleFieldNames_
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:208
dictionary dict