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-2025 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 {
34 }
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
39 :
40  nLayers_(dict.lookupOrDefault<label>("nLayers", 1)),
41  expansionRatio_(dict.lookupOrDefault<scalar>("expansionRatio", 1))
42 {}
43 
44 
45 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
46 
48 {}
49 
50 
51 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
52 
54 (
55  const dictionary& dict
56 ) const
57 {
58  return dict.optionalSubDict(type() + "Coeffs");
59 }
60 
61 
63 {
64  return nLayers_;
65 }
66 
67 
69 {
70  return expansionRatio_;
71 }
72 
73 
74 Foam::scalar Foam::extrudeModel::sumThickness(const label layer) const
75 {
76  // 1+r+r^2+ .. +r^(n-1) = (1-r^n)/(1-r)
77 
78  if (mag(1.0-expansionRatio_) < small)
79  {
80  return scalar(layer)/nLayers_;
81  }
82  else
83  {
84  return
85  (1.0-pow(expansionRatio_, layer))
86  / (1.0-pow(expansionRatio_, nLayers_));
87  }
88 }
89 
90 
91 // ************************************************************************* //
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
const dictionary & optionalSubDict(const word &) const
Find and return a sub-dictionary if found.
Definition: dictionary.C:927
Top level extrusion model class.
Definition: extrudeModel.H:52
label nLayers() const
Return the number of layers in the extrusion.
Definition: extrudeModel.C:62
virtual ~extrudeModel()
Destructor.
Definition: extrudeModel.C:47
scalar expansionRatio() const
Return the extrusion expansion ratio.
Definition: extrudeModel.C:68
extrudeModel(const dictionary &)
Construct from dictionary.
Definition: extrudeModel.C:38
scalar sumThickness(const label layer) const
Helper: calculate cumulative relative thickness for layer.
Definition: extrudeModel.C:74
const dictionary & coeffDict(const dictionary &dict) const
Backward compatibility function.
Definition: extrudeModel.C:54
Namespace for OpenFOAM.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
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
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
void pow(LagrangianPatchField< typename powProduct< Type, r >::type > &f, const LagrangianPatchField< Type > &f1)
defineTypeNameAndDebug(combustionModel, 0)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
dictionary dict