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 and return a clone
157  virtual tmp<fvPatchScalarField> clone() const
158  {
160  (
162  );
163  }
164 
165  //- Construct as copy setting internal field reference
167  (
170  );
171 
172  //- Construct and return a clone setting internal field reference
174  (
176  ) const
177  {
179  (
181  );
182  }
183 
184 
185  // Member Functions
186 
187  // Access
188 
189  //- Return Ks
190  scalarField& Ks()
191  {
192  return Ks_;
193  }
194 
195  //- Return Cs
196  scalarField& Cs()
197  {
198  return Cs_;
199  }
200 
201 
202  // Mapping
203 
204  //- Map (and resize as needed) from self given a mapping object
205  virtual void autoMap(const fvPatchFieldMapper&);
206 
207  //- Reverse map the given fvPatchField onto this fvPatchField
208  virtual void rmap
209  (
210  const fvPatchScalarField&,
211  const labelList&
212  );
213 
214 
215  // I-O
216 
217  //- Write
218  virtual void write(Ostream&) const;
219 };
220 
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 } // End namespace Foam
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 #endif
229 
230 // ************************************************************************* //
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.
void writeLocalEntries(Ostream &os) const
Write local wall function variables.
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.
TypeName("nutkRoughWallFunction")
Runtime type information.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual scalar fnRough(const scalar KsPlus, const scalar Cs) const
Compute the roughness function.
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Namespace for OpenFOAM.