nutWallFunctionFvPatchScalarField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::nutWallFunctionFvPatchScalarField
26 
27 Description
28  This boundary condition provides a turbulent kinematic viscosity condition
29  when using wall functions, based on turbulence kinetic energy.
30  - replicates OpenFOAM v1.5 (and earlier) behaviour
31 
32 Usage
33  \table
34  Property | Description | Required | Default value
35  Cmu | Cmu coefficient | no | 0.09
36  kappa | Von Karman constant | no | 0.41
37  E | E coefficient | no | 9.8
38  \endtable
39 
40  Examples of the boundary condition specification:
41  \verbatim
42  <patchName>
43  {
44  type nutWallFunction;
45  value uniform 0;
46  }
47  \endverbatim
48 
49  Reference for the default model coefficients:
50  \verbatim
51  H. Versteeg, W. Malalasekera
52  An Introduction to Computational Fluid Dynamics: The Finite Volume
53  Method, subsection "3.5.2 k-epsilon model"
54  \endverbatim
55 
56 See also
57  Foam::fixedValueFvPatchField
58 
59 SourceFiles
60  nutWallFunctionFvPatchScalarField.C
61 
62 \*---------------------------------------------------------------------------*/
63 
64 #ifndef nutWallFunctionFvPatchScalarField_H
65 #define nutWallFunctionFvPatchScalarField_H
66 
68 
69 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
70 
71 namespace Foam
72 {
73 
75 
76 /*---------------------------------------------------------------------------*\
77  Class nutWallFunctionFvPatchScalarField Declaration
78 \*---------------------------------------------------------------------------*/
79 
80 class nutWallFunctionFvPatchScalarField
81 :
82  public fixedValueFvPatchScalarField
83 {
84 protected:
85 
86  // Protected data
87 
88  //- Cmu coefficient
89  scalar Cmu_;
90 
91  //- Von Karman constant
92  scalar kappa_;
93 
94  //- E coefficient
95  scalar E_;
96 
97  //- Y+ at the edge of the laminar sublayer
98  scalar yPlusLam_;
99 
100 
101  // Protected Member Functions
102 
103  //- Check the type of the patch
104  virtual void checkType();
105 
106  //- Calculate the turbulence viscosity
107  virtual tmp<scalarField> nut() const = 0;
108 
109  //- Write local wall function variables
110  virtual void writeLocalEntries(Ostream&) const;
111 
112 
113 public:
114 
115  //- Runtime type information
116  TypeName("nutWallFunction");
117 
118 
119  // Constructors
120 
121  //- Construct from patch, internal field and dictionary
123  (
124  const fvPatch&,
126  const dictionary&
127  );
128 
129  //- Construct by mapping given
130  // nutWallFunctionFvPatchScalarField
131  // onto a new patch
133  (
135  const fvPatch&,
137  const fvPatchFieldMapper&
138  );
139 
140  //- Disallow copy without setting internal field reference
142  (
144  ) = delete;
145 
146  //- Copy constructor setting internal field reference
148  (
151  );
152 
153 
154  // Member Functions
155 
156  //- Return Cmu
157  scalar Cmu() const
158  {
159  return Cmu_;
160  }
161 
162  //- Return kappa
163  scalar kappa() const
164  {
165  return kappa_;
166  }
167 
168  //- Return E
169  scalar E() const
170  {
171  return E_;
172  }
173 
174  //- Return the nut patchField for the given wall patch
176  (
177  const momentumTransportModel& turbModel,
178  const label patchi
179  );
180 
181  //- Calculate the Y+ at the edge of the laminar sublayer
182  static scalar yPlusLam(const scalar kappa, const scalar E);
183 
184  //- Return the Y+ at the edge of the laminar sublayer
185  scalar yPlusLam() const;
186 
187  //- Calculate and return the yPlus at the boundary
188  virtual tmp<scalarField> yPlus() const = 0;
189 
190 
191  // Evaluation functions
192 
193  //- Update the coefficients associated with the patch field
194  virtual void updateCoeffs();
195 
196 
197  // I-O
198 
199  //- Write
200  virtual void write(Ostream&) const;
201 };
202 
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 } // End namespace Foam
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #endif
211 
212 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Foam::fvPatchFieldMapper.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
Abstract base class for turbulence models (RAS, LES and laminar).
This boundary condition provides a turbulent kinematic viscosity condition when using wall functions,...
scalar yPlusLam_
Y+ at the edge of the laminar sublayer.
nutWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void writeLocalEntries(Ostream &) const
Write local wall function variables.
virtual tmp< scalarField > nut() const =0
Calculate the turbulence viscosity.
scalar yPlusLam() const
Return the Y+ at the edge of the laminar sublayer.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
static const nutWallFunctionFvPatchScalarField & nutw(const momentumTransportModel &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.
virtual void checkType()
Check the type of the patch.
TypeName("nutWallFunction")
Runtime type information.
A class for managing temporary objects.
Definition: tmp.H:55
label patchi
compressibleMomentumTransportModel momentumTransportModel
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59