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 |
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
135  vector flowDir_;
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
153  scalarField z0_;
154 
155  //- Minimum coordinate value in z direction
156  scalarField zGround_;
157 
158  //- Friction velocity
159  scalarField Ustar_;
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 
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 // ************************************************************************* //
tmp< vectorField > U(const vectorField &p) const
Return the velocity distribution for the ATM.
tmp< scalarField > epsilon(const vectorField &p) const
Return the turbulent dissipation rate distribution for the ATM.
const scalarField & Ustar() const
Return friction velocity.
Foam::fvPatchFieldMapper.
const vector & zDir() const
Return z-direction.
void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
tmp< scalarField > k(const vectorField &p) const
Return the turbulent kinetic energy distribution for the ATM.
const vector & flowDir() const
Return flow direction.
volScalarField & p
Definition: createFields.H:51
Field< vector > vectorField
Specialisation of Field<T> for vector.
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.
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
atmBoundaryLayer()
Construct null.
void write(Ostream &) const
Write.
A class for managing temporary objects.
Definition: PtrList.H:118
This class provides functions to evaluate the velocity and turbulence distributions appropriate for a...