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-2019 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  "tubulenceModel:", e.g.:
32 
33  \verbatim
34  turbulenceModel: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  devRhoReff
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  \endtable
59 
60  Where \c fields can include:
61  \plaintable
62  k | turbulence kinetic energy
63  epsilon | turbulence kinetic energy dissipation rate
64  omega | turbulence specific dissipation rate
65  nut | turbulence viscosity (incompressible)
66  nuEff | effective turbulence viscosity (incompressible)
67  mut | turbulence viscosity (compressible)
68  muEff | effective turbulence viscosity (compressible)
69  alphat | turbulence thermal diffusivity (compressible)
70  alphaEff | effective turbulence thermal diffusivity (compressible)
71  R | Reynolds stress tensor
72  devReff | Deviatoric part of the effective Reynolds stress
73  devRhoReff | Divergence of the Reynolds stress
74  \endplaintable
75 
76 See also
77  Foam::functionObjects::fvMeshFunctionObject
78  Foam::functionObjects::timeControl
79 
80 SourceFiles
81  turbulenceFields.C
82 
83 \*---------------------------------------------------------------------------*/
84 
85 #ifndef functionObjects_turbulenceFields_H
86 #define functionObjects_turbulenceFields_H
87 
88 #include "fvMeshFunctionObject.H"
89 #include "HashSet.H"
90 #include "NamedEnum.H"
91 #include "volFieldsFwd.H"
92 
93 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94 
95 namespace Foam
96 {
97 namespace functionObjects
98 {
99 
100 /*---------------------------------------------------------------------------*\
101  Class turbulenceFields Declaration
102 \*---------------------------------------------------------------------------*/
103 
104 class turbulenceFields
105 :
106  public fvMeshFunctionObject
107 {
108 public:
109 
110  enum class compressibleField
111  {
112  k,
113  epsilon,
114  omega,
115  mut,
116  muEff,
117  alphat,
118  alphaEff,
119  R,
120  devRhoReff
121  };
122  static const NamedEnum<compressibleField, 9> compressibleFieldNames_;
123 
124  enum class incompressibleField
125  {
126  k,
127  epsilon,
128  omega,
129  nut,
130  nuEff,
131  R,
132  devReff
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 
149  // Protected Member Functions
150 
151  static const word& modelName();
152 
153  //- Process the turbulence field
154  template<class Type>
155  void processField
156  (
157  const word& fieldName,
158  const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvalue
159  );
160 
161  //- Return omega calculated from k and epsilon
162  template<class Model>
163  tmp<volScalarField> omega(const Model& model) const;
164 
165 
166 public:
167 
168  //- Runtime type information
169  TypeName("turbulenceFields");
170 
172  // Constructors
173 
174  //- Construct from Time and dictionary
176  (
177  const word& name,
178  const Time& runTime,
179  const dictionary& dict
180  );
181 
182  //- Disallow default bitwise copy construction
183  turbulenceFields(const turbulenceFields&) = delete;
184 
185 
186  //- Destructor
187  virtual ~turbulenceFields();
188 
190  // Member Functions
192  //- Read the controls
193  virtual bool read(const dictionary&);
194 
195  //- Calculate turbulence fields
196  virtual bool execute();
197 
198  //- Do nothing.
199  // The turbulence fields are registered and written automatically
200  virtual bool write();
202 
203  // Member Operators
204 
205  //- Disallow default bitwise assignment
206  void operator=(const turbulenceFields&) = delete;
207 };
208 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 } // End namespace functionObjects
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #ifdef NoRepository
218  #include "turbulenceFieldsTemplates.C"
219 #endif
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 #endif
224 
225 // ************************************************************************* //
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:158
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.
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:205
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.
static const NamedEnum< compressibleField, 9 > compressibleFieldNames_
scalar nut
Namespace for OpenFOAM.