Loading...
Searching...
No Matches
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-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::nutURoughWallFunctionFvPatchScalarField
29
30Group
31 grpWallFunctions
32
33Description
34 This boundary condition provides a wall function on the turbulent
35 viscosity (i.e. \c nut) based on velocity (i.e. \c U) for low- and
36 high-Reynolds number applications for rough walls.
37
38Usage
39 Example of the boundary condition specification:
40 \verbatim
41 <patchName>
42 {
43 // Mandatory entries
44 type nutURoughWallFunction;
45 roughnessHeight 1e-5;
46 roughnessConstant 0.5;
47 roughnessFactor 1;
48
49 // Optional entries
50 maxIter 10;
51 tolerance 0.0001;
52
53 // Inherited entries
54 ...
55 }
56 \endverbatim
57
58 where the entries mean:
59 \table
60 Property | Description | Type | Reqd | Deflt
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
72Note
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
78SourceFiles
79 nutURoughWallFunctionFvPatchScalarField.C
80
81\*---------------------------------------------------------------------------*/
82
83#ifndef nutURoughWallFunctionFvPatchScalarField_H
84#define nutURoughWallFunctionFvPatchScalarField_H
85
87
88// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
89
90namespace Foam
91{
92
93/*---------------------------------------------------------------------------*\
94 Class nutURoughWallFunctionFvPatchScalarField Declaration
95\*---------------------------------------------------------------------------*/
96
98:
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 the turbulence viscosity
125 virtual tmp<scalarField> calcNut() const;
126
127 //- Calculate yPlus
128 tmp<scalarField> calcYPlus(const scalarField& magUp) const;
129
130 //- Write local wall function variables
131 void writeLocalEntries(Ostream&) const;
132
133
134public:
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 as copy setting internal field reference
176 (
179 );
180
181 //- Return a clone
182 virtual tmp<fvPatchField<scalar>> clone() const
183 {
184 return fvPatchField<scalar>::Clone(*this);
185 }
186
187 //- Clone with an internal field reference
189 (
191 ) const
193 return fvPatchField<scalar>::Clone(*this, iF);
194 }
195
196
197 // Member Functions
198
199 // Access
200
201 //- Return the roughness height
202 scalar roughnessHeight() const noexcept
203 {
204 return roughnessHeight_;
205 }
206
207 //- Return reference to the roughness height to allow adjustment
208 scalar& roughnessHeight() noexcept
209 {
210 return roughnessHeight_;
211 }
212
213 //- Return the roughness constant scale
214 scalar roughnessConstant() const noexcept
215 {
216 return roughnessConstant_;
217 }
218
219 //- Return reference to the roughness constant to allow adjustment
221 {
222 return roughnessConstant_;
223 }
224
225 //- Return the roughness scale factor
226 scalar roughnessFactor() const noexcept
227 {
228 return roughnessFactor_;
229 }
230
231 //- Return reference to the roughness scale factor to allow
232 //- adjustment
233 scalar& roughnessFactor() noexcept
234 {
235 return roughnessFactor_;
236 }
237
238
239 // Evaluation
240
241 //- Calculate and return the yPlus at the boundary
242 virtual tmp<scalarField> yPlus() const;
243
244
245 // I-O
246
247 //- Write
248 virtual void write(Ostream& os) const;
250
251
252// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253
254} // End namespace Foam
255
256// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258#endif
259
260// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A FieldMapper for finite-volume patch fields.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition fvPatch.H:71
This boundary condition provides a wall function on the turbulent viscosity (i.e. nut) based on veloc...
nutURoughWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
scalar & roughnessConstant() noexcept
Return reference to the roughness constant to allow adjustment.
virtual tmp< scalarField > yPlus() const
Calculate and return the yPlus at the boundary.
TypeName("nutURoughWallFunction")
Runtime type information.
virtual tmp< fvPatchField< scalar > > clone(const DimensionedField< scalar, volMesh > &iF) const
Clone with an internal field reference.
virtual tmp< fvPatchField< scalar > > clone() const
Return a clone.
scalar & roughnessHeight() noexcept
Return reference to the roughness height to allow adjustment.
scalar & roughnessFactor() noexcept
Return reference to the roughness scale factor to allow adjustment.
scalar roughnessHeight() const noexcept
Return the roughness height.
scalar roughnessFactor() const noexcept
Return the roughness scale factor.
scalar roughnessConstant() const noexcept
Return the roughness constant scale.
The class nutWallFunction is an abstract base class that hosts calculation methods and common functi...
virtual tmp< scalarField > calcNut() const =0
Calculate the turbulent viscosity.
nutWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
A class for managing temporary objects.
Definition tmp.H:75
scalar magUp
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const direction noexcept
Definition scalarImpl.H:265
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68