atmBoundaryLayer.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) 2014-2015 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
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::atmBoundaryLayer
26 
27 Group
28  grpRASBoundaryConditions grpInletBoundaryConditions
29 
30 Description
31  This class provides functions to evaluate the velocity and turbulence
32  distributions appropriate for atmospheric boundary layers (ABL).
33 
34  The profile is derived from the friction velocity, flow direction and
35  "vertical" direction:
36 
37  \f[
38  U = \frac{U^*}{\kappa} ln\left(\frac{z - z_g + z_0}{z_0}\right)
39  \f]
40 
41  \f[
42  k = \frac{(U^*)^2}{\sqrt{C_{\mu}}}
43  \f]
44 
45  \f[
46  \epsilon = \frac{(U^*)^3}{\kappa(z - z_g + z_0)}
47  \f]
48 
49  where
50  \vartable
51  U^* | Friction velocity
52  \kappa | von Karman's constant
53  C_{\mu} | Turbulence viscosity coefficient
54  z | Vertical coordinate
55  z_0 | Surface roughness height [m]
56  z_g | Minimum z-coordinate [m]
57  \endvartable
58  and
59  \f[
60  U^* = \kappa\frac{U_{ref}}{ln\left(\frac{Z_{ref} + z_0}{z_0}\right)}
61  \f]
62  where
63  \vartable
64  U_{ref} | Reference velocity at \f$Z_{ref}\f$ [m/s]
65  Z_{ref} | Reference height [m]
66  \endvartable
67 
68  Use in the atmBoundaryLayerInletVelocity, atmBoundaryLayerInletK and
69  atmBoundaryLayerInletEpsilon boundary conditions.
70 
71  Reference:
72  D.M. Hargreaves and N.G. Wright, "On the use of the k-epsilon model
73  in commercial CFD software to model the neutral atmospheric boundary
74  layer", Journal of Wind Engineering and Industrial Aerodynamics
75  95(2007), pp 355-369.
76 
77  \heading Patch usage
78 
79  \table
80  Property | Description | Required | Default
81  flowDir | Flow direction | yes |
82  zDir | Vertical direction | yes |
83  kappa | von Karman's constant | no | 0.41
84  Cmu | Turbulence viscosity coefficient | no | 0.09
85  Uref | Reference velocity [m/s] | yes |
86  Zref | Reference height [m] | yes |
87  z0 | Surface roughness height [m] | yes |
88  zGround | Minimum z-coordinate [m] | yes |
89  \endtable
90 
91  Example of the boundary condition specification:
92  \verbatim
93  ground
94  {
95  type atmBoundaryLayerInletVelocity;
96  flowDir (1 0 0);
97  zDir (0 0 1);
98  Uref 10.0;
99  Zref 20.0;
100  z0 uniform 0.1;
101  zGround uniform 0.0;
102  }
103  \endverbatim
104 
105 Note
106  D.M. Hargreaves and N.G. Wright recommend Gamma epsilon in the
107  k-epsilon model should be changed from 1.3 to 1.11 for consistency.
108  The roughness height (Er) is given by Er = 20 z0 following the same
109  reference.
110 
111 SourceFiles
112  atmBoundaryLayer.C
113 
114 \*---------------------------------------------------------------------------*/
115 
116 #ifndef atmBoundaryLayer_H
117 #define atmBoundaryLayer_H
118 
119 #include "fvPatchFields.H"
120 
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 
123 namespace Foam
124 {
125 
126 /*---------------------------------------------------------------------------*\
127  Class atmBoundaryLayer Declaration
128 \*---------------------------------------------------------------------------*/
129 
130 class atmBoundaryLayer
131 {
132  // Private data
133 
134  //- Flow direction
136 
137  //- Direction of the z-coordinate
138  vector zDir_;
139 
140  //- Von Karman constant
141  const scalar kappa_;
142 
143  //- Turbulent viscosity coefficient
144  const scalar Cmu_;
145 
146  //- Reference velocity
147  const scalar Uref_;
148 
149  //- Reference height
150  const scalar Zref_;
151 
152  //- Surface roughness height
154 
155  //- Minimum coordinate value in z direction
157 
158  //- Friction velocity
160 
161 
162 public:
163 
164  // Constructors
165 
166  //- Construct null
168 
169  //- Construct from the coordinates field and dictionary
170  atmBoundaryLayer(const vectorField& p, const dictionary&);
171 
172  //- Construct by mapping given
173  // atmBoundaryLayer onto a new patch
175  (
176  const atmBoundaryLayer&,
177  const fvPatchFieldMapper&
178  );
179 
180  //- Construct as copy
182 
183 
184  // Member functions
185 
186  // Access
187 
188  //- Return flow direction
189  const vector& flowDir() const
190  {
191  return flowDir_;
192  }
193 
194  //- Return z-direction
195  const vector& zDir() const
196  {
197  return zDir_;
198  }
199 
200  //- Return friction velocity
201  const scalarField& Ustar() const
202  {
203  return Ustar_;
204  }
205 
206 
207  // Mapping functions
208 
209  //- Map (and resize as needed) from self given a mapping object
210  void autoMap(const fvPatchFieldMapper&);
211 
212  //- Reverse map the given fvPatchField onto this fvPatchField
213  void rmap(const atmBoundaryLayer&, const labelList&);
214 
215 
216  // Evaluate functions
217 
218  //- Return the velocity distribution for the ATM
219  tmp<vectorField> U(const vectorField& p) const;
220 
221  //- Return the turbulent kinetic energy distribution for the ATM
222  tmp<scalarField> k(const vectorField& p) const;
223 
224  //- Return the turbulent dissipation rate distribution for the ATM
225  tmp<scalarField> epsilon(const vectorField& p) const;
226 
227 
228  //- Write
229  void write(Ostream&) const;
230 };
231 
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 } // End namespace Foam
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #endif
240 
241 // ************************************************************************* //
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:48
Foam::atmBoundaryLayer::kappa_
const scalar kappa_
Von Karman constant.
Definition: atmBoundaryLayer.H:217
p
p
Definition: pEqn.H:62
Foam::atmBoundaryLayer::flowDir
const vector & flowDir() const
Return flow direction.
Definition: atmBoundaryLayer.H:265
Foam::atmBoundaryLayer::zDir_
vector zDir_
Direction of the z-coordinate.
Definition: atmBoundaryLayer.H:214
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::atmBoundaryLayer::Uref_
const scalar Uref_
Reference velocity.
Definition: atmBoundaryLayer.H:223
Foam::atmBoundaryLayer::U
tmp< vectorField > U(const vectorField &p) const
Return the velocity distribution for the ATM.
Definition: atmBoundaryLayer.C:130
Foam::atmBoundaryLayer::Ustar_
scalarField Ustar_
Friction velocity.
Definition: atmBoundaryLayer.H:235
Foam::atmBoundaryLayer
This class provides functions to evaluate the velocity and turbulence distributions appropriate for a...
Definition: atmBoundaryLayer.H:206
Foam::atmBoundaryLayer::z0_
scalarField z0_
Surface roughness height.
Definition: atmBoundaryLayer.H:229
Foam::atmBoundaryLayer::flowDir_
vector flowDir_
Flow direction.
Definition: atmBoundaryLayer.H:211
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:49
Foam::atmBoundaryLayer::k
tmp< scalarField > k(const vectorField &p) const
Return the turbulent kinetic energy distribution for the ATM.
Definition: atmBoundaryLayer.C:142
Foam::atmBoundaryLayer::write
void write(Ostream &) const
Write.
Definition: atmBoundaryLayer.C:154
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::atmBoundaryLayer::zGround_
scalarField zGround_
Minimum coordinate value in z direction.
Definition: atmBoundaryLayer.H:232
Foam::atmBoundaryLayer::atmBoundaryLayer
atmBoundaryLayer()
Construct null.
Definition: atmBoundaryLayer.C:35
Foam::atmBoundaryLayer::Cmu_
const scalar Cmu_
Turbulent viscosity coefficient.
Definition: atmBoundaryLayer.H:220
Foam::atmBoundaryLayer::zDir
const vector & zDir() const
Return z-direction.
Definition: atmBoundaryLayer.H:271
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
fvPatchFields.H
Foam::Vector< scalar >
Foam::atmBoundaryLayer::autoMap
void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: atmBoundaryLayer.C:110
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::atmBoundaryLayer::epsilon
tmp< scalarField > epsilon(const vectorField &p) const
Return the turbulent dissipation rate distribution for the ATM.
Definition: atmBoundaryLayer.C:148
Foam::atmBoundaryLayer::rmap
void rmap(const atmBoundaryLayer &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: atmBoundaryLayer.C:119
Foam::atmBoundaryLayer::Ustar
const scalarField & Ustar() const
Return friction velocity.
Definition: atmBoundaryLayer.H:277
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::atmBoundaryLayer::Zref_
const scalar Zref_
Reference height.
Definition: atmBoundaryLayer.H:226