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 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 (unmodifiable)
104  type atmNutWallFunction;
105  z0Min 0.001;
106 
107  // Mandatory entries (runtime modifiable)
108  z0 uniform 0.001;
109 
110  // Optional (inherited) entries
111  ...
112  }
113  \endverbatim
114 
115  where the entries mean:
116  \table
117  Property | Description | Type | Reqd | Dflt
118  type | Type name: nutAtmWallFunction | word | yes | -
119  z0Min | Minimum surface roughness length [m] | scalar | yes | -
120  z0 | Surface roughness length [m] | PatchFunction1<scalar> | yes | -
121  \endtable
122 
123  The inherited entries are elaborated in:
124  - \link nutkWallFunctionFvPatchScalarField.H \endlink
125  - \link PatchFunction1.H \endlink
126 
127 See also
128  - Foam::nutkWallFunctionFvPatchScalarField
129  - Foam::atmNutkWallFunctionFvPatchScalarField
130  - Foam::atmNutUWallFunctionFvPatchScalarField
131 
132 SourceFiles
133  atmNutWallFunctionFvPatchScalarField.C
134 
135 \*---------------------------------------------------------------------------*/
136 
137 #ifndef atmNutWallFunctionFvPatchScalarField_H
138 #define atmNutWallFunctionFvPatchScalarField_H
139 
141 #include "PatchFunction1.H"
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 namespace Foam
146 {
147 
148 /*---------------------------------------------------------------------------*\
149  Class atmNutWallFunctionFvPatchScalarField Declaration
150 \*---------------------------------------------------------------------------*/
151 
152 class atmNutWallFunctionFvPatchScalarField
153 :
154  public nutkWallFunctionFvPatchScalarField
155 {
156 
157  // Private Data
158 
159  //- Minimum surface roughness length [m]
160  const scalar z0Min_;
161 
162  //- Surface roughness length field [m]
163  autoPtr<PatchFunction1<scalar>> z0_;
164 
165 
166 protected:
167 
168  // Protected Member Functions
169 
170  //- Calculate the turbulent viscosity
171  virtual tmp<scalarField> calcNut() const;
172 
173 
174 public:
175 
176  //- Runtime type information
177  TypeName("atmNutWallFunction");
178 
179 
180  // Constructors
181 
182  //- Construct from patch and internal field
184  (
185  const fvPatch&,
186  const DimensionedField<scalar, volMesh>&
187  );
188 
189  //- Construct from patch, internal field and dictionary
191  (
192  const fvPatch&,
193  const DimensionedField<scalar, volMesh>&,
194  const dictionary&
195  );
196 
197  //- Construct by mapping given
198  //- atmNutWallFunctionFvPatchScalarField
199  //- onto a new patch
201  (
203  const fvPatch&,
204  const DimensionedField<scalar, volMesh>&,
205  const fvPatchFieldMapper&
206  );
207 
208  //- Construct as copy
210  (
212  );
213 
214  //- Construct and return a clone
215  virtual tmp<fvPatchScalarField> clone() const
216  {
218  (
220  );
221  }
222 
223  //- Construct as copy setting internal field reference
225  (
228  );
229 
230  //- Construct and return a clone setting internal field reference
232  (
234  ) const
235  {
237  (
239  );
240  }
241 
242 
243  // Member Functions
244 
245  // Mapping
246 
247  //- Map (and resize as needed) from self given a mapping object
248  virtual void autoMap(const fvPatchFieldMapper&);
249 
250  //- Reverse map the given fvPatchField onto this fvPatchField
251  virtual void rmap
252  (
253  const fvPatchScalarField&,
254  const labelList&
255  );
256 
257 
258  // I-O
259 
260  //- Write
261  virtual void write(Ostream&) const;
262 };
263 
264 
265 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
266 
267 } // End namespace Foam
268 
269 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
270 
271 #endif
272 
273 // ************************************************************************* //
Foam::fvPatchField< scalar >
Foam::atmNutWallFunctionFvPatchScalarField::rmap
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: atmNutWallFunctionFvPatchScalarField.C:199
Foam::fvPatchScalarField
fvPatchField< scalar > fvPatchScalarField
Definition: fvPatchFieldsFwd.H:40
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
Foam::atmNutWallFunctionFvPatchScalarField::calcNut
virtual tmp< scalarField > calcNut() const
Calculate the turbulent viscosity.
Definition: atmNutWallFunctionFvPatchScalarField.C:43
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
PatchFunction1.H
Foam::atmNutWallFunctionFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: atmNutWallFunctionFvPatchScalarField.H:274
Foam::atmNutWallFunctionFvPatchScalarField::TypeName
TypeName("atmNutWallFunction")
Runtime type information.
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::atmNutWallFunctionFvPatchScalarField::atmNutWallFunctionFvPatchScalarField
atmNutWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: atmNutWallFunctionFvPatchScalarField.C:117
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::List< label >
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
nutkWallFunctionFvPatchScalarField.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::atmNutWallFunctionFvPatchScalarField
This boundary condition provides a wall constraint on the turbulent viscosity (i.e....
Definition: atmNutWallFunctionFvPatchScalarField.H:211
Foam::atmNutWallFunctionFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: atmNutWallFunctionFvPatchScalarField.C:213
Foam::atmNutWallFunctionFvPatchScalarField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: atmNutWallFunctionFvPatchScalarField.C:189
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::nutkWallFunctionFvPatchScalarField
This boundary condition provides a wall constraint on the turbulent viscosity, i.e....
Definition: nutkWallFunctionFvPatchScalarField.H:94