atmAlphatkWallFunctionFvPatchScalarField.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) 2020 ENERCON GmbH
9  Copyright (C) 2020-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::atmAlphatkWallFunctionFvPatchScalarField
29 
30 Group
31  grpAtmWallFunctions
32 
33 Description
34  This boundary condition provides a wall constraint on the kinematic
35  turbulent thermal conductivity (i.e. \c alphat) for atmospheric boundary
36  layer modelling. It assumes a logarithmic distribution of the potential
37  temperature within the first cell.
38 
39  Required fields:
40  \verbatim
41  alphat | Kinematic turbulent thermal conductivity [m2/s]
42  \endverbatim
43 
44 Usage
45  Example of the boundary condition specification:
46  \verbatim
47  <patchName>
48  {
49  // Mandatory entries
50  type atmAlphatkWallFunction;
51  Pr <Function1<scalar>>;
52  Prt <PatchFunction1<scalar>>;
53  z0 <PatchFunction1<scalar>>;
54 
55  // Optional entries
56  Cmu <scalar>;
57  kappa <scalar>;
58 
59  // Inherited entries
60  ...
61  }
62  \endverbatim
63 
64  where the entries mean:
65  \table
66  Property | Description | Type | Reqd | Deflt
67  type | Type name: atmAlphatkWallFunction | word | yes | -
68  Pr | Molecular Prandtl number | Function1<scalar> | yes | -
69  Prt | Turbulent Prandtl number | PatchFunction1<scalar> | yes | -
70  z0 | Surface roughness length [m] | PatchFunction1<scalar> | yes | -
71  Cmu | Empirical model constant | scalar | no | 0.09
72  kappa | von Kármán constant | scalar | no | 0.41
73  \endtable
74 
75  The inherited entries are elaborated in:
76  - \link fixedValueFvPatchField.H \endlink
77  - \link Function1.H \endlink
78  - \link PatchFunction1.H \endlink
79 
80 SourceFiles
81  atmAlphatkWallFunctionFvPatchScalarField.C
82 
83 \*---------------------------------------------------------------------------*/
84 
85 #ifndef atmAlphatkWallFunctionFvPatchScalarField_H
86 #define atmAlphatkWallFunctionFvPatchScalarField_H
87 
89 #include "Function1.H"
90 #include "PatchFunction1.H"
91 
92 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93 
94 namespace Foam
95 {
96 
97 class turbulenceModel;
98 
99 /*---------------------------------------------------------------------------*\
100  Class atmAlphatkWallFunctionFvPatchScalarField Declaration
101 \*---------------------------------------------------------------------------*/
102 
103 class atmAlphatkWallFunctionFvPatchScalarField
104 :
105  public fixedValueFvPatchScalarField
106 {
107 protected:
108 
109  // Protected Data
110 
111  //- Empirical model constant
112  const scalar Cmu_;
113 
114  //- von Kármán constant
115  const scalar kappa_;
116 
117  //- Molecular Prandtl number
118  autoPtr<Function1<scalar>> Pr_;
119 
120  //- Turbulent Prandtl number field
121  autoPtr<PatchFunction1<scalar>> Prt_;
122 
123  //- Surface roughness length [m]
124  autoPtr<PatchFunction1<scalar>> z0_;
125 
126 
127  //- Solution parameters
128 
129  static scalar tolerance_;
130  static label maxIters_;
131 
132 
133  // Protected Member Functions
134 
135  //- Check the type of the patch
136  virtual void checkType();
137 
138  //- Write local wall function variables
139  void writeLocalEntries(Ostream&) const;
141 
142 public:
143 
144  //- Runtime type information
145  TypeName("atmAlphatkWallFunction");
146 
147 
148  // Constructors
149 
150  //- Construct from patch and internal field
152  (
153  const fvPatch&,
155  );
157  //- Construct from patch, internal field and dictionary
159  (
160  const fvPatch&,
162  const dictionary&
163  );
164 
165  //- Construct by mapping given
166  //- atmAlphatkWallFunctionFvPatchScalarField
167  //- onto a new patch
169  (
171  const fvPatch&,
173  const fvPatchFieldMapper&
174  );
175 
176  //- Construct as copy
178  (
180  );
181 
182  //- Construct as copy setting internal field reference
184  (
187  );
188 
189  //- Return a clone
190  virtual tmp<fvPatchField<scalar>> clone() const
191  {
192  return fvPatchField<scalar>::Clone(*this);
193  }
194 
195  //- Clone with an internal field reference
197  (
199  ) const
200  {
201  return fvPatchField<scalar>::Clone(*this, iF);
202  }
203 
204 
205  // Member Functions
206 
207  // Evaluation
208 
209  //- Update the coefficients associated with the patch field
210  virtual void updateCoeffs();
211 
212 
213  // Mapping
214 
215  //- Map (and resize as needed) from self given a mapping object
216  virtual void autoMap(const fvPatchFieldMapper&);
217 
218  //- Reverse map the given fvPatchField onto this fvPatchField
219  virtual void rmap
220  (
221  const fvPatchScalarField&,
222  const labelList&
223  );
224 
225 
226  // I-O
227 
228  //- Write
229  virtual void write(Ostream&) const;
230 };
231 
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 } // End namespace Foam
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #endif
240 
241 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
autoPtr< PatchFunction1< scalar > > Prt_
Turbulent Prandtl number field.
ThermalDiffusivity< CompressibleTurbulenceModel< fluidThermo > > turbulenceModel
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
This boundary condition provides a wall constraint on the kinematic turbulent thermal conductivity (i...
autoPtr< PatchFunction1< scalar > > z0_
Surface roughness length [m].
atmAlphatkWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
static tmp< fvPatchField< Type > > Clone(const DerivedPatchField &pf, Args &&... args)
Clone a patch field, optionally with internal field reference etc.
Definition: fvPatchField.H:597
virtual tmp< fvPatchField< scalar > > clone() const
Return a clone.
fvPatchField< scalar > fvPatchScalarField
A FieldMapper for finite-volume patch fields.
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
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:62
A class for managing temporary objects.
Definition: HashPtrTable.H:50
autoPtr< Function1< scalar > > Pr_
Molecular Prandtl number.
TypeName("atmAlphatkWallFunction")
Runtime type information.
Namespace for OpenFOAM.
void writeLocalEntries(Ostream &) const
Write local wall function variables.