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-2020 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  //- Copy constructor
148  (
150  );
151 
152  //- Construct and return a clone
153  virtual tmp<fvPatchScalarField> clone() const
154  {
156  (
158  );
159  }
160 
161  //- Copy constructor setting internal field reference
163  (
166  );
168  //- Construct and return a clone setting internal field reference
170  (
172  ) const
173  {
175  (
177  );
178  }
179 
180 
181  // Member Functions
182 
183  // Access functions
185  //- Return the roughness height
186  const scalarField& Ks() const
187  {
188  return Ks_;
189  }
190 
191  //- Return reference to the roughness height to allow adjustment
192  scalarField& Ks()
193  {
194  return Ks_;
195  }
196 
197 
198  //- Return the roughness constant scale
199  const scalarField& Cs() const
200  {
201  return Cs_;
202  }
203 
204  //- Return reference to the roughness constant to allow adjustment
205  scalarField& Cs()
206  {
207  return Cs_;
208  }
209 
210 
211  // Mapping functions
212 
213  //- Map (and resize as needed) from self given a mapping object
214  virtual void autoMap(const fvPatchFieldMapper&);
215 
216  //- Reverse map the given fvPatchField onto this fvPatchField
217  virtual void rmap
218  (
220  const labelList&
221  );
222 
223 
224  // I-O
225 
226  //- Write
227  virtual void write(Ostream&) const;
228 };
229 
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 } // End namespace Foam
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #endif
238 
239 // ************************************************************************* //
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:158
const scalarField & Ks() const
Return the roughness height.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
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.
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 tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Namespace for OpenFOAM.