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-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::nutkRoughWallFunctionFvPatchScalarField
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, 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 = sand-grain roughness (0 for smooth walls)
42  - roughness constant = 0.5-1.0
43 
44 Usage
45  Example of the boundary condition specification:
46  \verbatim
47  <patchName>
48  {
49  // Mandatory entries (unmodifiable)
50  type nutkRoughWallFunction;
51  Ks uniform 0;
52  Cs uniform 0.5;
53 
54  // Optional (inherited) entries
55  ...
56  }
57  \endverbatim
58 
59  where the entries mean:
60  \table
61  Property | Description | Type | Req'd | 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;
108 
109  //- Calculate the turbulent viscosity
110  virtual tmp<scalarField> calcNut() const;
111 
112 
113 public:
114 
115  //- Runtime type information
116  TypeName("nutkRoughWallFunction");
117 
118 
119  // Constructors
120 
121  //- Construct from patch and internal field
123  (
124  const fvPatch&,
126  );
127 
128  //- Construct from patch, internal field and dictionary
130  (
131  const fvPatch&,
133  const dictionary&
134  );
135 
136  //- Construct by mapping given
137  //- nutkRoughWallFunctionFvPatchScalarField
138  //- onto a new patch
140  (
142  const fvPatch&,
144  const fvPatchFieldMapper&
145  );
146 
147  //- Construct as copy
149  (
151  );
152 
153  //- Construct and return a clone
154  virtual tmp<fvPatchScalarField> clone() const
155  {
157  (
159  );
160  }
161 
162  //- Construct as copy setting internal field reference
164  (
167  );
168 
169  //- Construct and return a clone setting internal field reference
171  (
173  ) const
174  {
176  (
178  );
179  }
180 
181 
182  // Member Functions
183 
184  // Access functions
185 
186  // Return Ks
187  scalarField& Ks()
188  {
189  return Ks_;
190  }
191 
192  // Return Cs
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  (
207  const fvPatchScalarField&,
208  const labelList&
209  );
210 
211 
212  // I-O
213 
214  //- Write
215  virtual void write(Ostream&) const;
216 };
217 
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 } // End namespace Foam
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 #endif
226 
227 // ************************************************************************* //
Foam::fvPatchField< scalar >
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
Foam::nutkRoughWallFunctionFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: nutkRoughWallFunctionFvPatchScalarField.C:227
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::nutkRoughWallFunctionFvPatchScalarField::fnRough
virtual scalar fnRough(const scalar KsPlus, const scalar Cs) const
Compute the roughness function.
Definition: nutkRoughWallFunctionFvPatchScalarField.C:39
Foam::nutkRoughWallFunctionFvPatchScalarField::rmap
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: nutkRoughWallFunctionFvPatchScalarField.C:211
Foam::Field< scalar >
Foam::nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
nutkRoughWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: nutkRoughWallFunctionFvPatchScalarField.C:132
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::nutkRoughWallFunctionFvPatchScalarField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: nutkRoughWallFunctionFvPatchScalarField.C:200
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::nutkRoughWallFunctionFvPatchScalarField::Ks_
scalarField Ks_
Roughness height.
Definition: nutkRoughWallFunctionFvPatchScalarField.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::nutkRoughWallFunctionFvPatchScalarField::Ks
scalarField & Ks()
Definition: nutkRoughWallFunctionFvPatchScalarField.H:210
Foam::nutkRoughWallFunctionFvPatchScalarField::TypeName
TypeName("nutkRoughWallFunction")
Runtime type information.
Foam::nutkRoughWallFunctionFvPatchScalarField
This boundary condition provides a wall constraint on the turbulent viscosity, i.e....
Definition: nutkRoughWallFunctionFvPatchScalarField.H:112
Foam::List< label >
Foam::nutkRoughWallFunctionFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: nutkRoughWallFunctionFvPatchScalarField.H:177
Foam::nutkRoughWallFunctionFvPatchScalarField::calcNut
virtual tmp< scalarField > calcNut() const
Calculate the turbulent viscosity.
Definition: nutkRoughWallFunctionFvPatchScalarField.C:62
Foam::nutkRoughWallFunctionFvPatchScalarField::Cs_
scalarField Cs_
Roughness constant.
Definition: nutkRoughWallFunctionFvPatchScalarField.H:124
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
nutkWallFunctionFvPatchScalarField.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::nutkRoughWallFunctionFvPatchScalarField::Cs
scalarField & Cs()
Definition: nutkRoughWallFunctionFvPatchScalarField.H:216
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::nutkWallFunctionFvPatchScalarField
This boundary condition provides a wall constraint on the turbulent viscosity, i.e....
Definition: nutkWallFunctionFvPatchScalarField.H:94