nutURoughWallFunctionFvPatchScalarField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::nutURoughWallFunctionFvPatchScalarField
29 
30 Group
31  grpWallFunctions
32 
33 Description
34  This boundary condition provides a wall constraint on the turbulent
35  viscosity, i.e. \c nut, based on velocity i.e. \c U, for low- and
36  high-Reynolds number turbulence models for rough walls.
37 
38 Usage
39  Example of the boundary condition specification:
40  \verbatim
41  <patchName>
42  {
43  // Mandatory entries (unmodifiable)
44  type nutURoughWallFunction;
45  roughnessHeight 1e-5;
46  roughnessConstant 0.5;
47  roughnessFactor 1;
48 
49  // Optional entries (unmodifiable)
50  maxIter 10;
51  tolerance 0.0001;
52 
53  // Optional (inherited) entries
54  ...
55  }
56  \endverbatim
57 
58  where the entries mean:
59  \table
60  Property | Description | Type | Req'd | Dflt
61  type | Type name: nutURoughWallFunction | word | yes | -
62  roughnessHeight | Roughness height | scalar | yes | -
63  roughnessConstant | Roughness constant | scalar | yes | -
64  roughnessFactor | Scaling factor | scalar | yes | -
65  maxIter | Number of Newton-Raphson iterations | label | no | 10
66  tolerance | Convergence tolerance | scalar | no | 0.0001
67  \endtable
68 
69  The inherited entries are elaborated in:
70  - \link nutWallFunctionFvPatchScalarField.H \endlink
71 
72 Note
73  - Suffers from non-exact restart since \c correctNut() (called through
74  \c turbulence->validate) returns a slightly different value every time
75  it is called.
76  See \link nutUSpaldingWallFunctionFvPatchScalarField.C \endlink.
77 
78 SourceFiles
79  nutURoughWallFunctionFvPatchScalarField.C
80 
81 \*---------------------------------------------------------------------------*/
82 
83 #ifndef nutURoughWallFunctionFvPatchScalarField_H
84 #define nutURoughWallFunctionFvPatchScalarField_H
85 
87 
88 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
89 
90 namespace Foam
91 {
92 
93 /*---------------------------------------------------------------------------*\
94  Class nutURoughWallFunctionFvPatchScalarField Declaration
95 \*---------------------------------------------------------------------------*/
96 
97 class nutURoughWallFunctionFvPatchScalarField
98 :
99  public nutWallFunctionFvPatchScalarField
100 {
101  // Private Data
102 
103  // Roughness model parameters
104 
105  //- Height
106  scalar roughnessHeight_;
107 
108  //- Constant
109  scalar roughnessConstant_;
110 
111  //- Scale factor
112  scalar roughnessFactor_;
113 
114 
115  //- Max iterations in calcNut
116  const label maxIter_;
117 
118  //- Convergence tolerance
119  const scalar tolerance_;
120 
121 
122  // Protected Member Functions
123 
124  //- Calculate yPlus
125  virtual tmp<scalarField> calcYPlus(const scalarField& magUp) const;
126 
127  //- Calculate the turbulence viscosity
128  virtual tmp<scalarField> calcNut() const;
129 
130  //- Write local wall function variables
131  virtual void writeLocalEntries(Ostream&) const;
132 
133 
134 public:
135 
136  //- Runtime type information
137  TypeName("nutURoughWallFunction");
138 
139 
140  // Constructors
141 
142  //- Construct from patch and internal field
144  (
145  const fvPatch&,
147  );
148 
149  //- Construct from patch, internal field and dictionary
151  (
152  const fvPatch&,
154  const dictionary&
155  );
156 
157  //- Construct by mapping given
158  //- nutURoughWallFunctionFvPatchScalarField
159  //- onto a new patch
161  (
163  const fvPatch&,
165  const fvPatchFieldMapper&
166  );
167 
168  //- Construct as copy
170  (
172  );
173 
174  //- Construct and return a clone
175  virtual tmp<fvPatchScalarField> clone() const
176  {
178  (
180  );
181  }
182 
183  //- Construct as copy setting internal field reference
185  (
188  );
189 
190  //- Construct and return a clone setting internal field reference
192  (
194  ) const
195  {
197  (
199  );
200  }
201 
202 
203  // Member Functions
204 
205  // Access
206 
207  //- Return the roughness height
208  scalar roughnessHeight() const
209  {
210  return roughnessHeight_;
211  }
212 
213  //- Return reference to the roughness height to allow adjustment
214  scalar& roughnessHeight()
215  {
216  return roughnessHeight_;
217  }
218 
219  //- Return the roughness constant scale
220  scalar roughnessConstant() const
221  {
222  return roughnessConstant_;
223  }
224 
225  //- Return reference to the roughness constant to allow adjustment
226  scalar& roughnessConstant()
227  {
228  return roughnessConstant_;
229  }
230 
231  //- Return the roughness scale factor
232  scalar roughnessFactor() const
233  {
234  return roughnessFactor_;
235  }
236 
237  //- Return reference to the roughness scale factor to allow
238  //- adjustment
239  scalar& roughnessFactor()
240  {
241  return roughnessFactor_;
242  }
243 
244 
245  // Evaluation functions
246 
247  //- Calculate and return the yPlus at the boundary
248  virtual tmp<scalarField> yPlus() const;
249 
250 
251  // I-O
252 
253  //- Write
254  virtual void write(Ostream& os) const;
255 };
256 
257 
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 
260 } // End namespace Foam
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 #endif
265 
266 // ************************************************************************* //
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
Foam::nutURoughWallFunctionFvPatchScalarField::roughnessHeight
scalar & roughnessHeight()
Return reference to the roughness height to allow adjustment.
Definition: nutURoughWallFunctionFvPatchScalarField.H:255
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::nutURoughWallFunctionFvPatchScalarField
This boundary condition provides a wall constraint on the turbulent viscosity, i.e....
Definition: nutURoughWallFunctionFvPatchScalarField.H:138
nutWallFunctionFvPatchScalarField.H
magUp
scalar magUp
Definition: evaluateNearWall.H:10
Foam::nutURoughWallFunctionFvPatchScalarField::TypeName
TypeName("nutURoughWallFunction")
Runtime type information.
Foam::Field< scalar >
Foam::nutURoughWallFunctionFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: nutURoughWallFunctionFvPatchScalarField.H:216
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::nutURoughWallFunctionFvPatchScalarField::roughnessConstant
scalar roughnessConstant() const
Return the roughness constant scale.
Definition: nutURoughWallFunctionFvPatchScalarField.H:261
Foam::nutURoughWallFunctionFvPatchScalarField::write
virtual void write(Ostream &os) const
Write.
Definition: nutURoughWallFunctionFvPatchScalarField.C:330
Foam::nutURoughWallFunctionFvPatchScalarField::roughnessFactor
scalar roughnessFactor() const
Return the roughness scale factor.
Definition: nutURoughWallFunctionFvPatchScalarField.H:273
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
nutURoughWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: nutURoughWallFunctionFvPatchScalarField.C:227
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::nutURoughWallFunctionFvPatchScalarField::roughnessConstant
scalar & roughnessConstant()
Return reference to the roughness constant to allow adjustment.
Definition: nutURoughWallFunctionFvPatchScalarField.H:267
Foam::nutURoughWallFunctionFvPatchScalarField::yPlus
virtual tmp< scalarField > yPlus() const
Calculate and return the yPlus at the boundary.
Definition: nutURoughWallFunctionFvPatchScalarField.C:310
Foam::nutURoughWallFunctionFvPatchScalarField::roughnessFactor
scalar & roughnessFactor()
Definition: nutURoughWallFunctionFvPatchScalarField.H:280
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::nutWallFunctionFvPatchScalarField
The class nutWallFunction is a base class that parents the derived boundary conditions which provide ...
Definition: nutWallFunctionFvPatchScalarField.H:251
Foam::nutURoughWallFunctionFvPatchScalarField::roughnessHeight
scalar roughnessHeight() const
Return the roughness height.
Definition: nutURoughWallFunctionFvPatchScalarField.H:249
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54