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-2022 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 and internal field
122  (
123  const fvPatch&,
125  );
126 
127  //- Construct from patch, internal field and dictionary
129  (
130  const fvPatch&,
132  const dictionary&
133  );
134 
135  //- Construct by mapping given
136  // nutkRoughWallFunctionFvPatchScalarField
137  // onto a new patch
139  (
141  const fvPatch&,
143  const fvPatchFieldMapper&
144  );
145 
146  //- Disallow copy without setting internal field reference
148  (
150  ) = delete;
151 
152  //- Copy constructor setting internal field reference
154  (
157  );
158 
159  //- Construct and return a clone setting internal field reference
161  (
163  ) const
164  {
166  (
168  );
169  }
170 
171 
172  // Member Functions
173 
174  // Access functions
176  //- Return the roughness height
177  const scalarField& Ks() const
178  {
179  return Ks_;
180  }
181 
182  //- Return reference to the roughness height to allow adjustment
183  scalarField& Ks()
184  {
185  return Ks_;
186  }
187 
188 
189  //- Return the roughness constant scale
190  const scalarField& Cs() const
191  {
192  return Cs_;
193  }
194 
195  //- Return reference to the roughness constant to allow adjustment
196  scalarField& Cs()
197  {
198  return Cs_;
199  }
200 
201 
202  // Mapping functions
203 
204  //- Map (and resize as needed) from self given a mapping object
205  virtual void autoMap(const fvPatchFieldMapper&);
206 
207  //- Reverse map the given fvPatchField onto this fvPatchField
208  virtual void rmap
209  (
211  const labelList&
212  );
213 
214  //- Reset the fvPatchField to the given fvPatchField
215  // Used for mesh to mesh mapping
216  virtual void reset(const fvPatchScalarField&);
217 
218 
219  // I-O
220 
221  //- Write
222  virtual void write(Ostream&) const;
223 };
224 
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 } // End namespace Foam
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 #endif
233 
234 // ************************************************************************* //
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual tmp< scalarField > nut() const
Calculate the turbulence viscosity.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
const scalarField & Ks() const
Return the roughness height.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
This boundary condition provides a turbulent kinematic viscosity condition when using wall functions ...
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
const scalarField & Cs() const
Return the roughness constant scale.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Foam::fvPatchFieldMapper.
virtual tmp< fvPatchScalarField > clone(const DimensionedField< scalar, volMesh > &iF) const
Construct and return a clone setting internal field reference.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
nutkRoughWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
TypeName("nutkRoughWallFunction")
Runtime type information.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A class for managing temporary objects.
Definition: PtrList.H:53
virtual void reset(const fvPatchScalarField &)
Reset the fvPatchField to the given fvPatchField.
Namespace for OpenFOAM.