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-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::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  \endtable
86 
87  Example of the boundary condition specification:
88  \verbatim
89  ground
90  {
91  type atmBoundaryLayerInletVelocity;
92  flowDir (1 0 0);
93  zDir (0 0 1);
94  Uref 10.0;
95  Zref 20.0;
96  z0 uniform 0.1;
97  zGround uniform 0.0;
98  }
99  \endverbatim
100 
101 Note
102  D.M. Hargreaves and N.G. Wright recommend Gamma epsilon in the
103  k-epsilon model should be changed from 1.3 to 1.11 for consistency.
104  The roughness height (Er) is given by Er = 20 z0 following the same
105  reference.
106 
107 SourceFiles
108  atmBoundaryLayer.C
109 
110 \*---------------------------------------------------------------------------*/
111 
112 #ifndef atmBoundaryLayer_H
113 #define atmBoundaryLayer_H
114 
115 #include "fvPatchFields.H"
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 namespace Foam
120 {
121 
122 /*---------------------------------------------------------------------------*\
123  Class atmBoundaryLayer Declaration
124 \*---------------------------------------------------------------------------*/
125 
126 class atmBoundaryLayer
127 {
128  // Private data
129 
130  //- Flow direction
131  vector flowDir_;
132 
133  //- Direction of the z-coordinate
134  vector zDir_;
135 
136  //- Von Karman constant
137  const scalar kappa_;
138 
139  //- Turbulent viscosity coefficient
140  const scalar Cmu_;
141 
142  //- Reference velocity
143  const scalar Uref_;
144 
145  //- Reference height
146  const scalar Zref_;
147 
148  //- Surface roughness height
149  scalarField z0_;
150 
151  //- Minimum coordinate value in z direction
152  scalarField zGround_;
153 
154  //- Friction velocity
155  scalarField Ustar_;
156 
157 
158 public:
159 
160  // Constructors
161 
162  //- Construct null
164 
165  //- Construct from the coordinates field and dictionary
166  atmBoundaryLayer(const vectorField& p, const dictionary&);
167 
168  //- Construct by mapping given
169  // atmBoundaryLayer onto a new patch
171  (
172  const atmBoundaryLayer&,
173  const fvPatchFieldMapper&
174  );
175 
176  //- Construct as copy
178 
179 
180  // Member functions
181 
182  // Access
183 
184  //- Return flow direction
185  const vector& flowDir() const
186  {
187  return flowDir_;
188  }
189 
190  //- Return z-direction
191  const vector& zDir() const
192  {
193  return zDir_;
194  }
195 
196  //- Return friction velocity
197  const scalarField& Ustar() const
198  {
199  return Ustar_;
200  }
201 
203  // Mapping functions
204 
205  //- Map (and resize as needed) from self given a mapping object
206  void autoMap(const fvPatchFieldMapper&);
207 
208  //- Reverse map the given fvPatchField onto this fvPatchField
209  void rmap(const atmBoundaryLayer&, const labelList&);
210 
211 
212  // Evaluate functions
213 
214  //- Return the velocity distribution for the ATM
215  tmp<vectorField> U(const vectorField& p) const;
216 
217  //- Return the turbulent kinetic energy distribution for the ATM
218  tmp<scalarField> k(const vectorField& p) const;
219 
220  //- Return the turbulent dissipation rate distribution for the ATM
221  tmp<scalarField> epsilon(const vectorField& p) const;
222 
223 
224  //- Write
225  void write(Ostream&) const;
226 };
227 
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 } // End namespace Foam
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
This class provides functions to evaluate the velocity and turbulence distributions appropriate for a...
const vector & flowDir() const
Return flow direction.
void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
const vector & zDir() const
Return z-direction.
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
const scalarField & Ustar() const
Return friction velocity.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
tmp< vectorField > U(const vectorField &p) const
Return the velocity distribution for the ATM.
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
tmp< scalarField > epsilon(const vectorField &p) const
Return the turbulent dissipation rate distribution for the ATM.
void rmap(const atmBoundaryLayer &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Field< vector > vectorField
Specialisation of Field<T> for vector.
volScalarField & p
A class for managing temporary objects.
Definition: PtrList.H:53
tmp< scalarField > k(const vectorField &p) const
Return the turbulent kinetic energy distribution for the ATM.
atmBoundaryLayer()
Construct null.
Namespace for OpenFOAM.