atmNutUWallFunctionFvPatchScalarField.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 ENERCON GmbH
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::atmNutUWallFunctionFvPatchScalarField
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 velocity (i.e. \c U) for atmospheric
36  boundary layer modelling. It is designed to be used in conjunction
37  with the \c atmBoundaryLayerInletVelocity boundary condition.
38 
39  The governing equation of the boundary condition:
40 
41  \f[
42  u = \frac{u^*}{\kappa} ln \left(\frac{z + z_0}{z_0}\right)
43  \f]
44 
45  where
46  \vartable
47  u^* | Friction velocity
48  \kappa | von Kármán constant
49  z_0 | Surface roughness length [m]
50  z | Ground-normal coordinate
51  \endvartable
52 
53  Required fields:
54  \verbatim
55  nut | Turbulent viscosity [m2/s]
56  U | Velocity [m/s]
57  \endverbatim
58 
59 Usage
60  Example of the boundary condition specification:
61  \verbatim
62  <patchName>
63  {
64  // Mandatory entries (unmodifiable)
65  type atmNutUWallFunction;
66 
67  // Mandatory entries (runtime modifiable)
68  z0 uniform 0.001;
69 
70  // Optional entries (unmodifiable)
71  boundNut true;
72 
73  // Optional (inherited) entries
74  ...
75  }
76  \endverbatim
77 
78  where the entries mean:
79  \table
80  Property | Description | Type | Reqd | Dflt
81  type | Type name: atmNutUWallFunction | word | yes | -
82  z0 | Surface roughness length [m] | PatchFunction1<scalar> | yes | -
83  boundNut | Flag: zero-bound nut near wall | bool | no | true
84  \endtable
85 
86  The inherited entries are elaborated in:
87  - \link nutUWallFunctionFvPatchScalarField.H \endlink
88  - \link PatchFunction1.H \endlink
89 
90 See also
91  - Foam::nutUWallFunctionFvPatchScalarField
92  - Foam::atmNutkWallFunctionFvPatchScalarField
93 
94 SourceFiles
95  atmNutUWallFunctionFvPatchScalarField.C
96 
97 \*---------------------------------------------------------------------------*/
98 
99 #ifndef atmNutUWallFunctionFvPatchScalarField_H
100 #define atmNutUWallFunctionFvPatchScalarField_H
101 
103 #include "PatchFunction1.H"
104 
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106 
107 namespace Foam
108 {
109 
110 /*---------------------------------------------------------------------------*\
111  Class atmNutUWallFunctionFvPatchScalarField Declaration
112 \*---------------------------------------------------------------------------*/
113 
114 class atmNutUWallFunctionFvPatchScalarField
115 :
116  public nutUWallFunctionFvPatchScalarField
117 {
118  // Private Data
119 
120  //- Flag to zero-bound nut to prevent negative nut
121  //- at the wall arising from negative heat fluxes
122  const bool boundNut_;
123 
124  //- Surface roughness length field [m]
125  autoPtr<PatchFunction1<scalar>> z0_;
126 
127 
128 protected:
129 
130  // Protected Member Functions
131 
132  //- Calculate the turbulent viscosity
133  virtual tmp<scalarField> calcNut() const;
134 
135 
136 public:
137 
138  //- Runtime type information
139  TypeName("atmNutUWallFunction");
140 
141 
142  // Constructors
143 
144  //- Construct from patch and internal field
146  (
147  const fvPatch&,
148  const DimensionedField<scalar, volMesh>&
149  );
150 
151  //- Construct from patch, internal field and dictionary
153  (
154  const fvPatch&,
156  const dictionary&
157  );
158 
159  //- Construct by mapping given
160  //- atmNutUWallFunctionFvPatchScalarField
161  //- onto a new patch
163  (
165  const fvPatch&,
167  const fvPatchFieldMapper&
168  );
169 
170  //- Construct as copy
172  (
174  );
175 
176  //- Construct and return a clone
177  virtual tmp<fvPatchScalarField> clone() const
178  {
180  (
182  );
183  }
184 
185  //- Construct as copy setting internal field reference
187  (
190  );
191 
192  //- Construct and return a clone setting internal field reference
194  (
196  ) const
197  {
199  (
201  );
202  }
203 
204 
205  // Member Functions
206 
207  // Mapping
208 
209  //- Map (and resize as needed) from self given a mapping object
210  virtual void autoMap(const fvPatchFieldMapper&);
211 
212  //- Reverse map the given fvPatchField onto this fvPatchField
213  virtual void rmap
214  (
215  const fvPatchScalarField&,
216  const labelList&
217  );
218 
219 
220  // I-O
221 
222  //- Write
223  virtual void write(Ostream&) const;
224 };
225 
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 } // End namespace Foam
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 #endif
234 
235 // ************************************************************************* //
Foam::fvPatchField< scalar >
Foam::fvPatchScalarField
fvPatchField< scalar > fvPatchScalarField
Definition: fvPatchFieldsFwd.H:40
Foam::atmNutUWallFunctionFvPatchScalarField::calcNut
virtual tmp< scalarField > calcNut() const
Calculate the turbulent viscosity.
Definition: atmNutUWallFunctionFvPatchScalarField.C:42
nutUWallFunctionFvPatchScalarField.H
Foam::atmNutUWallFunctionFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: atmNutUWallFunctionFvPatchScalarField.C:192
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
PatchFunction1.H
Foam::atmNutUWallFunctionFvPatchScalarField::atmNutUWallFunctionFvPatchScalarField
atmNutUWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: atmNutUWallFunctionFvPatchScalarField.C:104
Foam::atmNutUWallFunctionFvPatchScalarField::rmap
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: atmNutUWallFunctionFvPatchScalarField.C:178
Foam::atmNutUWallFunctionFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: atmNutUWallFunctionFvPatchScalarField.H:216
Foam::atmNutUWallFunctionFvPatchScalarField
This boundary condition provides a wall constraint on the turbulent viscosity (i.e....
Definition: atmNutUWallFunctionFvPatchScalarField.H:153
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
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::nutUWallFunctionFvPatchScalarField
This boundary condition provides a wall constraint on the turbulent viscosity, i.e....
Definition: nutUWallFunctionFvPatchScalarField.H:98
Foam::atmNutUWallFunctionFvPatchScalarField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: atmNutUWallFunctionFvPatchScalarField.C:168
Foam::List< label >
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
Foam::atmNutUWallFunctionFvPatchScalarField::TypeName
TypeName("atmNutUWallFunction")
Runtime type information.
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54