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-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::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 Usage
33  \table
34  Property | Description | Required | Default value
35  Ks | sand-grain roughness height | yes |
36  Cs | roughness constant | yes |
37  \endtable
38 
39  Parameter ranges
40  - roughness height (Ks) = sand-grain roughness (0 for smooth walls)
41  - roughness constant (Cs) = 0.5 - 1.0
42 
43  Example of the boundary condition specification:
44  \verbatim
45  <patchName>
46  {
47  type nutURoughWallFunction;
48  Ks uniform 1e-5;
49  Cs uniform 0.5;
50  value uniform 0;
51  }
52  \endverbatim
53 
54 See also
55  Foam::nutUWallFunctionFvPatchScalarField
56 
57 SourceFiles
58  nutURoughWallFunctionFvPatchScalarField.C
59 
60 \*---------------------------------------------------------------------------*/
61 
62 #ifndef nutURoughWallFunctionFvPatchScalarField_H
63 #define nutURoughWallFunctionFvPatchScalarField_H
64 
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class nutURoughWallFunctionFvPatchScalarField Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 class nutURoughWallFunctionFvPatchScalarField
77 :
78  public nutUWallFunctionFvPatchScalarField
79 {
80  // Private Data
81 
82  //- Roughness height
83  scalarField Ks_;
84 
85  //- Roughness constant
86  scalarField Cs_;
87 
88 
89 protected:
90 
91  // Protected Member Functions
92 
93  //- Calculate yPLus
94  virtual tmp<scalarField> yPlus(const scalarField& magUp) const;
95 
96  //- Calculate the turbulence viscosity
97  virtual tmp<scalarField> nut() const;
98 
99 
100 public:
101 
102  //- Runtime type information
103  TypeName("nutURoughWallFunction");
104 
105 
106  // Constructors
107 
108  //- Construct from patch and internal field
110  (
111  const fvPatch&,
113  );
114 
115  //- Construct from patch, internal field and dictionary
117  (
118  const fvPatch&,
120  const dictionary&
121  );
122 
123  //- Construct by mapping given
124  // nutURoughWallFunctionFvPatchScalarField
125  // onto a new patch
127  (
129  const fvPatch&,
131  const fvPatchFieldMapper&
132  );
133 
134  //- Copy constructor
136  (
138  );
139 
140  //- Construct and return a clone
141  virtual tmp<fvPatchScalarField> clone() const
142  {
144  (
146  );
147  }
148 
149  //- Copy constructor setting internal field reference
151  (
154  );
156  //- Construct and return a clone setting internal field reference
158  (
160  ) const
161  {
163  (
165  );
166  }
167 
168 
169  // Member Functions
170 
171  // Access functions
173  //- Return the roughness height
174  const scalarField& Ks() const
175  {
176  return Ks_;
177  }
178 
179  //- Return reference to the roughness height to allow adjustment
180  scalarField& Ks()
181  {
182  return Ks_;
183  }
184 
185 
186  //- Return the roughness constant scale
187  const scalarField& Cs() const
188  {
189  return Cs_;
190  }
191 
192  //- Return reference to the roughness constant to allow adjustment
193  scalarField& Cs()
194  {
195  return Cs_;
196  }
197 
198 
199  // Mapping functions
200 
201  //- Map (and resize as needed) from self given a mapping object
202  virtual void autoMap(const fvPatchFieldMapper&);
203 
204  //- Reverse map the given fvPatchField onto this fvPatchField
205  virtual void rmap
206  (
208  const labelList&
209  );
210 
211 
212  // I-O
213 
214  //- Write
215  virtual void write(Ostream& os) const;
216 };
217 
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 } // End namespace Foam
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 #endif
226 
227 // ************************************************************************* //
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:53
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.