layerParameters.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2016 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 Class
25  Foam::layerParameters
26 
27 Description
28  Simple container to keep together layer specific information.
29 
30 SourceFiles
31  layerParameters.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef layerParameters_H
36 #define layerParameters_H
37 
38 #include "dictionary.H"
39 #include "scalarField.H"
40 #include "labelList.H"
41 #include "Switch.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Class forward declarations
49 class polyBoundaryMesh;
50 class refinementSurfaces;
51 
52 /*---------------------------------------------------------------------------*\
53  Class layerParameters Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class layerParameters
57 {
58 public:
59 
60  // Public data types
61 
62  //- Enumeration defining the layer specification:
63  //
64  // - first and total thickness specified
65  // - first and expansion ratio specified
66  // - final and total thickness specified
67  // - final and expansion ratio specified
68  // - total thickness and expansion ratio specified
70  {
77  };
78 
79 
80 private:
81 
82  // Static data members
83 
84  //- Default angle for faces to be convcave
85  static const scalar defaultConcaveAngle;
86 
87 
88  // Private data
89 
90  const dictionary dict_;
91 
92 
93  // Per patch (not region!) information
94 
95  //- How many layers to add.
96  labelList numLayers_;
97 
98  //- Are sizes relative to local cell size
99  Switch relativeSizes_;
100 
101  //- How thickness is specified.
102  layerSpecification layerSpec_;
103 
104  scalarField firstLayerThickness_;
105 
106  scalarField finalLayerThickness_;
107 
108  scalarField thickness_;
109 
110  scalarField expansionRatio_;
111 
112  //- Minimum total thickness
113  scalarField minThickness_;
114 
115 
116  scalar featureAngle_;
117 
118  scalar concaveAngle_;
119 
120  label nGrow_;
121 
122  scalar maxFaceThicknessRatio_;
123 
124  label nBufferCellsNoExtrude_;
125 
126  label nLayerIter_;
127 
128  label nRelaxedIter_;
129 
130  Switch additionalReporting_;
131 
132  word meshShrinker_;
133 
134 
135  // Private Member Functions
136 
137  //- Calculate expansion ratio from overall size v.s. thickness of
138  // first layer.
139  scalar layerExpansionRatio
140  (
141  const label n,
142  const scalar totalOverFirst
143  ) const;
144 
145  //- Disallow default bitwise copy construct
147 
148  //- Disallow default bitwise assignment
149  void operator=(const layerParameters&);
150 
151 
152 public:
153 
154  // Constructors
155 
156  //- Construct from dictionary
158 
159 
160  // Member Functions
162  const dictionary& dict() const
163  {
164  return dict_;
165  }
166 
167 
168  // Per patch information
169 
170  //- How many layers to add:
171  //
172  // - -1 : no specification. Assume 0 layers but allow sliding
173  // to make layers
174  // - 0 : specified to have 0 layers. No sliding allowed.
175  // - >0 : number of layers
176  const labelList& numLayers() const
177  {
178  return numLayers_;
179  }
180 
181  //- Are size parameters relative to inner cell size or
182  // absolute distances.
183  bool relativeSizes() const
184  {
185  return relativeSizes_;
186  }
187 
188  // Expansion factor for layer mesh
189  const scalarField& expansionRatio() const
190  {
191  return expansionRatio_;
192  }
193 
194  //- Wanted thickness of the layer furthest away
195  // from the wall (i.e. nearest the original mesh).
196  // If relativeSize() this number is relative to undistorted
197  // size of the cell outside layer.
198  const scalarField& finalLayerThickness() const
199  {
200  return finalLayerThickness_;
201  }
202 
203  //- Wanted thickness of the layer nearest to the wall.
204  // If relativeSize() this number is relative to undistorted
205  // size of the cell outside layer.
206  const scalarField& firstLayerThickness() const
207  {
208  return firstLayerThickness_;
209  }
210 
211  //- Wanted overall thickness of all layers.
212  // If relativeSize() this number is relative to undistorted
213  // size of the cell outside layer.
214  const scalarField& thickness() const
215  {
216  return thickness_;
217  }
218 
219  //- Minimum overall thickness of cell layer. If for any reason layer
220  // cannot be above minThickness do not add layer.
221  // If relativeSize() this number is relative to undistorted
222  // size of the cell outside layer.
223  const scalarField& minThickness() const
224  {
225  return minThickness_;
226  }
227 
228 
229  // Control
230 
231  //- Number of overall layer addition iterations
232  label nLayerIter() const
233  {
234  return nLayerIter_;
235  }
236 
237  //- Number of iterations after which relaxed motion rules
238  // are to be used.
239  label nRelaxedIter() const
240  {
241  return nRelaxedIter_;
242  }
243 
244 
245  // Control
247  scalar featureAngle() const
248  {
249  return featureAngle_;
250  }
252  scalar concaveAngle() const
253  {
254  return concaveAngle_;
255  }
256 
257  //- If points get not extruded do nGrow layers of connected faces
258  // that are not grown. Is used to not do layers at all close to
259  // features.
260  label nGrow() const
261  {
262  return nGrow_;
263  }
264 
265  //- Stop layer growth on highly warped cells
266  scalar maxFaceThicknessRatio() const
267  {
268  return maxFaceThicknessRatio_;
269  }
270 
271  //- Create buffer region for new layer terminations
273  {
274  return nBufferCellsNoExtrude_;
275  }
277  const Switch& additionalReporting() const
278  {
279  return additionalReporting_;
280  }
281 
282  //- Type of mesh shrinker
283  const word& meshShrinker() const
284  {
285  return meshShrinker_;
286  }
287 
288 
289  // Helper
290 
291  //- Determine overall thickness. Uses two of the four parameters
292  // according to the layerSpecification
293  scalar layerThickness
294  (
295  const label nLayers,
296  const scalar firstLayerThickess,
297  const scalar finalLayerThickess,
298  const scalar totalThickness,
299  const scalar expansionRatio
300  ) const;
301 
302  //- Determine expansion ratio. Uses two of the four parameters
303  // according to the layerSpecification
304  scalar layerExpansionRatio
305  (
306  const label nLayers,
307  const scalar firstLayerThickess,
308  const scalar finalLayerThickess,
309  const scalar totalThickness,
310  const scalar expansionRatio
311  ) const;
312 
313  //- Determine first layer (near-wall) thickness. Uses two of the
314  // four parameters according to the layerSpecification
315  scalar firstLayerThickness
316  (
317  const label nLayers,
318  const scalar firstLayerThickess,
319  const scalar finalLayerThickess,
320  const scalar totalThickness,
321  const scalar expansionRatio
322  ) const;
323 
324  //- Determine ratio of final layer thickness to
325  // overall layer thickness
327  (
328  const label nLayers,
329  const scalar expansionRatio
330  ) const;
331 };
332 
333 
334 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
335 
336 } // End namespace Foam
337 
338 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
339 
340 #endif
341 
342 // ************************************************************************* //
layerSpecification
Enumeration defining the layer specification:
Simple container to keep together layer specific information.
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
scalar concaveAngle() const
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none.
Definition: Switch.H:60
label nBufferCellsNoExtrude() const
Create buffer region for new layer terminations.
const dictionary & dict() const
const labelList & numLayers() const
How many layers to add:
label nRelaxedIter() const
Number of iterations after which relaxed motion rules.
scalar maxFaceThicknessRatio() const
Stop layer growth on highly warped cells.
scalar finalLayerThicknessRatio(const label nLayers, const scalar expansionRatio) const
Determine ratio of final layer thickness to.
scalar layerThickness(const label nLayers, const scalar firstLayerThickess, const scalar finalLayerThickess, const scalar totalThickness, const scalar expansionRatio) const
Determine overall thickness. Uses two of the four parameters.
A class for handling words, derived from string.
Definition: word.H:59
const scalarField & firstLayerThickness() const
Wanted thickness of the layer nearest to the wall.
const scalarField & minThickness() const
Minimum overall thickness of cell layer. If for any reason layer.
scalar featureAngle() const
label nLayerIter() const
Number of overall layer addition iterations.
Foam::polyBoundaryMesh.
const scalarField & expansionRatio() const
const scalarField & thickness() const
Wanted overall thickness of all layers.
bool relativeSizes() const
Are size parameters relative to inner cell size or.
label nGrow() const
If points get not extruded do nGrow layers of connected faces.
const scalarField & finalLayerThickness() const
Wanted thickness of the layer furthest away.
const word & meshShrinker() const
Type of mesh shrinker.
const Switch & additionalReporting() const
label n
Namespace for OpenFOAM.