wallFunctionCoefficients.C
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) 2022 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
29#include "dictionary.H"
30#include "MinMax.H"
31
32// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
33
34namespace Foam
35{
36
37//- Estimate the y+ at the intersection of the two sublayers
38static scalar calcYPlusLam
39(
40 const scalar kappa,
41 const scalar E
42)
43{
44 scalar ypl = 11;
45
46 for (int iter = 0; iter < 10; ++iter)
47 {
48 ypl = log(max(E*ypl, scalar(1)))/kappa;
49 }
50
51 return ypl;
52}
53
54} // End namespace Foam
55
56
57// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
58
60:
61 Cmu_(0.09),
62 kappa_(0.41),
63 E_(9.8),
64 yPlusLam_(calcYPlusLam(kappa_, E_))
65{}
66
67
69(
70 const dictionary& dict
71)
72:
73 Cmu_(dict.getOrDefault<scalar>("Cmu", 0.09)),
74 kappa_
75 (
76 dict.getCheckOrDefault<scalar>("kappa", 0.41, scalarMinMax::ge(SMALL))
77 ),
78 E_(dict.getCheckOrDefault<scalar>("E", 9.8, scalarMinMax::ge(SMALL))),
79 yPlusLam_(calcYPlusLam(kappa_, E_))
80{}
81
82
83// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
84
86(
87 Ostream& os
88) const
89{
90 os.writeEntryIfDifferent<scalar>("Cmu", 0.09, Cmu_);
91 os.writeEntryIfDifferent<scalar>("kappa", 0.41, kappa_);
92 os.writeEntryIfDifferent<scalar>("E", 9.8, E_);
93}
94
95
96// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
Definition: Ostream.H:251
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
void writeEntries(Ostream &) const
Write wall-function coefficients as dictionary entries.
wallFunctionCoefficients()
Construct with default coefficients.
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
static scalar calcYPlusLam(const scalar kappa, const scalar E)
Estimate the y+ at the intersection of the two sublayers.
dimensionedScalar log(const dimensionedScalar &ds)
dictionary dict