nutkRoughWallFunctionFvPatchScalarField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::nutkRoughWallFunctionFvPatchScalarField
26 
27 Description
28  This boundary condition provides a turbulent kinematic viscosity condition
29  when using wall functions for rough walls, based on turbulence kinetic
30  energy. The condition manipulates the E parameter to account for roughness
31  effects.
32 
33 Usage
34  \table
35  Property | Description | Required | Default value
36  Ks | sand-grain roughness height | yes |
37  Cs | roughness constant | yes |
38  \endtable
39 
40  Parameter ranges
41  - roughness height (Ks) = sand-grain roughness (0 for smooth walls)
42  - roughness constant (Cs) = 0.5 - 1.0
43 
44  Example of the boundary condition specification:
45  \verbatim
46  <patchName>
47  {
48  type nutkRoughWallFunction;
49  Ks uniform 1e-5;
50  Cs uniform 0.5;
51  value uniform 0;
52  }
53  \endverbatim
54 
55 See also
56  Foam::nutkWallFunctionFvPatchScalarField
57 
58 SourceFiles
59  nutkRoughWallFunctionFvPatchScalarField.C
60 
61 \*---------------------------------------------------------------------------*/
62 
63 #ifndef nutkRoughWallFunctionFvPatchScalarField_H
64 #define nutkRoughWallFunctionFvPatchScalarField_H
65 
67 
68 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69 
70 namespace Foam
71 {
72 
73 /*---------------------------------------------------------------------------*\
74  Class nutkRoughWallFunctionFvPatchScalarField Declaration
75 \*---------------------------------------------------------------------------*/
76 
77 class nutkRoughWallFunctionFvPatchScalarField
78 :
79  public nutkWallFunctionFvPatchScalarField
80 {
81  // Private Data
82 
83  //- Roughness height
84  scalarField Ks_;
85 
86  //- Roughness constant
87  scalarField Cs_;
88 
89 
90  // Private Member Functions
91 
92  //- Return the roughness dependent E
93  scalar E(const scalar KsPlus, const scalar Cs) const;
94 
95 
96 protected:
97 
98  // Protected Member Functions
99 
100  //- Calculate the turbulence viscosity
101  virtual tmp<scalarField> nut() const;
102 
103 
104 public:
105 
106  //- Runtime type information
107  TypeName("nutkRoughWallFunction");
108 
109 
110  // Constructors
111 
112  //- Construct from patch and internal field
114  (
115  const fvPatch&,
117  );
118 
119  //- Construct from patch, internal field and dictionary
121  (
122  const fvPatch&,
124  const dictionary&
125  );
126 
127  //- Construct by mapping given
128  // nutkRoughWallFunctionFvPatchScalarField
129  // onto a new patch
131  (
133  const fvPatch&,
135  const fvPatchFieldMapper&
136  );
137 
138  //- Copy constructor
140  (
142  );
143 
144  //- Construct and return a clone
145  virtual tmp<fvPatchScalarField> clone() const
146  {
148  (
150  );
151  }
152 
153  //- Copy constructor setting internal field reference
155  (
158  );
160  //- Construct and return a clone setting internal field reference
162  (
164  ) const
165  {
167  (
169  );
170  }
171 
172 
173  // Member Functions
174 
175  // Access functions
177  //- Return the roughness height
178  const scalarField& Ks() const
179  {
180  return Ks_;
181  }
182 
183  //- Return reference to the roughness height to allow adjustment
184  scalarField& Ks()
185  {
186  return Ks_;
187  }
188 
189 
190  //- Return the roughness constant scale
191  const scalarField& Cs() const
192  {
193  return Cs_;
194  }
195 
196  //- Return reference to the roughness constant to allow adjustment
197  scalarField& Cs()
198  {
199  return Cs_;
200  }
201 
202 
203  // Mapping functions
204 
205  //- Map (and resize as needed) from self given a mapping object
206  virtual void autoMap(const fvPatchFieldMapper&);
207 
208  //- Reverse map the given fvPatchField onto this fvPatchField
209  virtual void rmap
210  (
212  const labelList&
213  );
214 
215 
216  // I-O
217 
218  //- Write
219  virtual void write(Ostream&) const;
220 };
221 
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 } // End namespace Foam
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #endif
230 
231 // ************************************************************************* //
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual tmp< scalarField > nut() const
Calculate the turbulence viscosity.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
const scalarField & Ks() const
Return the roughness height.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
This boundary condition provides a turbulent kinematic viscosity condition when using wall functions ...
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
const scalarField & Cs() const
Return the roughness constant scale.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Foam::fvPatchFieldMapper.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
nutkRoughWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
TypeName("nutkRoughWallFunction")
Runtime type information.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A class for managing temporary objects.
Definition: PtrList.H:53
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Namespace for OpenFOAM.