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  This function object stores turbulence fields on the mesh database for
32  further manipulation.
33 
34  Fields are stored as copies of the original, with the prefix
35  "tubulenceModel:", e.g.:
36 
37  \verbatim
38  turbulenceModel:R
39  \endverbatim
40 
41  Example of function object specification:
42  \verbatim
43  turbulenceFields1
44  {
45  type turbulenceFields;
46  libs ("libfieldFunctionObjects.so");
47  ...
48  fields
49  (
50  R
51  devRhoReff
52  );
53  }
54  \endverbatim
55 
56 Usage
57  \table
58  Property | Description | Required | Default value
59  type | type name: processorField | yes |
60  fields | fields to store (see below) | yes |
61  \endtable
62 
63  Where \c fields can include:
64  \plaintable
65  k | turbulence kinetic energy
66  epsilon | turbulence kinetic energy dissipation rate
67  omega | turbulence specific dissipation rate
68  nut | turbulence viscosity (incompressible)
69  nuEff | effective turbulence viscosity (incompressible)
70  mut | turbulence viscosity (compressible)
71  muEff | effective turbulence viscosity (compressible)
72  alphat | turbulence thermal diffusivity (compressible)
73  alphaEff | effective turbulence thermal diffusivity (compressible)
74  R | Reynolds stress tensor
75  devReff | Deviatoric part of the effective Reynolds stress
76  devRhoReff | Divergence of the Reynolds stress
77  \endplaintable
78 
79 See also
80  Foam::functionObjects::fvMeshFunctionObject
81  Foam::functionObjects::timeControl
82 
83 SourceFiles
84  turbulenceFields.C
85 
86 \*---------------------------------------------------------------------------*/
87 
88 #ifndef functionObjects_turbulenceFields_H
89 #define functionObjects_turbulenceFields_H
90 
91 #include "fvMeshFunctionObject.H"
92 #include "HashSet.H"
93 #include "NamedEnum.H"
94 #include "volFieldsFwd.H"
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 namespace Foam
99 {
100 namespace functionObjects
101 {
102 
103 /*---------------------------------------------------------------------------*\
104  Class turbulenceFields Declaration
105 \*---------------------------------------------------------------------------*/
106 
107 class turbulenceFields
108 :
109  public fvMeshFunctionObject
110 {
111 public:
112 
113  enum compressibleField
114  {
115  cfK,
116  cfEpsilon,
117  cfOmega,
118  cfMut,
119  cfMuEff,
120  cfAlphat,
121  cfAlphaEff,
122  cfR,
124  };
125  static const NamedEnum<compressibleField, 9> compressibleFieldNames_;
126 
128  {
129  ifK,
130  ifEpsilon,
131  ifOmega,
132  ifNut,
133  ifNuEff,
134  ifR,
135  ifDevReff
136  };
137  static const NamedEnum<incompressibleField, 7> incompressibleFieldNames_;
138 
139  static const word modelName;
140 
141 
142 protected:
143 
144  // Protected data
145 
146  //- Fields to load
148 
149 
150  // Protected Member Functions
151 
152  //- Return true if compressible turbulence model is identified
153  bool compressible();
154 
155  //- Process the turbulence field
156  template<class Type>
157  void processField
158  (
159  const word& fieldName,
160  const tmp<GeometricField<Type, fvPatchField, volMesh>>& tvalue
161  );
162 
163  //- Return omega calculated from k and epsilon
164  template<class Model>
165  tmp<volScalarField> omega(const Model& model) const;
166 
167 
168 private:
170  // Private member functions
171 
172  //- Disallow default bitwise copy construct
174 
175  //- Disallow default bitwise assignment
176  void operator=(const turbulenceFields&);
179 public:
181  //- Runtime type information
182  TypeName("turbulenceFields");
185  // Constructors
186 
187  //- Construct from Time and dictionary
189  (
190  const word& name,
191  const Time& runTime,
193  );
196  //- Destructor
197  virtual ~turbulenceFields();
198 
200  // Member Functions
202  //- Read the controls
203  virtual bool read(const dictionary&);
204 
205  //- Calculate turbulence fields
206  virtual bool execute();
207 
208  //- Do nothing.
209  // The turbulence fields are registered and written automatically
210  virtual bool write();
211 };
212 
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 } // End namespace functionObjects
217 } // End namespace Foam
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #ifdef NoRepository
222  #include "turbulenceFieldsTemplates.C"
223 #endif
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #endif
228 
229 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
tmp< volScalarField > omega(const Model &model) const
Return omega calculated from k and epsilon.
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.
const word & name() const
Return the name of this functionObject.
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
This function object 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.