atmNutkWallFunctionFvPatchScalarField.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2020 ENERCON GmbH
10  Copyright (C) 2020 OpenCFD Ltd.
11 -------------------------------------------------------------------------------
12 License
13  This file is part of OpenFOAM.
14 
15  OpenFOAM is free software: you can redistribute it and/or modify it
16  under the terms of the GNU General Public License as published by
17  the Free Software Foundation, either version 3 of the License, or
18  (at your option) any later version.
19 
20  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27 
28 Class
29  Foam::atmNutkWallFunctionFvPatchScalarField
30 
31 Group
32  grpAtmWallFunctions
33 
34 Description
35  This boundary condition provides a wall constraint on the turbulent
36  viscosity (i.e. \c nut) based on the turbulent kinetic energy (i.e. \c k)
37  for atmospheric boundary layer modelling. It is designed to be used in
38  conjunction with the \c atmBoundaryLayerInletVelocity boundary condition.
39 
40  The governing equation of the boundary condition:
41 
42  \f[
43  u = \frac{u^*}{\kappa} ln \left(\frac{z + z_0}{z_0}\right)
44  \f]
45 
46  where
47  \vartable
48  u^* | Friction velocity
49  \kappa | von Kármán constant
50  z_0 | Surface roughness length [m]
51  z | Ground-normal coordinate
52  \endvartable
53 
54  Required fields:
55  \verbatim
56  nut | Turbulent viscosity [m2/s]
57  k | Turbulent kinetic energy [m2/s2]
58  \endverbatim
59 
60  References:
61  \verbatim
62  Theoretical expressions (tag:HW):
63  Hargreaves, D. M., & Wright, N. G. (2007).
64  On the use of the k–ε model in commercial CFD software to model
65  the neutral atmospheric boundary layer.
66  J. of wind engineering and industrial aerodynamics, 95(5), 355-369.
67  DOI:10.1016/j.jweia.2006.08.002
68  \endverbatim
69 
70  Required fields:
71  \verbatim
72  nut | Turbulent viscosity [m2/s]
73  k | Turbulent kinetic energy [m2/s2]
74  \endverbatim
75 
76 Usage
77  Example of the boundary condition specification:
78  \verbatim
79  <patchName>
80  {
81  // Mandatory entries (unmodifiable)
82  type atmNutkWallFunction;
83 
84  // Mandatory entries (runtime modifiable)
85  z0 uniform 0.001;
86 
87  // Optional entries (unmodifiable)
88  boundNut false;
89 
90  // Optional (inherited) entries
91  ...
92  }
93  \endverbatim
94 
95  where the entries mean:
96  \table
97  Property | Description | Type | Reqd | Dflt
98  type | Type name: atmNutkWallFunction | word | yes | -
99  z0 | Surface roughness length [m] | PatchFunction1<scalar> | yes | -
100  boundNut | Flag to zero-bound nut near wall | bool | no | false
101  \endtable
102 
103  The inherited entries are elaborated in:
104  - \link nutkWallFunctionFvPatchScalarField.H \endlink
105  - \link PatchFunction1.H \endlink
106 
107 Note
108  - \c boundNut entry is set \c false for backward compatibility reasons.
109  - \c nutkAtmRoughWallFunction was renamed to \c atmNutkWallFunction.
110 
111 See also
112  - Foam::nutkWallFunctionFvPatchField
113 
114 SourceFiles
115  atmNutkWallFunctionFvPatchScalarField.C
116 
117 \*---------------------------------------------------------------------------*/
118 
119 #ifndef atmNutkWallFunctionFvPatchScalarField_H
120 #define atmNutkWallFunctionFvPatchScalarField_H
121 
123 #include "PatchFunction1.H"
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 namespace Foam
128 {
129 
130 /*---------------------------------------------------------------------------*\
131  Class atmNutkWallFunctionFvPatchScalarField Declaration
132 \*---------------------------------------------------------------------------*/
133 
134 class atmNutkWallFunctionFvPatchScalarField
135 :
136  public nutkWallFunctionFvPatchScalarField
137 {
138  // Private Data
139 
140  //- Flag to zero-bound nut to prevent negative nut
141  //- at the wall arising from negative heat fluxes
142  const bool boundNut_;
143 
144  //- Surface roughness length field [m]
145  autoPtr<PatchFunction1<scalar>> z0_;
146 
147 
148 protected:
149 
150  // Protected Member Functions
151 
152  //- Calculate the turbulent viscosity
153  virtual tmp<scalarField> calcNut() const;
154 
155 
156 public:
157 
158  //- Runtime type information
159  TypeName("atmNutkWallFunction");
160 
161 
162  // Constructors
163 
164  //- Construct from patch and internal field
166  (
167  const fvPatch&,
168  const DimensionedField<scalar, volMesh>&
169  );
170 
171  //- Construct from patch, internal field and dictionary
173  (
174  const fvPatch&,
176  const dictionary&
177  );
178 
179  //- Construct by mapping given
180  //- atmNutkWallFunctionFvPatchScalarField
181  //- onto a new patch
183  (
185  const fvPatch&,
187  const fvPatchFieldMapper&
188  );
189 
190  //- Construct as copy
192  (
194  );
195 
196  //- Construct and return a clone
197  virtual tmp<fvPatchScalarField> clone() const
198  {
200  (
202  );
203  }
204 
205  //- Construct as copy setting internal field reference
207  (
210  );
211 
212  //- Construct and return a clone setting internal field reference
214  (
216  ) const
217  {
219  (
221  );
222  }
223 
224 
225  // Member Functions
226 
227  // Mapping
228 
229  //- Map (and resize as needed) from self given a mapping object
230  virtual void autoMap(const fvPatchFieldMapper&);
231 
232  //- Reverse map the given fvPatchField onto this fvPatchField
233  virtual void rmap
234  (
235  const fvPatchScalarField&,
236  const labelList&
237  );
238 
239 
240  // I-O
241 
242  //- Write
243  virtual void write(Ostream&) const;
244 };
245 
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 } // End namespace Foam
250 
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 
253 #endif
254 
255 // ************************************************************************* //
Foam::fvPatchField< scalar >
Foam::fvPatchScalarField
fvPatchField< scalar > fvPatchScalarField
Definition: fvPatchFieldsFwd.H:40
Foam::atmNutkWallFunctionFvPatchScalarField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: atmNutkWallFunctionFvPatchScalarField.C:176
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::atmNutkWallFunctionFvPatchScalarField::calcNut
virtual tmp< scalarField > calcNut() const
Calculate the turbulent viscosity.
Definition: atmNutkWallFunctionFvPatchScalarField.C:44
PatchFunction1.H
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::atmNutkWallFunctionFvPatchScalarField::atmNutkWallFunctionFvPatchScalarField
atmNutkWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: atmNutkWallFunctionFvPatchScalarField.C:112
Foam::atmNutkWallFunctionFvPatchScalarField
This boundary condition provides a wall constraint on the turbulent viscosity (i.e....
Definition: atmNutkWallFunctionFvPatchScalarField.H:173
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::atmNutkWallFunctionFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: atmNutkWallFunctionFvPatchScalarField.C:200
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::atmNutkWallFunctionFvPatchScalarField::TypeName
TypeName("atmNutkWallFunction")
Runtime type information.
Foam::List< label >
Foam::atmNutkWallFunctionFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: atmNutkWallFunctionFvPatchScalarField.H:236
Foam::atmNutkWallFunctionFvPatchScalarField::rmap
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: atmNutkWallFunctionFvPatchScalarField.C:186
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::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