nutWallFunctionFvPatchScalarField.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, 2019 OpenFOAM Foundation
9  Copyright (C) 2019-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::nutWallFunctionFvPatchScalarField
29 
30 Group
31  grpWallFunctions
32 
33 Description
34  The class \c nutWallFunction is an abstract base class that
35  hosts \f$y^+\f$ calculation methods and common functions for
36  \c nut wall-function boundary conditions.
37 
38 Usage
39  Example of the boundary condition specification:
40  \verbatim
41  <patchName>
42  {
43  // Top-level entries
44  ...
45 
46  // Optional entries
47  U U;
48 
49  // Inherited entries
50  ...
51  }
52  \endverbatim
53 
54  where the entries mean:
55  \table
56  Property | Description | Type | Reqd | Deflt
57  U | Name of operand velocity field | word | no | U
58  \endtable
59 
60  The inherited entries are elaborated in:
61  - \link fixedValueFvPatchFields.H \endlink
62  - \link wallFunctionCoefficients.H \endlink
63 
64 SourceFiles
65  nutWallFunctionFvPatchScalarField.C
66 
67 \*---------------------------------------------------------------------------*/
68 
69 #ifndef nutWallFunctionFvPatchScalarField_H
70 #define nutWallFunctionFvPatchScalarField_H
71 
74 
75 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
76 
77 namespace Foam
78 {
79 
80 class turbulenceModel;
81 
82 /*---------------------------------------------------------------------------*\
83  Class nutWallFunctionFvPatchScalarField Declaration
84 \*---------------------------------------------------------------------------*/
85 
86 class nutWallFunctionFvPatchScalarField
87 :
88  public fixedValueFvPatchScalarField
89 {
90 protected:
91 
92  // Protected Data
93 
94  //- Name of velocity field
95  // Default is null (not specified) in which case the velocity is
96  // retrieved from the turbulence model
97  word UName_;
98 
99  //- Wall-function coefficients
101 
102 
103  // Protected Member Functions
104 
105  //- Helper to return the velocity field either from the turbulence
106  //- model (default) or the mesh database
107  virtual const volVectorField& U(const turbulenceModel& turb) const;
108 
109  //- Check the type of the patch
110  virtual void checkType();
111 
112  //- Calculate the turbulent viscosity
113  virtual tmp<scalarField> calcNut() const = 0;
114 
115  //- Write local wall function variables
116  void writeLocalEntries(Ostream&) const;
117 
118 
119 public:
120 
121  //- Runtime type information
122  TypeName("nutWallFunction");
123 
124 
125  // Constructors
126 
127  //- Construct from patch and internal field
129  (
130  const fvPatch&,
132  );
133 
134  //- Construct from patch, internal field and dictionary
136  (
137  const fvPatch&,
139  const dictionary&
140  );
141 
142  //- Construct by mapping given
143  //- nutWallFunctionFvPatchScalarField
144  //- onto a new patch
146  (
148  const fvPatch&,
150  const fvPatchFieldMapper&
151  );
152 
153  //- Construct as copy
155  (
157  );
158 
159  //- Construct as copy setting internal field reference
161  (
164  );
165 
166  // No clone methods - abstract class
167 
168 
169  // Member Functions
170 
171  //- Return the nut patchField for the given wall patch
173  (
174  const turbulenceModel& turbModel,
175  const label patchi
176  );
177 
178  //- Calculate and return the yPlus at the boundary
179  // yPlus is the first-cell-centre height from boundary in wall units
180  virtual tmp<scalarField> yPlus() const = 0;
181 
182  //- Return wallFunctionCoefficients
183  inline const wallFunctionCoefficients& wallCoeffs() const noexcept
184  {
185  return wallCoeffs_;
186  }
187 
188 
189  // Evaluation
190 
191  //- Update the coefficients associated with the patch field
192  virtual void updateCoeffs();
193 
194 
195  // I-O
196 
197  //- Write
198  virtual void write(Ostream&) const;
199 };
200 
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 } // End namespace Foam
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #endif
209 
210 // ************************************************************************* //
virtual const volVectorField & U(const turbulenceModel &turb) const
Helper to return the velocity field either from the turbulence model (default) or the mesh database...
void writeLocalEntries(Ostream &) const
Write local wall function variables.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
const wallFunctionCoefficients & wallCoeffs() const noexcept
Return wallFunctionCoefficients.
compressible::turbulenceModel & turb
ThermalDiffusivity< CompressibleTurbulenceModel< fluidThermo > > turbulenceModel
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
virtual tmp< scalarField > calcNut() const =0
Calculate the turbulent viscosity.
Abstract base class for turbulence models (RAS, LES and laminar).
The class nutWallFunction is an abstract base class that hosts calculation methods and common functi...
A class for handling words, derived from Foam::string.
Definition: word.H:63
A FieldMapper for finite-volume patch fields.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
const direction noexcept
Definition: Scalar.H:258
virtual void checkType()
Check the type of the patch.
TypeName("nutWallFunction")
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
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
wallFunctionCoefficients wallCoeffs_
Wall-function coefficients.
nutWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Class to host the wall-function coefficients being used in the wall function boundary conditions...
static const nutWallFunctionFvPatchScalarField & nutw(const turbulenceModel &turbModel, const label patchi)
Return the nut patchField for the given wall patch.
virtual tmp< scalarField > yPlus() const =0
Calculate and return the yPlus at the boundary.
Namespace for OpenFOAM.