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