All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2021 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  mut | turbulence viscosity (compressible)
69  muEff | 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  mut,
117  muEff,
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  //- Return omega calculated from k and epsilon
165  template<class Model>
166  tmp<volScalarField> omega(const Model& model) const;
167 
168 
169 public:
170 
171  //- Runtime type information
172  TypeName("turbulenceFields");
173 
174 
175  // Constructors
177  //- Construct from Time and dictionary
179  (
180  const word& name,
181  const Time& runTime,
183  );
184 
185  //- Disallow default bitwise copy construction
186  turbulenceFields(const turbulenceFields&) = delete;
187 
188 
189  //- Destructor
190  virtual ~turbulenceFields();
191 
192 
193  // Member Functions
194 
195  //- Read the controls
196  virtual bool read(const dictionary&);
197 
198  //- Calculate turbulence fields
199  virtual bool execute();
200 
201  //- Do nothing.
202  // The turbulence fields are registered and written automatically
203  virtual bool write();
204 
206  // Member Operators
207 
208  //- Disallow default bitwise assignment
209  void operator=(const turbulenceFields&) = delete;
210 };
211 
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace functionObjects
216 } // End namespace Foam
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #ifdef NoRepository
221  #include "turbulenceFieldsTemplates.C"
222 #endif
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #endif
227 
228 // ************************************************************************* //
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.
engineTime & runTime
TypeName("turbulenceFields")
Runtime type information.
static const NamedEnum< incompressibleField, 7 > incompressibleFieldNames_
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:68
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.
scalar nut
Namespace for OpenFOAM.