wallFunctionBlenders.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 -------------------------------------------------------------------------------
10 License
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 
28 #include "wallFunctionBlenders.H"
29 #include "dictionary.H"
30 #include "Enum.H"
31 #include "MinMax.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 const Foam::Enum
36 <
38 >
40 ({
41  { blenderType::STEPWISE , "stepwise" },
42  { blenderType::MAX , "max" },
43  { blenderType::BINOMIAL , "binomial" },
44  { blenderType::EXPONENTIAL, "exponential" },
45  { blenderType::TANH, "tanh" }
46 });
47 
48 
49 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50 
52 :
53  blender_(blenderType::STEPWISE),
54  n_(4.0)
55 {}
56 
57 
59 (
60  const dictionary& dict,
61  const blenderType blender,
62  const scalar n
63 )
64 :
65  blender_
66  (
67  blenderTypeNames.getOrDefault
68  (
69  "blending",
70  dict,
71  blender
72  )
73  ),
74  n_
75  (
76  dict.getCheckOrDefault<scalar>
77  (
78  "n",
79  n,
80  scalarMinMax::ge(0)
81  )
82  )
83 {}
84 
85 
86 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
87 
89 {
90  os.writeEntry("blending", blenderTypeNames[blender_]);
91 
92  if (blender_ == blenderType::BINOMIAL)
93  {
94  os.writeEntry("n", n_);
95  }
96 }
97 
98 
99 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:321
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: error.H:64
void writeEntries(Ostream &) const
Write wall-function blending data as dictionary entries.
label n
static const Enum< blenderType > blenderTypeNames
Names for blenderType.
blenderType
Options for the blending treatment of viscous and inertial sublayers.
wallFunctionBlenders()
Default construct with default coefficients.