ObukhovLength.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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2020 ENERCON GmbH
9 Copyright (C) 2020 OpenCFD Ltd
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::functionObjects::ObukhovLength
29
30Group
31 grpFieldFunctionObjects
32
33Description
34 Computes the Obukhov length field and associated friction velocity field.
35
36 When scaled by the ground-normal height, i.e. \c z, the Obukhov length
37 becomes a dimensionless stability parameter, i.e. \c z/L, for atmospheric
38 boundary layer modelling, expressing the relative roles of buoyancy and
39 shear in the production and dissipation of turbulent kinetic energy.
40
41 \f[
42 u^* = \sqrt{\max (\nu_t \sqrt{2 |\symm{\grad{u}}|^2}, VSMALL)}
43 \f]
44
45 \f[
46 L_o = - \frac{(u^*)^3}{sign(B) \kappa \max (|B|, VSMALL)}
47 \f]
48
49 with
50 \f[
51 B = \alpha_t \beta \frac{\grad{T} \cdot \vec{g}}{\rho}
52 \f]
53
54 where
55 \vartable
56 u^* | Friction velocity [m/s]
57 \nu_t | Turbulent viscosity [m2/s]
58 u | Velocity [m/s]
59 L_o | Obukhov length [m]
60 B | Buoyancy production term [m2/s3]
61 \alpha_t | Kinematic turbulent thermal conductivity [m2/s]/[kg/m/s]
62 \rho | Density of fluid [-]/[kg/m3]
63 \beta | Thermal expansion coefficient [1/K]
64 T | Temperature [K]
65 g | Gravitational acceleration [m/s2]
66 VSMALL | A very small number to avoid floating point exceptions
67 \endvartable
68
69 References:
70 \verbatim
71 Definition of the Obukhov length (tag:O):
72 Obukhov, A. M. (1946).
73 Turbulentnost'v temperaturnoj-neodnorodnoj atmosfere.
74 Trudy Inst. Theor. Geofiz. AN SSSR, 1, 95-115.
75
76 Obukhov, A. M. (1971).
77 Turbulence in an atmosphere with a non-uniform temperature.
78 Boundary-layer meteorology, 2(1), 7-29.
79 DOI:10.1007/BF00718085
80
81 Obukhov length. (2016).
82 In American Meteorological Society - Glossary of meteorology.
83 Retrieved Apr 1, 2020, from glossary.ametsoc.org/wiki/Obukhov_length
84 \endverbatim
85
86 Required fields:
87 \verbatim
88 U | Velocity [m/s]
89 T | Temperature [K]
90 nut | Turbulent viscosity [m2/s]
91 alphat | Kinematic turbulent thermal conductivity [m2/s]/[kg/m/s]
92 g | Gravitational acceleration [m/s2]
93 \endverbatim
94
95 \table
96 Operand | Type | Location
97 input | - | -
98 output file | - | -
99 output field 1 | volScalarField | $FOAM_CASE/<time>/<ObukhovLength>
100 output field 2 | volScalarField | $FOAM_CASE/<time>/<Ustar>
101 \endtable
102
103Usage
104 Minimal example by using \c system/controlDict.functions:
105 \verbatim
106 ObukhovLength1
107 {
108 // Mandatory entries (unmodifiable)
109 type ObukhovLength;
110 libs (fieldFunctionObjects);
111
112 // Optional entries (runtime modifiable)
113 U U;
114 result1 ObukhovLength;
115 result2 Ustar;
116 rhoRef 1.0;
117 kappa 0.4;
118 beta 3e-3;
119
120 // Optional (inherited) entries
121 ...
122 }
123 \endverbatim
124
125 where the entries mean:
126 \table
127 Property | Description | Type | Req'd | Dflt
128 type | Type name: ObukhovLength | word | yes | -
129 libs | Library name: fieldFunctionObjects | word | yes | -
130 U | Name of the velocity field | word | no | U
131 result1 | Name of the output field for ObukhovLength | word | no <!--
132 --> | ObukhovLength
133 result2 | Name of the output field for Ustar | word | no | Ustar
134 rhoRef | Reference density (to convert from kinematic to static <!--
135 --> pressure) | scalar | no | 1.0
136 kappa | von Kármán constant | scalar | no | 0.40
137 beta | Thermal expansion coefficient | scalar | no | 3e-3
138 \endtable
139
140 The inherited entries are elaborated in:
141 - \link functionObject.H \endlink
142
143 Minimal example by using the \c postProcess utility:
144 \verbatim
145 postProcess -func "ObukhovLength(<UField>)"
146 \endverbatim
147
148See also
149 - Foam::functionObjects::fvMeshFunctionObject
150 - ExtendedCodeGuide::atmosphericModels::functionObjects::ObukhovLength
151
152SourceFiles
153 ObukhovLength.C
154
155\*---------------------------------------------------------------------------*/
156
157#ifndef functionObjects_ObukhovLength_H
158#define functionObjects_ObukhovLength_H
159
160#include "fvMeshFunctionObject.H"
162#include "gravityMeshObject.H"
163#include "Enum.H"
164
165// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166
167namespace Foam
168{
169namespace functionObjects
170{
171
172/*---------------------------------------------------------------------------*\
173 Class ObukhovLength Declaration
174\*---------------------------------------------------------------------------*/
175
176class ObukhovLength
177:
178 public fvMeshFunctionObject
179{
180protected:
181
182 // Protected Data
183
184 //- Name of velocity field
185 word UName_;
186
187 //- Name of the output field for ObukhovLength
188 word resultName1_;
189
190 //- Name of the output field for Ustar
191 word resultName2_;
192
193 //- Reference density (to convert from kinematic to static pressure)
194 scalar rhoRef_;
195
196 //- von Kármán constant [-]
197 scalar kappa_;
198
199 //- Thermal expansion coefficient [1/K]
201
202 //- Gravitational acceleration vector [m/s2]
203 const dimensionedVector g_;
204
205
206 // Protected Member Functions
207
208 //- Hard-coded Obukhov length field and friction velocity
209 // \return true if fields did not previously exist
210 bool calcOL();
211
212
213public:
214
215 //- Run-time type information
216 TypeName("ObukhovLength");
217
218
219 // Constructors
220
221 //- Construct from Time and dictionary
223 (
224 const word& name,
225 const Time& runTime,
226 const dictionary& dict
227 );
228
229 //- No copy construct
230 ObukhovLength(const ObukhovLength&) = delete;
231
232 //- No copy assignment
233 void operator=(const ObukhovLength&) = delete;
234
235
236 //- Destructor
237 virtual ~ObukhovLength() = default;
238
239
240 // Member Functions
241
242 //- Remove (checkOut) the output fields from the object registry
243 void removeObukhovLength();
244
245 //- Read the data
246 virtual bool read(const dictionary& dict);
247
248 //- Calculate the output fields
249 virtual bool execute();
250
251 //- Write the output fields
252 virtual bool write();
253
254 //- Update for changes of mesh
255 virtual void updateMesh(const mapPolyMesh& mpm);
256
257 //- Update for mesh point-motion
258 virtual void movePoints(const polyMesh& m);
259};
260
261
262// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263
264} // End namespace functionObjects
265} // End namespace Foam
266
267// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
268
269#endif
270
271// ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const word & name() const noexcept
Return the name of this functionObject.
Computes the Obukhov length field and associated friction velocity field.
scalar rhoRef_
Reference density (to convert from kinematic to static pressure)
scalar kappa_
von Kármán constant [-]
word UName_
Name of velocity field.
virtual ~ObukhovLength()=default
Destructor.
void removeObukhovLength()
Remove (checkOut) the output fields from the object registry.
ObukhovLength(const ObukhovLength &)=delete
No copy construct.
virtual void movePoints(const polyMesh &m)
Update for mesh point-motion.
virtual bool read(const dictionary &dict)
Read the data.
ObukhovLength(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
TypeName("ObukhovLength")
Run-time type information.
virtual void updateMesh(const mapPolyMesh &mpm)
Update for changes of mesh.
word resultName2_
Name of the output field for Ustar.
void operator=(const ObukhovLength &)=delete
No copy assignment.
const dimensionedVector g_
Gravitational acceleration vector [m/s2].
word resultName1_
Name of the output field for ObukhovLength.
bool calcOL()
Hard-coded Obukhov length field and friction velocity.
Definition: ObukhovLength.C:51
virtual bool execute()
Calculate the output fields.
virtual bool write()
Write the output fields.
dimensionedScalar beta_
Thermal expansion coefficient [1/K].
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:162
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
Namespace for OpenFOAM.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73