nutkRoughWallFunctionFvPatchScalarField.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, 2019 OpenFOAM Foundation
9  Copyright (C) 2019-2022 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::nutkRoughWallFunctionFvPatchScalarField
29 
30 Group
31  grpWallFunctions
32 
33 Description
34  This boundary condition provides a wall-function for the turbulent
35  viscosity (i.e. \c nut) when using wall functions for rough walls,
36  based on the turbulent kinetic energy (i.e. \c k). The condition
37  manipulates the wall roughness parameter (i.e. \c E) to account
38  for roughness effects.
39 
40  Parameter ranges:
41  - roughness height (i.e. \c Ks)= sand-grain roughness (0 for smooth walls)
42  - roughness constant (i.e. \c Cs) = 0.5-1.0
43 
44 Usage
45  Example of the boundary condition specification:
46  \verbatim
47  <patchName>
48  {
49  // Mandatory entries
50  type nutkRoughWallFunction;
51  Ks uniform 0;
52  Cs uniform 0.5;
53 
54  // Inherited entries
55  ...
56  }
57  \endverbatim
58 
59  where the entries mean:
60  \table
61  Property | Description | Type | Reqd | Dflt
62  type | Type name: nutkRoughWallFunction | word | yes | -
63  Ks | Sand-grain roughness height | scalarField | yes | -
64  Cs | Roughness constant | scalarField | yes | -
65  \endtable
66 
67  The inherited entries are elaborated in:
68  - \link nutkWallFunctionFvPatchScalarField.H \endlink
69 
70 SourceFiles
71  nutkRoughWallFunctionFvPatchScalarField.C
72 
73 \*---------------------------------------------------------------------------*/
74 
75 #ifndef nutkRoughWallFunctionFvPatchScalarField_H
76 #define nutkRoughWallFunctionFvPatchScalarField_H
77 
79 
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 
82 namespace Foam
83 {
84 
85 /*---------------------------------------------------------------------------*\
86  Class nutkRoughWallFunctionFvPatchScalarField Declaration
87 \*---------------------------------------------------------------------------*/
88 
89 class nutkRoughWallFunctionFvPatchScalarField
90 :
91  public nutkWallFunctionFvPatchScalarField
92 {
93 protected:
94 
95  // Protected Data
96 
97  //- Roughness height
99 
100  //- Roughness constant
102 
103 
104  // Protected Member Functions
105 
106  //- Compute the roughness function
107  virtual scalar fnRough(const scalar KsPlus, const scalar Cs) const;
109  //- Calculate the turbulent viscosity
110  virtual tmp<scalarField> calcNut() const;
111 
112  //- Write local wall function variables
113  void writeLocalEntries(Ostream& os) const;
114 
115 
116 public:
117 
118  //- Runtime type information
119  TypeName("nutkRoughWallFunction");
120 
121 
122  // Constructors
123 
124  //- Construct from patch and internal field
126  (
127  const fvPatch&,
129  );
130 
131  //- Construct from patch, internal field and dictionary
133  (
134  const fvPatch&,
136  const dictionary&
137  );
138 
139  //- Construct by mapping given
140  //- nutkRoughWallFunctionFvPatchScalarField
141  //- onto a new patch
143  (
145  const fvPatch&,
147  const fvPatchFieldMapper&
148  );
149 
150  //- Construct as copy
152  (
154  );
155 
156  //- Construct as copy setting internal field reference
158  (
161  );
162 
163  //- Return a clone
164  virtual tmp<fvPatchField<scalar>> clone() const
165  {
166  return fvPatchField<scalar>::Clone(*this);
167  }
168 
169  //- Clone with an internal field reference
171  (
173  ) const
174  {
175  return fvPatchField<scalar>::Clone(*this, iF);
176  }
177 
178 
179  // Member Functions
180 
181  // Access
182 
183  //- Return Ks
184  scalarField& Ks()
185  {
186  return Ks_;
187  }
188 
189  //- Return Cs
190  scalarField& Cs()
191  {
192  return Cs_;
193  }
194 
195 
196  // Mapping
197 
198  //- Map (and resize as needed) from self given a mapping object
199  virtual void autoMap(const fvPatchFieldMapper&);
200 
201  //- Reverse map the given fvPatchField onto this fvPatchField
202  virtual void rmap
203  (
204  const fvPatchScalarField&,
205  const labelList&
206  );
208 
209  // I-O
210 
211  //- Write
212  virtual void write(Ostream&) const;
213 };
214 
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 } // End namespace Foam
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 #endif
223 
224 // ************************************************************************* //
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
This boundary condition provides a wall-function for the turbulent viscosity (i.e. nut) when using wall functions for rough walls, based on the turbulent kinetic energy (i.e. k). The condition manipulates the wall roughness parameter (i.e. E) to account for roughness effects.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:607
void writeLocalEntries(Ostream &os) const
Write local wall function variables.
fvPatchField< scalar > fvPatchScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A FieldMapper for finite-volume patch fields.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
nutkRoughWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
OBJstream os(runTime.globalPath()/outputName)
virtual tmp< scalarField > calcNut() const
Calculate the turbulent viscosity.
virtual tmp< fvPatchField< scalar > > clone() const
Return a clone.
TypeName("nutkRoughWallFunction")
Runtime type information.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
List< label > labelList
A List of labels.
Definition: List.H:61
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual scalar fnRough(const scalar KsPlus, const scalar Cs) const
Compute the roughness function.
Namespace for OpenFOAM.