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-2018 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  \endtable
58 
59  Where \c fields can include:
60  \plaintable
61  k | turbulence kinetic energy
62  epsilon | turbulence kinetic energy dissipation rate
63  omega | turbulence specific dissipation rate
64  nut | turbulence viscosity (incompressible)
65  nuEff | effective turbulence viscosity (incompressible)
66  mut | turbulence viscosity (compressible)
67  muEff | effective turbulence viscosity (compressible)
68  alphat | turbulence thermal diffusivity (compressible)
69  alphaEff | effective turbulence thermal diffusivity (compressible)
70  R | Reynolds stress tensor
71  devReff | Deviatoric part of the effective Reynolds stress
72  devRhoReff | Divergence of the Reynolds stress
73  \endplaintable
74 
75 See also
76  Foam::functionObjects::fvMeshFunctionObject
77  Foam::functionObjects::timeControl
78 
79 SourceFiles
80  turbulenceFields.C
81 
82 \*---------------------------------------------------------------------------*/
83 
84 #ifndef functionObjects_turbulenceFields_H
85 #define functionObjects_turbulenceFields_H
86 
87 #include "fvMeshFunctionObject.H"
88 #include "HashSet.H"
89 #include "NamedEnum.H"
90 #include "volFieldsFwd.H"
91 
92 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93 
94 namespace Foam
95 {
96 namespace functionObjects
97 {
98 
99 /*---------------------------------------------------------------------------*\
100  Class turbulenceFields Declaration
101 \*---------------------------------------------------------------------------*/
102 
103 class turbulenceFields
104 :
105  public fvMeshFunctionObject
106 {
107 public:
108 
109  enum compressibleField
110  {
111  cfK,
112  cfEpsilon,
113  cfOmega,
114  cfMut,
115  cfMuEff,
116  cfAlphat,
117  cfAlphaEff,
118  cfR,
120  };
121  static const NamedEnum<compressibleField, 9> compressibleFieldNames_;
122 
124  {
125  ifK,
126  ifEpsilon,
127  ifOmega,
128  ifNut,
129  ifNuEff,
130  ifR,
131  ifDevReff
132  };
133  static const NamedEnum<incompressibleField, 7> incompressibleFieldNames_;
134 
135  static const word modelName;
136 
137 
138 protected:
139 
140  // Protected data
141 
142  //- Fields to load
144 
145 
146  // Protected Member Functions
147 
148  //- Return true if compressible turbulence model is identified
149  bool compressible();
150 
151  //- Process the turbulence field
152  template<class Type>
153  void processField
154  (
155  const word& fieldName,
156  const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvalue
157  );
158 
159  //- Return omega calculated from k and epsilon
160  template<class Model>
161  tmp<volScalarField> omega(const Model& model) const;
162 
163 
164 private:
166  // Private member functions
167 
168  //- Disallow default bitwise copy construct
170 
171  //- Disallow default bitwise assignment
172  void operator=(const turbulenceFields&);
175 public:
177  //- Runtime type information
178  TypeName("turbulenceFields");
181  // Constructors
182 
183  //- Construct from Time and dictionary
185  (
186  const word& name,
187  const Time& runTime,
189  );
192  //- Destructor
193  virtual ~turbulenceFields();
194 
196  // Member Functions
198  //- Read the controls
199  virtual bool read(const dictionary&);
200 
201  //- Calculate turbulence fields
202  virtual bool execute();
203 
204  //- Do nothing.
205  // The turbulence fields are registered and written automatically
206  virtual bool write();
207 };
208 
209 
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:137
engineTime & runTime
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.