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-2016 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 Usage
78  \table
79  Property | Description | Required | Default
80  flowDir | Flow direction | yes |
81  zDir | Vertical direction | yes |
82  kappa | von Karman's constant | no | 0.41
83  Cmu | Turbulence viscosity coefficient | no | 0.09
84  Uref | Reference velocity [m/s] | yes |
85  Zref | Reference height [m] | yes |
86  z0 | Surface roughness height [m] | yes |
87  zGround | Minimum z-coordinate [m] | yes |
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 data
132 
133  //- Flow direction
134  vector flowDir_;
135 
136  //- Direction of the z-coordinate
137  vector zDir_;
138 
139  //- Von Karman constant
140  const scalar kappa_;
141 
142  //- Turbulent viscosity coefficient
143  const scalar Cmu_;
144 
145  //- Reference velocity
146  const scalar Uref_;
147 
148  //- Reference height
149  const scalar Zref_;
150 
151  //- Surface roughness height
152  scalarField z0_;
153 
154  //- Minimum coordinate value in z direction
155  scalarField zGround_;
156 
157  //- Friction velocity
158  scalarField Ustar_;
159 
160 
161 public:
162 
163  // Constructors
164 
165  //- Construct null
167 
168  //- Construct from the coordinates field and dictionary
169  atmBoundaryLayer(const vectorField& p, const dictionary&);
170 
171  //- Construct by mapping given
172  // atmBoundaryLayer onto a new patch
174  (
175  const atmBoundaryLayer&,
176  const fvPatchFieldMapper&
177  );
178 
179  //- Construct as copy
181 
182 
183  // Member functions
184 
185  // Access
186 
187  //- Return flow direction
188  const vector& flowDir() const
189  {
190  return flowDir_;
191  }
192 
193  //- Return z-direction
194  const vector& zDir() const
195  {
196  return zDir_;
197  }
198 
199  //- Return friction velocity
200  const scalarField& Ustar() const
201  {
202  return Ustar_;
203  }
204 
206  // Mapping functions
207 
208  //- Map (and resize as needed) from self given a mapping object
209  void autoMap(const fvPatchFieldMapper&);
210 
211  //- Reverse map the given fvPatchField onto this fvPatchField
212  void rmap(const atmBoundaryLayer&, const labelList&);
213 
214 
215  // Evaluate functions
216 
217  //- Return the velocity distribution for the ATM
218  tmp<vectorField> U(const vectorField& p) const;
219 
220  //- Return the turbulent kinetic energy distribution for the ATM
221  tmp<scalarField> k(const vectorField& p) const;
222 
223  //- Return the turbulent dissipation rate distribution for the ATM
224  tmp<scalarField> epsilon(const vectorField& p) const;
225 
226 
227  //- Write
228  void write(Ostream&) const;
229 };
230 
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 } // End namespace Foam
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 #endif
239 
240 // ************************************************************************* //
This class provides functions to evaluate the velocity and turbulence distributions appropriate for a...
tmp< vectorField > U(const vectorField &p) const
Return the velocity distribution for the ATM.
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
void write(Ostream &) const
Write.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Foam::fvPatchFieldMapper.
tmp< scalarField > epsilon(const vectorField &p) const
Return the turbulent dissipation rate distribution for the ATM.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
const vector & flowDir() const
Return flow direction.
const scalarField & Ustar() const
Return friction velocity.
tmp< scalarField > k(const vectorField &p) const
Return the turbulent kinetic energy 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:54
atmBoundaryLayer()
Construct null.
Namespace for OpenFOAM.