atmBoundaryLayer.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) 2014-2019 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::atmBoundaryLayer
26 
27 Description
28  This class provides functions to evaluate the velocity and turbulence
29  distributions appropriate for atmospheric boundary layers (ABL).
30 
31  The profile is derived from the friction velocity, flow direction and
32  "vertical" direction:
33 
34  \f[
35  U = \frac{U^*}{\kappa} ln\left(\frac{z - z_g + z_0}{z_0}\right)
36  \f]
37 
38  \f[
39  k = \frac{(U^*)^2}{\sqrt{C_mu}}
40  \f]
41 
42  \f[
43  \epsilon = \frac{(U^*)^3}{\kappa(z - z_g + z_0)}
44  \f]
45 
46  where
47  \vartable
48  U^* | Friction velocity
49  \kappa | von Karman's constant
50  C_mu | Turbulence viscosity coefficient
51  z | Vertical coordinate
52  z_0 | Surface roughness height [m]
53  z_g | Minimum z-coordinate [m]
54  \endvartable
55  and
56  \f[
57  U^* = \kappa\frac{U_{ref}}{ln\left(\frac{Z_{ref} + z_0}{z_0}\right)}
58  \f]
59  where
60  \vartable
61  U_{ref} | Reference velocity at \f$Z_{ref}\f$ [m/s]
62  Z_{ref} | Reference height [m]
63  \endvartable
64 
65  Use in the atmBoundaryLayerInletVelocity, atmBoundaryLayerInletK and
66  atmBoundaryLayerInletEpsilon boundary conditions.
67 
68  Reference:
69  D.M. Hargreaves and N.G. Wright, "On the use of the k-epsilon model
70  in commercial CFD software to model the neutral atmospheric boundary
71  layer", Journal of Wind Engineering and Industrial Aerodynamics
72  95(2007), pp 355-369.
73 
74 Usage
75  \table
76  Property | Description | Required | Default
77  flowDir | Flow direction | yes |
78  zDir | Vertical direction | yes |
79  kappa | von Karman's constant | no | 0.41
80  Cmu | Turbulence viscosity coefficient | no | 0.09
81  Uref | Reference velocity [m/s] | yes |
82  Zref | Reference height [m] | yes |
83  z0 | Surface roughness height [m] | yes |
84  zGround | Minimum z-coordinate [m] | yes |
85  Ulower | Velocity below the BL | no |
86  kLower | Turbulence k below the BL | no |
87  epsilonLower | Turbulence epsilon below the BL | no |
88  \endtable
89 
90  Example of the boundary condition specification:
91  \verbatim
92  ground
93  {
94  type atmBoundaryLayerInletVelocity;
95  flowDir (1 0 0);
96  zDir (0 0 1);
97  Uref 10.0;
98  Zref 20.0;
99  z0 uniform 0.1;
100  zGround uniform 0.0;
101  }
102  \endverbatim
103 
104 Note
105  D.M. Hargreaves and N.G. Wright recommend Gamma epsilon in the
106  k-epsilon model should be changed from 1.3 to 1.11 for consistency.
107  The roughness height (Er) is given by Er = 20 z0 following the same
108  reference.
109 
110 SourceFiles
111  atmBoundaryLayer.C
112 
113 \*---------------------------------------------------------------------------*/
114 
115 #ifndef atmBoundaryLayer_H
116 #define atmBoundaryLayer_H
117 
118 #include "fvPatchFields.H"
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 namespace Foam
123 {
124 
125 /*---------------------------------------------------------------------------*\
126  Class atmBoundaryLayer Declaration
127 \*---------------------------------------------------------------------------*/
128 
129 class atmBoundaryLayer
130 {
131  // Private static data
132 
133  //- Default value of the Von Karman constant
134  static const scalar kappaDefault_;
135 
136  //- Default value of the turbulent viscosity coefficient
137  static const scalar CmuDefault_;
138 
139 
140  // Private Data
141 
142  //- Flow direction
143  vector flowDir_;
144 
145  //- Direction of the z-coordinate
146  vector zDir_;
147 
148  //- Von Karman constant
149  const scalar kappa_;
150 
151  //- Turbulent viscosity coefficient
152  const scalar Cmu_;
153 
154  //- Reference velocity
155  const scalar Uref_;
156 
157  //- Reference height
158  const scalar Zref_;
159 
160  //- Surface roughness height
161  scalarField z0_;
162 
163  //- Minimum coordinate value in z direction
164  scalarField zGround_;
165 
166  //- Friction velocity
167  scalarField Ustar_;
168 
169  //- True if the boundary layer is offset within the domain
170  bool offset_;
171 
172  //- Velocity of the flow below the boundary layer
173  const scalar Ulower_;
174 
175  //- Turbulence kinetic energy of the flow below the boundary layer
176  const scalar kLower_;
177 
178  //- Turbulence kinetic energy dissipation rate of the flow below the
179  // boundary layer
180  const scalar epsilonLower_;
181 
182 
183  // Private Member Functions
184 
185  //- Initialisation shared by multiple constructors
186  void init();
187 
188 
189 public:
190 
191  // Constructors
192 
193  //- Construct null
195 
196  //- Construct from components
198  (
199  const vector& flowDir,
200  const vector& zDir,
201  const scalar Uref,
202  const scalar Zref,
203  const scalarField& z0,
204  const scalarField& zGround,
205  const scalar kappa = kappaDefault_,
206  const scalar Cmu = CmuDefault_,
207  const scalar ULower = 0,
208  const scalar kLower = 0,
209  const scalar epsilonLower = 0
210  );
211 
212  //- Construct from the coordinates field and dictionary
214 
215  //- Construct by mapping given
216  // atmBoundaryLayer onto a new patch
218  (
219  const atmBoundaryLayer&,
221  );
222 
223  //- Copy constructor
225 
226 
227  // Member Functions
228 
229  // Access
230 
231  //- Return flow direction
232  const vector& flowDir() const
233  {
234  return flowDir_;
235  }
236 
237  //- Return z-direction
238  const vector& zDir() const
239  {
240  return zDir_;
241  }
242 
243  //- Return friction velocity
244  const scalarField& Ustar() const
245  {
246  return Ustar_;
247  }
248 
249 
250  // Mapping functions
251 
252  //- Map (and resize as needed) from self given a mapping object
253  void autoMap(const fvPatchFieldMapper&);
254 
255  //- Reverse map the given fvPatchField onto this fvPatchField
256  void rmap(const atmBoundaryLayer&, const labelList&);
257 
258 
259  // Evaluate functions
260 
261  //- Return the velocity distribution for the ATM
262  tmp<vectorField> U(const vectorField& p) const;
263 
264  //- Return the turbulent kinetic energy distribution for the ATM
265  tmp<scalarField> k(const vectorField& p) const;
266 
267  //- Return the turbulent dissipation rate distribution for the ATM
268  tmp<scalarField> epsilon(const vectorField& p) const;
269 
270 
271  //- Write
272  void write(Ostream&) const;
273 };
274 
275 
276 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 
278 } // End namespace Foam
279 
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281 
282 #endif
283 
284 // ************************************************************************* //
This class provides functions to evaluate the velocity and turbulence distributions appropriate for a...
tmp< scalarField > epsilon(const vectorField &p) const
Return the turbulent dissipation rate distribution for the ATM.
const vector & flowDir() const
Return flow direction.
void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
const vector & zDir() const
Return z-direction.
tmp< vectorField > U(const vectorField &p) const
Return the velocity distribution for the ATM.
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
tmp< scalarField > k(const vectorField &p) const
Return the turbulent kinetic energy distribution for the ATM.
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
const scalarField & Ustar() const
Return friction velocity.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Foam::fvPatchFieldMapper.
void write(Ostream &) const
Write.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
void rmap(const atmBoundaryLayer &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
volScalarField & p
A class for managing temporary objects.
Definition: PtrList.H:53
atmBoundaryLayer()
Construct null.
Namespace for OpenFOAM.