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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2014-2018 OpenFOAM Foundation
9  Copyright (C) 2015-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::atmBoundaryLayer
29 
30 Group
31  grpRASBoundaryConditions grpInletBoundaryConditions
32 
33 Description
34  Base class to set log-law type ground-normal inlet boundary conditions for
35  wind velocity and turbulence quantities for homogeneous, two-dimensional,
36  dry-air, equilibrium and neutral atmospheric boundary layer (ABL) modelling.
37 
38  The ground-normal profile expressions are due to \c YGCJ
39  (refer to references below) whereat \c RH expressions were generalised:
40 
41  \f[
42  u = \frac{u^*}{\kappa} \ln \left( \frac{z - d + z_0}{z_0} \right)
43  \f]
44 
45  \f[
46  v = w = 0
47  \f]
48 
49  \f[
50  k = \frac{(u^*)^2}{\sqrt{C_\mu}}
51  \sqrt{C_1 \ln \left( \frac{z - d + z_0}{z_0} \right) + C_2}
52  \f]
53 
54  \f[
55  \epsilon = \frac{(u^*)^3}{\kappa (z - d + z_0)}
56  \sqrt{C_1 \ln \left( \frac{z - d + z_0}{z_0} \right) + C_2}
57  \f]
58 
59  \f[
60  \omega = \frac{u^*}{\kappa \sqrt{C_\mu}} \frac{1}{z - d + z_0}
61  \f]
62 
63  \f[
64  u^* =
65  \frac{u_{ref} \kappa}{\ln\left(\frac{z_{ref} + z_0}{z_0}\right)}
66  \f]
67 
68  where
69  \vartable
70  u | Ground-normal streamwise flow speed profile [m/s]
71  v | Spanwise flow speed [m/s]
72  w | Ground-normal flow speed [m/s]
73  k | Ground-normal turbulent kinetic energy (TKE) profile [m^2/s^2]
74  \epsilon | Ground-normal TKE dissipation rate profile [m^2/s^3]
75  \omega | Ground-normal specific dissipation rate profile [m^2/s^3]
76  u^* | Friction velocity [m/s]
77  \kappa | von Kármán constant [-]
78  C_\mu | Empirical model constant [-]
79  z | Ground-normal coordinate component [m]
80  d | Ground-normal displacement height [m]
81  z_0 | Aerodynamic roughness length [m]
82  u_{ref} | Reference mean streamwise wind speed at \f$z_{ref}\f$ [m/s]
83  z_{ref} | Reference height being used in \f$u^*\f$ estimations [m]
84  C_1 | Curve-fitting coefficient for \c YGCJ profiles [-]
85  C_2 | Curve-fitting coefficient for \c YGCJ profiles [-]
86  \endvartable
87 
88  Reference:
89  \verbatim
90  The ground-normal profile expressions (tag:RH):
91  Richards, P. J., & Hoxey, R. P. (1993).
92  Appropriate boundary conditions for computational wind
93  engineering models using the k-ε turbulence model.
94  In Computational Wind Engineering 1 (pp. 145-153).
95  DOI:10.1016/B978-0-444-81688-7.50018-8
96 
97  Modifications to preserve the profiles downstream (tag:HW):
98  Hargreaves, D. M., & Wright, N. G. (2007).
99  On the use of the k–ε model in commercial CFD software
100  to model the neutral atmospheric boundary layer.
101  Journal of wind engineering and
102  industrial aerodynamics, 95(5), 355-369.
103  DOI:10.1016/j.jweia.2006.08.002
104 
105  Expression generalisations to allow height
106  variation for turbulence quantities (tag:YGCJ):
107  Yang, Y., Gu, M., Chen, S., & Jin, X. (2009).
108  New inflow boundary conditions for modelling the neutral equilibrium
109  atmospheric boundary layer in computational wind engineering.
110  J. of Wind Engineering and Industrial Aerodynamics, 97(2), 88-95.
111  DOI:10.1016/j.jweia.2008.12.001
112 
113  The generalised ground-normal profile expression for omega (tag:YGJ):
114  Yang, Y., Gu, M., & Jin, X., (2009).
115  New inflow boundary conditions for modelling the
116  neutral equilibrium atmospheric boundary layer in SST k-ω model.
117  In: The Seventh Asia-Pacific Conference on Wind Engineering,
118  November 8-12, Taipei, Taiwan.
119 
120  Theoretical remarks (tag:E):
121  Emeis, S. (2013).
122  Wind Energy Meteorology: Atmospheric
123  Physics for Wind Power Generation.
124  Springer-Verlag Berlin Heidelberg.
125  DOI:10.1007/978-3-642-30523-8
126  \endverbatim
127 
128 Usage
129  Example of the entries provided for the inherited boundary conditions:
130  \verbatim
131  inlet
132  {
133  // Mandatory and other optional entries
134  ...
135 
136  // Mandatory (inherited) entries (runtime modifiable)
137  flowDir (1 0 0);
138  zDir (0 0 1);
139  Uref 10.0;
140  Zref 0.0;
141  z0 uniform 0.1;
142  d uniform 0.0;
143 
144  // Optional (inherited) entries (unmodifiable)
145  kappa 0.41;
146  Cmu 0.09;
147  initABL true;
148  phi phi;
149  C1 0.0;
150  C2 1.0;
151 
152  // Conditional mandatory (inherited) entries (runtime modifiable)
153  value uniform 0; // when initABL=false
154  }
155  \endverbatim
156 
157  where the entries mean:
158  \table
159  Property | Description | Type | Reqd | Deflt
160  flowDir | Flow direction | TimeFunction1<vector> | yes | -
161  zDir | Ground-normal direction | TimeFunction1<vector> | yes | -
162  Uref | Reference mean streamwise flow speed being used in <!--
163  --> \f$u^*\f$ estimations [m/s] | TimeFunction1<scalar> | yes | -
164  Zref | Reference height being used in \f$u^*\f$ estimations [m] <!--
165  --> | TimeFunction1<scalar> | yes | -
166  z0 | Surface roughness length [m] <!--
167  --> | PatchFunction1<scalar> | yes | -
168  d | Displacement height [m] - see Notes <!--
169  --> | PatchFunction1<scalar> | yes | -
170  kappa | von Kármán constant | scalar | no | 0.41
171  Cmu | Empirical model constant | scalar | no | 0.09
172  initABL | Flag to initialise profiles with the theoretical <!--
173  --> ABL expressions, otherwise use "value" list <!--
174  --> | bool | no | true
175  value | ABL profile content when initABL=false <!--
176  --> | scalarList | conditional | -
177  phi | Name of the flux field | word | no | phi
178  C1 | Curve-fitting coefficient \c YGCJ profiles | scalar | no | 0.0
179  C2 | Curve-fitting coefficient \c YGCJ profiles | scalar | no | 1.0
180  \endtable
181 
182 Note
183  - The \c RH expressions are special cases of those in \c YGCJ when \c C1=0
184  and \c C2=1. Both \c C1 and \c C2 can be determined by nonlinear fitting
185  of (\c YGCJ:Eqs. 19-20) with an experimental dataset for \c k. By default,
186  \c atmBoundaryLayerInlet boundary conditions compute \c RH expressions.
187  - \c z is the ground-normal height relative to the global minimum height
188  of the inlet patch; therefore, the minimum of \c z is always zero
189  irrespective of the absolute z-coordinate of the computational patch.
190  - The derived ABL expressions automatically satisfy the simplified transport
191  equation for \c k. Yet the same expressions only satisfy the simplified
192  transport equation for \c epsilon when the model constants \c sigmaEpsilon
193  is 1.11 with \c kappa=0.4 (\c HW:p. 358).
194  - \c atmBoundaryLayerInlet boundary conditions inherit \c inletOutlet
195  traits, so that a given inlet condition can be supplied from all sides of
196  the domain, e.g. a ground-normal cylinder domain having a single
197  inlet/outlet boundary where the changes between inlet and outlet depend
198  on the wind direction and patch normals, so that any change in inflow
199  orientation can be handled with the same mesh.
200  - \c d is the displacement height, and "is relevant for flows over forests
201  and cities" (E:p. 28). "The displacement height gives the vertical
202  displacement of the entire flow regime over areas which are densely covered
203  with obstacles such as trees or buildings" (E:p. 28).
204 
205 See also
206  - Foam::atmBoundaryLayerInletVelocityFvPatchVectorField
207  - Foam::atmBoundaryLayerInletKFvPatchScalarField
208  - Foam::atmBoundaryLayerInletEpsilonFvPatchScalarField
209  - Foam::atmBoundaryLayerInletOmegaFvPatchScalarField
210 
211 SourceFiles
212  atmBoundaryLayer.C
213 
214 \*---------------------------------------------------------------------------*/
215 
216 #ifndef atmBoundaryLayer_H
217 #define atmBoundaryLayer_H
218 
219 #include "fvPatchFields.H"
220 #include "TimeFunction1.H"
221 #include "PatchFunction1.H"
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 namespace Foam
226 {
227 
228 /*---------------------------------------------------------------------------*\
229  Class atmBoundaryLayer Declaration
230 \*---------------------------------------------------------------------------*/
231 
232 class atmBoundaryLayer
233 {
234 protected:
235 
236  // Protected Data
237 
238  //- Flag to initialise profiles with the theoretical ABL expressions,
239  //- otherwise initialises by using "value" entry content
240  bool initABL_;
241 
242 
243 private:
244 
245  // Private Data
246 
247  //- von Kármán constant
248  const scalar kappa_;
249 
250  //- Empirical model constant
251  const scalar Cmu_;
252 
253  //- Curve-fitting coefficient
254  const scalar C1_;
255 
256  //- Curve-fitting coefficient
257  const scalar C2_;
258 
259  //- Minimum coordinate vector of this patch
260  const vector ppMin_;
261 
262  //- Reference to the time database
263  const Time& time_;
264 
265  //- Reference to the patch
266  const polyPatch& patch_;
267 
268  //- Streamwise flow direction
269  TimeFunction1<vector> flowDir_;
270 
271  //- Direction of the ground-normal coordinate
272  TimeFunction1<vector> zDir_;
273 
274  //- Reference mean streamwise flow speed being used in Ustar estimations
275  TimeFunction1<scalar> Uref_;
276 
277  //- Reference height being used in Ustar estimations
278  TimeFunction1<scalar> Zref_;
279 
280  //- Surface roughness length
281  autoPtr<PatchFunction1<scalar>> z0_;
282 
283  //- Displacement height
284  autoPtr<PatchFunction1<scalar>> d_;
285 
286 
287 public:
288 
289  // Constructors
290 
291  //- Construct null from time
292  atmBoundaryLayer(const Time& time, const polyPatch& pp);
293 
294  //- Construct from the time database and dictionary
296  (
297  const Time& time,
298  const polyPatch& pp,
299  const dictionary& dict
300  );
301 
302  //- Construct by mapping given atmBoundaryLayer onto a new patch
304  (
305  const atmBoundaryLayer& abl,
306  const fvPatch& patch,
307  const fvPatchFieldMapper& mapper
308  );
309 
310  //- Construct as copy
312 
313 
314  // Member Functions
315 
316  // Access
317 
318  //- Return flow direction
319  vector flowDir() const;
320 
321  //- Return the ground-normal direction
322  vector zDir() const;
323 
324  //- Return friction velocity
325  tmp<scalarField> Ustar(const scalarField& z0) const;
326 
327 
328  // Mapping
329 
330  //- Map (and resize as needed) from self given a mapping object
331  void autoMap(const fvPatchFieldMapper&);
332 
333  //- Reverse map the given fvPatchField onto this fvPatchField
334  void rmap(const atmBoundaryLayer&, const labelList&);
335 
336 
337  // Evaluation
338 
339  //- Return the velocity distribution for the ATM
340  tmp<vectorField> U(const vectorField& pCf) const;
341 
342  //- Return the turbulent kinetic energy distribution for the ATM
343  tmp<scalarField> k(const vectorField& pCf) const;
344 
345  //- Return the turbulent dissipation rate distribution for the ATM
346  tmp<scalarField> epsilon(const vectorField& pCf) const;
347 
348  //- Return the specific dissipation rate distribution for the ATM
349  tmp<scalarField> omega(const vectorField& pCf) const;
350 
351 
352  //- Write
353  void write(Ostream&) const;
354 };
355 
356 
357 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
358 
359 } // End namespace Foam
360 
361 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
362 
363 #endif
364 
365 // ************************************************************************* //
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:71
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
Foam::atmBoundaryLayer::Ustar
tmp< scalarField > Ustar(const scalarField &z0) const
Return friction velocity.
Definition: atmBoundaryLayer.C:165
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
PatchFunction1.H
Foam::atmBoundaryLayer
Base class to set log-law type ground-normal inlet boundary conditions for wind velocity and turbulen...
Definition: atmBoundaryLayer.H:393
Foam::TimeFunction1
Light wrapper around Function1 to provide a mechanism to update time-based entries.
Definition: ConeNozzleInjection.H:80
Foam::atmBoundaryLayer::flowDir
vector flowDir() const
Return flow direction.
Definition: atmBoundaryLayer.C:129
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:54
Foam::atmBoundaryLayer::k
tmp< scalarField > k(const vectorField &pCf) const
Return the turbulent kinetic energy distribution for the ATM.
Definition: atmBoundaryLayer.C:218
Foam::atmBoundaryLayer::initABL_
bool initABL_
Definition: atmBoundaryLayer.H:401
Foam::atmBoundaryLayer::U
tmp< vectorField > U(const vectorField &pCf) const
Return the velocity distribution for the ATM.
Definition: atmBoundaryLayer.C:201
Foam::atmBoundaryLayer::write
void write(Ostream &) const
Write.
Definition: atmBoundaryLayer.C:258
Foam::Field< scalar >
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::atmBoundaryLayer::omega
tmp< scalarField > omega(const vectorField &pCf) const
Return the specific dissipation rate distribution for the ATM.
Definition: atmBoundaryLayer.C:246
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::atmBoundaryLayer::atmBoundaryLayer
atmBoundaryLayer(const Time &time, const polyPatch &pp)
Construct null from time.
Definition: atmBoundaryLayer.C:38
Foam::atmBoundaryLayer::epsilon
tmp< scalarField > epsilon(const vectorField &pCf) const
Return the turbulent dissipation rate distribution for the ATM.
Definition: atmBoundaryLayer.C:232
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
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:183
Foam::List< label >
Foam::atmBoundaryLayer::zDir
vector zDir() const
Return the ground-normal direction.
Definition: atmBoundaryLayer.C:147
Foam::atmBoundaryLayer::rmap
void rmap(const atmBoundaryLayer &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: atmBoundaryLayer.C:191
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
TimeFunction1.H