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-2019 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 
74 class turbulenceModel;
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;
109  //- Write local wall function variables
110  virtual void writeLocalEntries(Ostream&) const;
112 
113 public:
115  //- Runtime type information
116  TypeName("nutWallFunction");
118 
119  // Constructors
120 
121  //- Construct from patch and internal field
123  (
124  const fvPatch&,
126  );
127 
128  //- Construct from patch, internal field and dictionary
130  (
131  const fvPatch&,
133  const dictionary&
134  );
135 
136  //- Construct by mapping given
137  // nutWallFunctionFvPatchScalarField
138  // onto a new patch
140  (
142  const fvPatch&,
144  const fvPatchFieldMapper&
145  );
146 
147  //- Copy constructor
149  (
151  );
152 
153  //- Copy constructor setting internal field reference
155  (
158  );
159 
160 
161  // Member Functions
162 
163  //- Return Cmu
164  scalar Cmu() const
165  {
166  return Cmu_;
167  }
168 
169  //- Return kappa
170  scalar kappa() const
171  {
172  return kappa_;
173  }
174 
175  //- Return E
176  scalar E() const
177  {
178  return E_;
179  }
180 
181  //- Return the nut patchField for the given wall patch
183  (
184  const turbulenceModel& turbModel,
185  const label patchi
186  );
187 
188  //- Calculate the Y+ at the edge of the laminar sublayer
189  static scalar yPlusLam(const scalar kappa, const scalar E);
190 
191  //- Return the Y+ at the edge of the laminar sublayer
192  scalar yPlusLam() const;
193 
194  //- Calculate and return the yPlus at the boundary
195  virtual tmp<scalarField> yPlus() const = 0;
196 
197 
198  // Evaluation functions
199 
200  //- Update the coefficients associated with the patch field
201  virtual void updateCoeffs();
202 
203 
204  // I-O
205 
206  //- Write
207  virtual void write(Ostream&) const;
208 };
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #endif
218 
219 // ************************************************************************* //
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
scalar yPlusLam() const
Return the Y+ at the edge of the laminar sublayer.
virtual void writeLocalEntries(Ostream &) const
Write local wall function variables.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
ThermalDiffusivity< CompressibleTurbulenceModel< fluidThermo > > turbulenceModel
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Abstract base class for turbulence models (RAS, LES and laminar).
This boundary condition provides a turbulent kinematic viscosity condition when using wall functions...
Foam::fvPatchFieldMapper.
virtual tmp< scalarField > nut() const =0
Calculate the turbulence viscosity.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual void checkType()
Check the type of the patch.
TypeName("nutWallFunction")
Runtime type information.
label patchi
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
nutWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
A class for managing temporary objects.
Definition: PtrList.H:53
scalar yPlusLam_
Y+ at the edge of the laminar sublayer.
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.