atmNutWallFunctionFvPatchScalarField.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) 2020 CENER
9  Copyright (C) 2020-2022 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::atmNutWallFunctionFvPatchScalarField
29 
30 Group
31  grpAtmWallFunctions
32 
33 Description
34  This boundary condition provides a wall constraint on the turbulent
35  viscosity (i.e. \c nut) based on the turbulent kinetic energy (i.e. \c k)
36  and velocity (i.e. \c U) for atmospheric boundary layer modelling.
37 
38  The governing equation of the boundary condition:
39 
40  \f[
41  \tau_w = {U^*_u} {U^*_k}
42  \f]
43 
44  with
45 
46  \f[
47  {U^*_u} = \frac{\kappa U_w}{ln(z_p / z_0)}
48  \f]
49 
50  \f[
51  {U^*_k} = C_{\mu}^{1/4} \sqrt{k}
52  \f]
53 
54  where
55  \vartable
56  \tau_w | wall shear stress
57  U^*_u | local friction velocity based on near-ground velocity
58  U^*_k | local friction velocity based on near-ground k
59  \kappa | von Kármán constant
60  U_w | near-ground velocity
61  z_p | vertical coordinate
62  z_0 | surface roughness length [m]
63  C_mu | empirical model constant
64  k | turbulent kinetic energy
65  \endvartable
66 
67  References:
68  \verbatim
69  Theoretical expressions (tags:RH, SBJM, SM):
70  Richards, P. J., & Hoxey, R. P. (1993).
71  Appropriate boundary conditions for computational wind
72  engineering models using the k-ε turbulence model.
73  In Computational Wind Engineering 1 (pp. 145-153).
74  DOI:10.1016/B978-0-444-81688-7.50018-8
75 
76  Sørensen, N. N., Bechmann, A., Johansen, J., Myllerup, L.,
77  Botha, P., Vinther, S., & Nielsen, B. S. (2007).
78  Identification of severe wind conditions using
79  a Reynolds Averaged Navier-Stokes solver.
80  In Journal of Physics: Conference
81  series (Vol. 75, No. 1, p. 012053).
82  DOI:10.1088/1742-6596/75/1/012053
83 
84  Sumner, J., & Masson, C. (2012).
85  k−ε simulations of the neutral atmospheric boundary layer:
86  analysis and correction of discretization errors on practical grids.
87  International journal for numerical
88  methods in fluids, 70(6), 724-741.
89  DOI:10.1002/fld.2709
90  \endverbatim
91 
92  Required fields:
93  \verbatim
94  nut | Turbulent viscosity [m2/s]
95  k | Turbulent kinetic energy [m2/s2]
96  \endverbatim
97 
98 Usage
99  Example of the boundary condition specification:
100  \verbatim
101  <patchName>
102  {
103  // Mandatory entries
104  type atmNutWallFunction;
105  z0Min <scalar>;
106  z0 <PatchFunction1<scalar>>;
107 
108  // Inherited entries
109  ...
110  }
111  \endverbatim
112 
113  where the entries mean:
114  \table
115  Property | Description | Type | Reqd | Deflt
116  type | Type name: nutAtmWallFunction | word | yes | -
117  z0Min | Minimum surface roughness length [m] | scalar | yes | -
118  z0 | Surface roughness length [m] | PatchFunction1<scalar> | yes | -
119  \endtable
120 
121  The inherited entries are elaborated in:
122  - \link nutkWallFunctionFvPatchScalarField.H \endlink
123  - \link PatchFunction1.H \endlink
124 
125 SourceFiles
126  atmNutWallFunctionFvPatchScalarField.C
127 
128 \*---------------------------------------------------------------------------*/
129 
130 #ifndef atmNutWallFunctionFvPatchScalarField_H
131 #define atmNutWallFunctionFvPatchScalarField_H
132 
134 #include "PatchFunction1.H"
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 namespace Foam
139 {
140 
141 /*---------------------------------------------------------------------------*\
142  Class atmNutWallFunctionFvPatchScalarField Declaration
143 \*---------------------------------------------------------------------------*/
144 
145 class atmNutWallFunctionFvPatchScalarField
146 :
147  public nutkWallFunctionFvPatchScalarField
148 {
149 
150  // Private Data
151 
152  //- Minimum surface roughness length [m]
153  const scalar z0Min_;
154 
155  //- Surface roughness length field [m]
156  autoPtr<PatchFunction1<scalar>> z0_;
157 
158 
159 protected:
160 
161  // Protected Member Functions
162 
163  //- Calculate the turbulent viscosity
164  virtual tmp<scalarField> calcNut() const;
165 
166  //- Write local wall function variables
167  void writeLocalEntries(Ostream&) const;
168 
169 
170 public:
171 
172  //- Runtime type information
173  TypeName("atmNutWallFunction");
174 
175 
176  // Constructors
177 
178  //- Construct from patch and internal field
180  (
181  const fvPatch&,
182  const DimensionedField<scalar, volMesh>&
183  );
184 
185  //- Construct from patch, internal field and dictionary
187  (
188  const fvPatch&,
189  const DimensionedField<scalar, volMesh>&,
190  const dictionary&
191  );
192 
193  //- Construct by mapping given
194  //- atmNutWallFunctionFvPatchScalarField
195  //- onto a new patch
197  (
199  const fvPatch&,
201  const fvPatchFieldMapper&
202  );
203 
204  //- Construct as copy
206  (
208  );
209 
210  //- Construct and return a clone
211  virtual tmp<fvPatchScalarField> clone() const
212  {
214  (
216  );
217  }
218 
219  //- Construct as copy setting internal field reference
221  (
224  );
225 
226  //- Construct and return a clone setting internal field reference
228  (
230  ) const
231  {
233  (
235  );
236  }
237 
238 
239  // Member Functions
240 
241  // Mapping
242 
243  //- Map (and resize as needed) from self given a mapping object
244  virtual void autoMap(const fvPatchFieldMapper&);
245 
246  //- Reverse map the given fvPatchField onto this fvPatchField
247  virtual void rmap
248  (
249  const fvPatchScalarField&,
250  const labelList&
251  );
252 
253 
254  // I-O
255 
256  //- Write
257  virtual void write(Ostream&) const;
258 };
259 
260 
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
262 
263 } // End namespace Foam
264 
265 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
266 
267 #endif
268 
269 // ************************************************************************* //
atmNutWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
virtual tmp< scalarField > calcNut() const
Calculate the turbulent viscosity.
fvPatchField< scalar > fvPatchScalarField
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
A FieldMapper for finite-volume patch fields.
This boundary condition provides a wall constraint on the turbulent viscosity (i.e. nut) based on the turbulent kinetic energy (i.e. k) and velocity (i.e. U) for atmospheric boundary layer modelling.
void writeLocalEntries(Ostream &) const
Write local wall function variables.
TypeName("atmNutWallFunction")
Runtime type information.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
List< label > labelList
A List of labels.
Definition: List.H:62
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Namespace for OpenFOAM.