nutkRoughWallFunctionFvPatchScalarField.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::nutkRoughWallFunctionFvPatchScalarField
26 
27 Description
28  This boundary condition provides a turbulent kinematic viscosity condition
29  when using wall functions for rough walls, based on turbulence kinetic
30  energy. The condition manipulates the E parameter to account for roughness
31  effects.
32 
33  Reference:
34  \verbatim
35  Cebeci, T., & Bradshaw, P. (1977).
36  Momentum transfer in boundary layers.
37  Washington, DC, Hemisphere Publishing Corp.; New York,
38  McGraw-Hill Book Co., 1977. 407 p.
39  \endverbatim
40 
41 Usage
42  \table
43  Property | Description | Required | Default value
44  Ks | sand-grain roughness height | yes |
45  Cs | roughness constant | yes |
46  \endtable
47 
48  Parameter ranges
49  - roughness height (Ks) = sand-grain roughness (0 for smooth walls)
50  - roughness constant (Cs) = 0.5 - 1.0
51 
52  Example of the boundary condition specification:
53  \verbatim
54  <patchName>
55  {
56  type nutkRoughWallFunction;
57  Ks uniform 1e-5;
58  Cs uniform 0.5;
59  value uniform 0;
60  }
61  \endverbatim
62 
63 See also
64  Foam::nutkWallFunctionFvPatchScalarField
65 
66 SourceFiles
67  nutkRoughWallFunctionFvPatchScalarField.C
68 
69 \*---------------------------------------------------------------------------*/
70 
71 #ifndef nutkRoughWallFunctionFvPatchScalarField_H
72 #define nutkRoughWallFunctionFvPatchScalarField_H
73 
75 
76 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
77 
78 namespace Foam
79 {
80 
81 /*---------------------------------------------------------------------------*\
82  Class nutkRoughWallFunctionFvPatchScalarField Declaration
83 \*---------------------------------------------------------------------------*/
84 
85 class nutkRoughWallFunctionFvPatchScalarField
86 :
87  public nutkWallFunctionFvPatchScalarField
88 {
89  // Private Data
90 
91  //- Roughness height
92  scalarField Ks_;
93 
94  //- Roughness constant
95  scalarField Cs_;
96 
97 
98  // Private Member Functions
99 
100  //- Return the roughness dependent E
101  scalar E(const scalar KsPlus, const scalar Cs) const;
102 
103 
104 protected:
105 
106  // Protected Member Functions
107 
108  //- Calculate the turbulence viscosity
109  virtual tmp<scalarField> nut() const;
110 
111 
112 public:
113 
114  //- Runtime type information
115  TypeName("nutkRoughWallFunction");
116 
117 
118  // Constructors
119 
120  //- Construct from patch, internal field and dictionary
122  (
123  const fvPatch&,
125  const dictionary&
126  );
127 
128  //- Construct by mapping given
129  // nutkRoughWallFunctionFvPatchScalarField
130  // onto a new patch
132  (
134  const fvPatch&,
136  const fvPatchFieldMapper&
137  );
138 
139  //- Disallow copy without setting internal field reference
141  (
143  ) = delete;
144 
145  //- Copy constructor setting internal field reference
147  (
150  );
151 
152  //- Construct and return a clone setting internal field reference
154  (
156  ) const
157  {
159  (
161  );
162  }
163 
164 
165  // Member Functions
166 
167  // Access functions
168 
169  //- Return the roughness height
170  const scalarField& Ks() const
171  {
172  return Ks_;
173  }
174 
175  //- Return reference to the roughness height to allow adjustment
176  scalarField& Ks()
177  {
178  return Ks_;
179  }
180 
181 
182  //- Return the roughness constant scale
183  const scalarField& Cs() const
184  {
185  return Cs_;
186  }
187 
188  //- Return reference to the roughness constant to allow adjustment
189  scalarField& Cs()
190  {
191  return Cs_;
192  }
193 
194 
195  // Mapping functions
196 
197  //- Map the given fvPatchField onto this fvPatchField
198  virtual void map
199  (
200  const fvPatchScalarField&,
201  const fvPatchFieldMapper&
202  );
203 
204  //- Reset the fvPatchField to the given fvPatchField
205  // Used for mesh to mesh mapping
206  virtual void reset(const fvPatchScalarField&);
207 
208 
209  // I-O
210 
211  //- Write
212  virtual void write(Ostream&) const;
213 };
214 
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 } // End namespace Foam
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 #endif
223 
224 // ************************************************************************* //
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.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:87
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
This boundary condition provides a turbulent kinematic viscosity condition when using wall functions ...
virtual tmp< scalarField > nut() const
Calculate the turbulence viscosity.
const scalarField & Ks() const
Return the roughness height.
virtual void reset(const fvPatchScalarField &)
Reset the fvPatchField to the given fvPatchField.
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
const scalarField & Cs() const
Return the roughness constant scale.
virtual void map(const fvPatchScalarField &, const fvPatchFieldMapper &)
Map the given fvPatchField onto this fvPatchField.
nutkRoughWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
TypeName("nutkRoughWallFunction")
Runtime type information.
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.