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