atmEpsilonWallFunctionFvPatchScalarField.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::atmEpsilonWallFunctionFvPatchScalarField
29 
30 Group
31  grpAtmWallFunctions
32 
33 Description
34  This boundary condition provides a wall constraint on the turbulent kinetic
35  energy dissipation rate (i.e. \c epsilon) and the turbulent kinetic energy
36  production contribution (i.e. \c G) for atmospheric boundary layer
37  modelling.
38 
39  References:
40  \verbatim
41  Theoretical expressions (tags:PGVB, RH):
42  Parente, A., Gorlé, C., Van Beeck, J., & Benocci, C. (2011).
43  Improved k–ε model and wall function formulation
44  for the RANS simulation of ABL flows.
45  J. of wind engineering and industrial aerodynamics, 99(4), 267-278.
46  DOI:10.1016/j.jweia.2010.12.017
47 
48  Richards, P. J., & Hoxey, R. P. (1993).
49  Appropriate boundary conditions for computational wind
50  engineering models using the k-ε turbulence model.
51  In Computational Wind Engineering 1 (pp. 145-153).
52  DOI:10.1016/B978-0-444-81688-7.50018-8
53  \endverbatim
54 
55  Required fields:
56  \verbatim
57  epsilon | Turbulent kinetic energy dissipation rate [m2/s3]
58  \endverbatim
59 
60 Usage
61  Example of the boundary condition specification:
62  \verbatim
63  <patchName>
64  {
65  // Mandatory entries
66  type atmEpsilonWallFunction;
67  z0 <PatchFunction1<scalar>>;
68 
69  // Inherited entries
70  ...
71  }
72  \endverbatim
73 
74  where the entries mean:
75  \table
76  Property | Description | Type | Reqd | Deflt
77  type | Type name: atmEpsilonWallFunction | word | yes | -
78  z0 | Surface roughness length [m] | PatchFunction1<scalar> | yes | -
79  \endtable
80 
81  The inherited entries are elaborated in:
82  - \link epsilonWallFunctionFvPatchScalarField.H \endlink
83  - \link PatchFunction1 \endlink
84 
85 SourceFiles
86  atmEpsilonWallFunctionFvPatchScalarField.C
87 
88 \*---------------------------------------------------------------------------*/
89 
90 #ifndef atmEpsilonWallFunctionFvPatchScalarField_H
91 #define atmEpsilonWallFunctionFvPatchScalarField_H
92 
94 #include "PatchFunction1.H"
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 namespace Foam
99 {
100 
101 /*---------------------------------------------------------------------------*\
102  Class atmEpsilonWallFunctionFvPatchScalarField Declaration
103 \*---------------------------------------------------------------------------*/
104 
105 class atmEpsilonWallFunctionFvPatchScalarField
106 :
107  public epsilonWallFunctionFvPatchScalarField
108 {
109 protected:
110 
111  // Protected Data
112 
113  //- Surface roughness length field [m]
114  autoPtr<PatchFunction1<scalar>> z0_;
115 
116 
117  // Protected Member Functions
119  //- Calculate the epsilon and G
120  virtual void calculate
121  (
123  const List<scalar>& cornerWeights,
124  const fvPatch& patch,
125  scalarField& G,
127  );
128 
129  //- Write local wall function variables
130  void writeLocalEntries(Ostream&) const;
131 
132 
133 public:
134 
135  //- Runtime type information
136  TypeName("atmEpsilonWallFunction");
137 
138 
139  // Constructors
140 
141  //- Construct from patch and internal field
143  (
144  const fvPatch&,
146  );
147 
148  //- Construct from patch, internal field and dictionary
150  (
151  const fvPatch&,
153  const dictionary&
154  );
155 
156  //- Construct by mapping given
157  //- atmEpsilonWallFunctionFvPatchScalarField
158  //- onto a new patch
160  (
162  const fvPatch&,
164  const fvPatchFieldMapper&
165  );
166 
167  //- Construct as copy
169  (
171  );
172 
173  //- Construct and return a clone
174  virtual tmp<fvPatchScalarField> clone() const
175  {
177  (
179  );
180  }
181 
182  //- Construct as copy setting internal field reference
184  (
187  );
188 
189  //- Construct and return a clone setting internal field reference
191  (
193  ) const
194  {
196  (
198  );
199  }
200 
201  //- Destructor
202  virtual ~atmEpsilonWallFunctionFvPatchScalarField() = default;
203 
204 
205  // Member Functions
206 
207  // Mapping
208 
209  //- Map (and resize as needed) from self given a mapping object
210  virtual void autoMap(const fvPatchFieldMapper&);
211 
212  //- Reverse map the given fvPatchField onto this fvPatchField
213  virtual void rmap
214  (
215  const fvPatchScalarField&,
216  const labelList&
217  );
218 
219 
220  // I-O
221 
222  //- Write
223  virtual void write(Ostream&) const;
224 };
225 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 } // End namespace Foam
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 #endif
234 
235 // ************************************************************************* //
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
const fvPatch & patch() const noexcept
Return the patch.
Definition: fvPatchField.H:269
atmEpsilonWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Abstract base class for turbulence models (RAS, LES and laminar).
virtual void calculate(const turbulenceModel &turbulence, const List< scalar > &cornerWeights, const fvPatch &patch, scalarField &G, scalarField &epsilon)
Calculate the epsilon and G.
virtual ~atmEpsilonWallFunctionFvPatchScalarField()=default
Destructor.
A FieldMapper for finite-volume patch fields.
scalarField & G(bool init=false)
Return non-const access to the master&#39;s G field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
void writeLocalEntries(Ostream &) const
Write local wall function variables.
Info<< "Reading field U\"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);volScalarField rho(IOobject("rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), thermo.rho());volVectorField rhoU(IOobject("rhoU", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *U);volScalarField rhoE(IOobject("rhoE", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *(e+0.5 *magSqr(U)));surfaceScalarField pos(IOobject("pos", runTime.timeName(), mesh), mesh, dimensionedScalar("pos", dimless, 1.0));surfaceScalarField neg(IOobject("neg", runTime.timeName(), mesh), mesh, dimensionedScalar("neg", dimless, -1.0));surfaceScalarField phi("phi", fvc::flux(rhoU));Info<< "Creating turbulence model\"<< endl;autoPtr< compressible::turbulenceModel > turbulence(compressible::turbulenceModel::New(rho, U, phi, thermo))
Definition: createFields.H:94
This boundary condition provides a wall constraint on the turbulent kinetic energy dissipation rate (...
autoPtr< PatchFunction1< scalar > > z0_
Surface roughness length field [m].
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
TypeName("atmEpsilonWallFunction")
Runtime type information.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Namespace for OpenFOAM.
scalarField & epsilon(bool init=false)
Return non-const access to the master&#39;s epsilon field.