omegaWallFunctionFvPatchScalarField.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-2020 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::omegaWallFunctionFvPatchScalarField
26 
27 Description
28  This boundary condition provides a wall constraint on turbulnce specific
29  dissipation, omega for both low and high Reynolds number turbulence models.
30 
31  The near-wall omega may be either blended between the viscous region and
32  logarithmic region values or switched between these values based on the
33  laminar-to-turbulent y+ value derived from kappa and E specified in the
34  corresponding nutWallFunction. Recent tests have shown that the standard
35  switching method provides more accurate results for 10 < y+ < 30 when used
36  with high Reynolds number wall-functions and both methods provide accurate
37  results when used with continuous wall-functions. Based on this the
38  standard switching method is used by default.
39 
40 Usage
41  \table
42  Property | Description | Required | Default value
43  beta1 | Model coefficient | no | 0.075
44  blended | Blending switch | no | false
45  \endtable
46 
47  Example of the boundary condition specification:
48  \verbatim
49  <patchName>
50  {
51  type omegaWallFunction;
52  }
53  \endverbatim
54 
55 See also
56  Foam::fixedInternalValueFvPatchField
57  Foam::epsilonWallFunctionFvPatchScalarField
58 
59 SourceFiles
60  omegaWallFunctionFvPatchScalarField.C
61 
62 \*---------------------------------------------------------------------------*/
63 
64 #ifndef omegaWallFunctionFvPatchScalarField_H
65 #define omegaWallFunctionFvPatchScalarField_H
66 
67 #include "fixedValueFvPatchField.H"
68 
69 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
70 
71 namespace Foam
72 {
73 
75 
76 /*---------------------------------------------------------------------------*\
77  Class omegaWallFunctionFvPatchScalarField Declaration
78 \*---------------------------------------------------------------------------*/
79 
80 class omegaWallFunctionFvPatchScalarField
81 :
82  public fixedValueFvPatchField<scalar>
83 {
84 protected:
85 
86  // Protected data
87 
88  //- Tolerance used in weighted calculations
89  static scalar tolerance_;
90 
91  //- beta1 coefficient
92  scalar beta1_;
93 
94  //- Blending switch (defaults to false)
96 
97  //- Local copy of turbulence G field
99 
100  //- Local copy of turbulence omega field
102 
103  //- Initialised flag
104  bool initialised_;
105 
106  //- Master patch ID
107  label master_;
108 
109  //- List of averaging corner weights
111 
113  // Protected Member Functions
114 
115  //- Set the master patch - master is responsible for updating all
116  // wall function patches
117  virtual void setMaster();
119  //- Create the averaging weights for cells which are bounded by
120  // multiple wall function faces
121  virtual void createAveragingWeights();
122 
123  //- Helper function to return non-const access to an omega patch
125  (
126  const label patchi
127  );
128 
129  //- Main driver to calculate the turbulence fields
130  virtual void calculateTurbulenceFields
131  (
133  scalarField& G0,
134  scalarField& omega0
135  );
136 
137  //- Calculate the omega and G
138  virtual void calculate
139  (
141  const List<scalar>& cornerWeights,
142  const fvPatch& patch,
143  scalarField& G,
145  );
146 
147  //- Return non-const access to the master patch ID
148  virtual label& master()
149  {
150  return master_;
151  }
152 
154 
155 
156 public:
157 
158  //- Runtime type information
159  TypeName("omegaWallFunction");
160 
161 
162  // Constructors
163 
164  //- Construct from patch and internal field
166  (
167  const fvPatch&,
169  );
170 
171  //- Construct from patch, internal field and dictionary
173  (
174  const fvPatch&,
176  const dictionary&
177  );
178 
179  //- Construct by mapping given
180  // omegaWallFunctionFvPatchScalarField
181  // onto a new patch
183  (
185  const fvPatch&,
187  const fvPatchFieldMapper&
188  );
189 
190  //- Copy constructor
192  (
194  );
195 
196  //- Construct and return a clone
197  virtual tmp<fvPatchScalarField> clone() const
198  {
200  (
202  );
203  }
204 
205  //- Copy constructor setting internal field reference
207  (
210  );
212  //- Construct and return a clone setting internal field reference
214  (
216  ) const
217  {
219  (
221  );
222  }
223 
224 
225  // Member Functions
226 
227  // Access
229  //- Return non-const access to the master's G field
230  scalarField& G(bool init = false);
231 
232  //- Return non-const access to the master's omega field
233  scalarField& omega(bool init = false);
234 
235 
236  // Evaluation functions
237 
238  //- Update the coefficients associated with the patch field
239  virtual void updateCoeffs();
240 
241  //- Update the coefficients associated with the patch field
242  virtual void updateWeightedCoeffs(const scalarField& weights);
243 
244  //- Manipulate matrix
245  virtual void manipulateMatrix(fvMatrix<scalar>& matrix);
246 
247  //- Manipulate matrix with given weights
248  virtual void manipulateMatrix
249  (
250  fvMatrix<scalar>& matrix,
251  const scalarField& weights
252  );
253 
254 
255  // I-O
256 
257  //- Write
258  virtual void write(Ostream&) const;
259 };
260 
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 } // End namespace Foam
265 
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267 
268 #endif
269 
270 // ************************************************************************* //
Switch blended_
Blending switch (defaults to false)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
omegaWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
virtual tmp< fvPatchScalarField > clone() const
Construct and return a clone.
virtual void updateWeightedCoeffs(const scalarField &weights)
Update the coefficients associated with the patch field.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Definition: Switch.H:60
virtual void createAveragingWeights()
Create the averaging weights for cells which are bounded by.
scalarField & G(bool init=false)
Return non-const access to the master&#39;s G field.
CompressibleMomentumTransportModel< fluidThermo > momentumTransportModel
virtual omegaWallFunctionFvPatchScalarField & omegaPatch(const label patchi)
Helper function to return non-const access to an omega patch.
Foam::fvPatchFieldMapper.
static scalar tolerance_
Tolerance used in weighted calculations.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:72
const fvPatch & patch() const
Return patch.
Definition: fvPatchField.H:325
const dimensionedScalar & G0
Conductance quantum: default SI units: [S].
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
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(dimless, 1.0));surfaceScalarField neg(IOobject("neg", runTime.timeName(), mesh), mesh, dimensionedScalar(dimless, -1.0));surfaceScalarField phi("phi", fvc::flux(rhoU));Info<< "Creating turbulence model\"<< endl;autoPtr< compressible::momentumTransportModel > turbulence(compressible::momentumTransportModel::New(rho, U, phi, thermo))
Definition: createFields.H:94
List< List< scalar > > cornerWeights_
List of averaging corner weights.
virtual void calculateTurbulenceFields(const momentumTransportModel &turbulence, scalarField &G0, scalarField &omega0)
Main driver to calculate the turbulence fields.
scalarField G_
Local copy of turbulence G field.
Abstract base class for turbulence models (RAS, LES and laminar).
scalarField & omega(bool init=false)
Return non-const access to the master&#39;s omega field.
label patchi
This boundary condition provides a wall constraint on turbulnce specific dissipation, omega for both low and high Reynolds number turbulence models.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
virtual void setMaster()
Set the master patch - master is responsible for updating all.
A class for managing temporary objects.
Definition: PtrList.H:53
TypeName("omegaWallFunction")
Runtime type information.
virtual label & master()
Return non-const access to the master patch ID.
virtual void calculate(const momentumTransportModel &turbulence, const List< scalar > &cornerWeights, const fvPatch &patch, scalarField &G, scalarField &omega)
Calculate the omega and G.
virtual void manipulateMatrix(fvMatrix< scalar > &matrix)
Manipulate matrix.
scalarField omega_
Local copy of turbulence omega field.
Namespace for OpenFOAM.