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 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 (unmodifiable)
66  type atmEpsilonWallFunction;
67 
68  // Mandatory entries (runtime modifiable)
69  z0 uniform 0.001;
70 
71  // Optional (inherited) entries
72  ...
73  }
74  \endverbatim
75 
76  where the entries mean:
77  \table
78  Property | Description | Type | Reqd | Dflt
79  type | Type name: atmEpsilonWallFunction | word | yes | -
80  z0 | Surface roughness length [m] | PatchFunction1<scalar> | yes | -
81  \endtable
82 
83  The inherited entries are elaborated in:
84  - \link epsilonWallFunctionFvPatchScalarField.H \endlink
85  - \link PatchFunction1 \endlink
86 
87 See also
88  - Foam::epsilonWallFunctionFvPatchScalarField
89 
90 SourceFiles
91  atmEpsilonWallFunctionFvPatchScalarField.C
92 
93 \*---------------------------------------------------------------------------*/
94 
95 #ifndef atmEpsilonWallFunctionFvPatchScalarField_H
96 #define atmEpsilonWallFunctionFvPatchScalarField_H
97 
99 #include "PatchFunction1.H"
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 namespace Foam
104 {
105 
106 /*---------------------------------------------------------------------------*\
107  Class atmEpsilonWallFunctionFvPatchScalarField Declaration
108 \*---------------------------------------------------------------------------*/
109 
110 class atmEpsilonWallFunctionFvPatchScalarField
111 :
112  public epsilonWallFunctionFvPatchScalarField
113 {
114 protected:
115 
116  // Protected Data
117 
118  //- Surface roughness length field [m]
119  autoPtr<PatchFunction1<scalar>> z0_;
120 
121 
122  // Protected Member Functions
123 
124  //- Calculate the epsilon and G
125  virtual void calculate
126  (
128  const List<scalar>& cornerWeights,
129  const fvPatch& patch,
130  scalarField& G,
132  );
133 
134 
135 public:
136 
137  //- Runtime type information
138  TypeName("atmEpsilonWallFunction");
139 
140 
141  // Constructors
142 
143  //- Construct from patch and internal field
145  (
146  const fvPatch&,
148  );
149 
150  //- Construct from patch, internal field and dictionary
152  (
153  const fvPatch&,
155  const dictionary&
156  );
157 
158  //- Construct by mapping given
159  //- atmEpsilonWallFunctionFvPatchScalarField
160  //- onto a new patch
162  (
164  const fvPatch&,
166  const fvPatchFieldMapper&
167  );
168 
169  //- Construct as copy
171  (
173  );
174 
175  //- Construct and return a clone
176  virtual tmp<fvPatchScalarField> clone() const
177  {
179  (
181  );
182  }
183 
184  //- Construct as copy setting internal field reference
186  (
189  );
190 
191  //- Construct and return a clone setting internal field reference
193  (
195  ) const
196  {
198  (
200  );
201  }
202 
203  //- Destructor
204  virtual ~atmEpsilonWallFunctionFvPatchScalarField() = default;
205 
206 
207  // Member Functions
208 
209  // Mapping
210 
211  //- Map (and resize as needed) from self given a mapping object
212  virtual void autoMap(const fvPatchFieldMapper&);
213 
214  //- Reverse map the given fvPatchField onto this fvPatchField
215  virtual void rmap
216  (
217  const fvPatchScalarField&,
218  const labelList&
219  );
220 
221 
222  // I-O
223 
224  //- Write
225  virtual void write(Ostream&) const;
226 };
227 
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 } // End namespace Foam
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
Foam::fvPatchField< scalar >
Foam::atmEpsilonWallFunctionFvPatchScalarField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: atmEpsilonWallFunctionFvPatchScalarField.C:184
Foam::atmEpsilonWallFunctionFvPatchScalarField::z0_
autoPtr< PatchFunction1< scalar > > z0_
Surface roughness length field [m].
Definition: atmEpsilonWallFunctionFvPatchScalarField.H:136
turbulence
Info<< "Reading field U\n"<< 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\n"<< endl;autoPtr< compressible::turbulenceModel > turbulence(compressible::turbulenceModel::New(rho, U, phi, thermo))
Definition: createFields.H:94
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
PatchFunction1.H
epsilonWallFunctionFvPatchScalarField.H
Foam::epsilonWallFunctionFvPatchScalarField::epsilon
scalarField & epsilon(bool init=false)
Return non-const access to the master's epsilon field.
Definition: epsilonWallFunctionFvPatchScalarField.C:441
Foam::Field< scalar >
Foam::atmEpsilonWallFunctionFvPatchScalarField::TypeName
TypeName("atmEpsilonWallFunction")
Runtime type information.
Foam::atmEpsilonWallFunctionFvPatchScalarField
This boundary condition provides a wall constraint on the turbulent kinetic energy dissipation rate (...
Definition: atmEpsilonWallFunctionFvPatchScalarField.H:127
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::epsilonWallFunctionFvPatchScalarField
This boundary condition provides a wall constraint on the turbulent kinetic energy dissipation rate,...
Definition: epsilonWallFunctionFvPatchScalarField.H:259
Foam::epsilonWallFunctionFvPatchScalarField::G
scalarField & G(bool init=false)
Return non-const access to the master's G field.
Definition: epsilonWallFunctionFvPatchScalarField.C:422
Foam::turbulenceModel
Abstract base class for turbulence models (RAS, LES and laminar).
Definition: turbulenceModel.H:63
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::atmEpsilonWallFunctionFvPatchScalarField::clone
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
Definition: atmEpsilonWallFunctionFvPatchScalarField.H:193
Foam::List< scalar >
Foam::atmEpsilonWallFunctionFvPatchScalarField::~atmEpsilonWallFunctionFvPatchScalarField
virtual ~atmEpsilonWallFunctionFvPatchScalarField()=default
Destructor.
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::fvPatchField< scalar >::patch
const fvPatch & patch() const
Return patch.
Definition: fvPatchField.H:357
Foam::atmEpsilonWallFunctionFvPatchScalarField::rmap
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: atmEpsilonWallFunctionFvPatchScalarField.C:194
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::atmEpsilonWallFunctionFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: atmEpsilonWallFunctionFvPatchScalarField.C:209
Foam::atmEpsilonWallFunctionFvPatchScalarField::calculate
virtual void calculate(const turbulenceModel &turbulence, const List< scalar > &cornerWeights, const fvPatch &patch, scalarField &G, scalarField &epsilon)
Calculate the epsilon and G.
Definition: atmEpsilonWallFunctionFvPatchScalarField.C:38
Foam::atmEpsilonWallFunctionFvPatchScalarField::atmEpsilonWallFunctionFvPatchScalarField
atmEpsilonWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: atmEpsilonWallFunctionFvPatchScalarField.C:121
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54