turbulenceFields.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2013-2016 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 Group
28  grpFieldFunctionObjects
29 
30 Description
31  Stores turbulence fields on the mesh database for further manipulation.
32 
33  Fields are stored as copies of the original, with the prefix
34  "tubulenceModel:", e.g.:
35 
36  \verbatim
37  turbulenceModel:R
38  \endverbatim
39 
40  Example of function object specification:
41  \verbatim
42  turbulenceFields1
43  {
44  type turbulenceFields;
45  libs ("libfieldFunctionObjects.so");
46  ...
47  fields
48  (
49  R
50  devRhoReff
51  );
52  }
53  \endverbatim
54 
55 Usage
56  \table
57  Property | Description | Required | Default value
58  type | type name: processorField | yes |
59  fields | fields to store (see below) | yes |
60  \endtable
61 
62  Where \c fields can include:
63  \plaintable
64  k | turbulence kinetic energy
65  epsilon | turbulence kinetic energy dissipation rate
66  omega | turbulence specific dissipation rate
67  nut | turbulence viscosity (incompressible)
68  nuEff | effective turbulence viscosity (incompressible)
69  mut | turbulence viscosity (compressible)
70  muEff | effective turbulence viscosity (compressible)
71  alphat | turbulence thermal diffusivity (compressible)
72  alphaEff | effective turbulence thermal diffusivity (compressible)
73  R | Reynolds stress tensor
74  devReff | Deviatoric part of the effective Reynolds stress
75  devRhoReff | Divergence of the Reynolds stress
76  \endplaintable
77 
78 See also
79  Foam::functionObjects::fvMeshFunctionObject
80  Foam::functionObjects::timeControl
81 
82 SourceFiles
83  turbulenceFields.C
84 
85 \*---------------------------------------------------------------------------*/
86 
87 #ifndef functionObjects_turbulenceFields_H
88 #define functionObjects_turbulenceFields_H
89 
90 #include "fvMeshFunctionObject.H"
91 #include "HashSet.H"
92 #include "NamedEnum.H"
93 #include "volFieldsFwd.H"
94 
95 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
96 
97 namespace Foam
98 {
99 namespace functionObjects
100 {
101 
102 /*---------------------------------------------------------------------------*\
103  Class turbulenceFields Declaration
104 \*---------------------------------------------------------------------------*/
105 
106 class turbulenceFields
107 :
108  public fvMeshFunctionObject
109 {
110 public:
111 
112  enum compressibleField
113  {
114  cfK,
115  cfEpsilon,
116  cfOmega,
117  cfMut,
118  cfMuEff,
119  cfAlphat,
120  cfAlphaEff,
121  cfR,
123  };
124  static const NamedEnum<compressibleField, 9> compressibleFieldNames_;
125 
127  {
128  ifK,
129  ifEpsilon,
130  ifOmega,
131  ifNut,
132  ifNuEff,
133  ifR,
134  ifDevReff
135  };
136  static const NamedEnum<incompressibleField, 7> incompressibleFieldNames_;
137 
138  static const word modelName;
139 
140 
141 protected:
142 
143  // Protected data
144 
145  //- Fields to load
147 
148 
149  // Protected Member Functions
150 
151  //- Return true if compressible turbulence model is identified
152  bool compressible();
153 
154  //- Process the turbulence field
155  template<class Type>
156  void processField
157  (
158  const word& fieldName,
159  const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvalue
160  );
161 
162  //- Return omega calculated from k and epsilon
163  template<class Model>
164  tmp<volScalarField> omega(const Model& model) const;
165 
166 
167 private:
169  // Private member functions
170 
171  //- Disallow default bitwise copy construct
173 
174  //- Disallow default bitwise assignment
175  void operator=(const turbulenceFields&);
178 public:
180  //- Runtime type information
181  TypeName("turbulenceFields");
184  // Constructors
185 
186  //- Construct from Time and dictionary
188  (
189  const word& name,
190  const Time& runTime,
192  );
195  //- Destructor
196  virtual ~turbulenceFields();
197 
199  // Member Functions
201  //- Read the controls
202  virtual bool read(const dictionary&);
203 
204  //- Calculate turbulence fields
205  virtual bool execute();
206 
207  //- Do nothing.
208  // The turbulence fields are registered and written automatically
209  virtual bool write();
210 };
211 
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace functionObjects
216 } // End namespace Foam
217 
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:137
TypeName("turbulenceFields")
Runtime type information.
static const NamedEnum< incompressibleField, 7 > incompressibleFieldNames_
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
wordHashSet fieldSet_
Fields to load.
bool compressible()
Return true if compressible turbulence model is identified.
tmp< volScalarField > omega(const Model &model) const
Return omega calculated from k and epsilon.
A class for handling words, derived from string.
Definition: word.H:59
virtual bool read(const dictionary &)
Read the controls.
HashSet wordHashSet
A HashSet with word keys.
Definition: HashSet.H:207
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_
Namespace for OpenFOAM.