extrudeModel.C
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-2018 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 \*---------------------------------------------------------------------------*/
25 
26 #include "extrudeModel.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32  defineTypeNameAndDebug(extrudeModel, 0);
33  defineRunTimeSelectionTable(extrudeModel, dictionary);
34 }
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
39 (
40  const word& modelType,
41  const dictionary& dict
42 )
43 :
44  nLayers_(dict.lookupOrDefault<label>("nLayers", 1)),
45  expansionRatio_(dict.lookupOrDefault<scalar>("expansionRatio", 1)),
46  dict_(dict),
47  coeffDict_(dict.optionalSubDict(modelType + "Coeffs"))
48 {}
49 
50 
51 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
52 
54 {}
55 
56 
57 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
58 
60 {
61  return nLayers_;
62 }
63 
64 
66 {
67  return expansionRatio_;
68 }
69 
70 
71 Foam::scalar Foam::extrudeModel::sumThickness(const label layer) const
72 {
73  // 1+r+r^2+ .. +r^(n-1) = (1-r^n)/(1-r)
74 
75  if (mag(1.0-expansionRatio_) < small)
76  {
77  return scalar(layer)/nLayers_;
78  }
79  else
80  {
81  return
82  (1.0-pow(expansionRatio_, layer))
83  / (1.0-pow(expansionRatio_, nLayers_));
84  }
85 }
86 
87 
88 // ************************************************************************* //
virtual ~extrudeModel()
Destructor.
Definition: extrudeModel.C:53
extrudeModel(const word &modelType, const dictionary &)
Construct from dictionary.
Definition: extrudeModel.C:39
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
const dictionary & optionalSubDict(const word &) const
Find and return a sub-dictionary if found.
Definition: dictionary.C:1060
A class for handling words, derived from string.
Definition: word.H:59
label nLayers() const
Definition: extrudeModel.C:59
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
scalar sumThickness(const label layer) const
Helper: calculate cumulative relative thickness for layer.
Definition: extrudeModel.C:71
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
dimensioned< scalar > mag(const dimensioned< Type > &)
scalar expansionRatio() const
Definition: extrudeModel.C:65
Namespace for OpenFOAM.