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_(single ? 1 : dict.lookup<label>("nLayers")),
41  expansionRatio_(single ? 1 : dict.lookup<scalar>("expansionRatio"))
42 {}
43 
44 
45 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
46 
48 {}
49 
50 
51 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
52 
54 {
55  return nLayers_;
56 }
57 
58 
60 {
61  return expansionRatio_;
62 }
63 
64 
65 Foam::scalar Foam::extrudeModel::sumThickness(const label layer) const
66 {
67  // 1+r+r^2+ .. +r^(n-1) = (1-r^n)/(1-r)
68 
69  if (mag(1.0-expansionRatio_) < small)
70  {
71  return scalar(layer)/nLayers_;
72  }
73  else
74  {
75  return
76  (1.0-pow(expansionRatio_, layer))
77  / (1.0-pow(expansionRatio_, nLayers_));
78  }
79 }
80 
81 
82 // ************************************************************************* //
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Top level extrusion model class.
Definition: extrudeModel.H:52
extrudeModel(const dictionary &, const bool single=false)
Construct from dictionary.
Definition: extrudeModel.C:38
label nLayers() const
Return the number of layers in the extrusion.
Definition: extrudeModel.C:53
virtual ~extrudeModel()
Destructor.
Definition: extrudeModel.C:47
scalar expansionRatio() const
Return the extrusion expansion ratio.
Definition: extrudeModel.C:59
scalar sumThickness(const label layer) const
Helper: calculate cumulative relative thickness for layer.
Definition: extrudeModel.C:65
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
Definition: units.C:346
Namespace for OpenFOAM.
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
defineRunTimeSelectionTable(fvConstraint, dictionary)
tmp< DimensionedField< typename powProduct< Type, r >::type, GeoMesh, Field > > pow(const DimensionedField< Type, GeoMesh, PrimitiveField > &df, typename powProduct< Type, r >::type)
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
dictionary dict