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-2020 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  \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  devSigma | Deviatoric part of the effective Reynolds stress
73  devTau | 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  alphaEff,
118  R,
119  devTau
120  };
121  static const NamedEnum<compressibleField, 8> compressibleFieldNames_;
122 
123  enum class incompressibleField
124  {
125  k,
126  epsilon,
127  omega,
128  nut,
129  nuEff,
130  R,
131  devSigma
132  };
133  static const NamedEnum<incompressibleField, 7> incompressibleFieldNames_;
134 
135 
136 protected:
137 
138  // Protected data
139 
140  //- Fields to load
142 
143  //- Optional field prefix to avoid name clashes
144  // Defaults to null
145  word prefix_;
146 
147 
148  // Protected Member Functions
149 
150  static const word& modelName();
151 
152  //- Process the turbulence field
153  template<class Type>
154  void processField
155  (
156  const word& fieldName,
157  const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvalue
158  );
159 
160  //- Return omega calculated from k and epsilon
161  template<class Model>
162  tmp<volScalarField> omega(const Model& model) const;
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
182  turbulenceFields(const turbulenceFields&) = delete;
183 
184 
185  //- Destructor
186  virtual ~turbulenceFields();
187 
189  // Member Functions
191  //- Read the controls
192  virtual bool read(const dictionary&);
193 
194  //- Calculate turbulence fields
195  virtual bool execute();
196 
197  //- Do nothing.
198  // The turbulence fields are registered and written automatically
199  virtual bool write();
201 
202  // Member Operators
203 
204  //- Disallow default bitwise assignment
205  void operator=(const turbulenceFields&) = delete;
206 };
207 
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 // ************************************************************************* //
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.
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.