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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2015 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::layerParameters
28 
29 Description
30  Simple container to keep together layer specific information.
31 
32 SourceFiles
33  layerParameters.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef layerParameters_H
38 #define layerParameters_H
39 
40 #include "dictionary.H"
41 #include "scalarField.H"
42 #include "labelList.H"
43 #include "Switch.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Class forward declarations
51 class polyBoundaryMesh;
52 class refinementSurfaces;
53 
54 /*---------------------------------------------------------------------------*\
55  Class layerParameters Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class layerParameters
59 {
60 public:
61 
62  // Public data types
63 
64  //- Enumeration defining the layer specification:
65  // - first and total thickness specified
66  // - first and expansion ratio specified
67  // - final and total thickness specified
68  // - final and expansion ratio specified
69  // - total thickness and expansion ratio specified
71  {
78  };
79 
80 
81 private:
82 
83  // Static data members
84 
85  //- Default angle for faces to be concave
86  static const scalar defaultConcaveAngle;
87 
88 
89  // Private Data
90 
91  const dictionary dict_;
92 
93  //- In dry-run mode?
94  const bool dryRun_;
95 
96  //- Are sizes relative to local cell size
97  bool relativeSizes_;
98 
99  //- Any additional reporting
100  bool additionalReporting_;
101 
102 
103  // Per patch (not region!) information
104 
105  //- How thickness is specified.
106  layerSpecification layerSpec_;
107 
108  //- How many layers to add.
109  labelList numLayers_;
110 
111  scalarField firstLayerThickness_;
112 
113  scalarField finalLayerThickness_;
114 
115  scalarField thickness_;
116 
117  scalarField expansionRatio_;
118 
119  //- Minimum total thickness
120  scalarField minThickness_;
121 
122 
123  scalar featureAngle_;
124 
125  scalar mergePatchFacesAngle_;
126 
127  scalar concaveAngle_;
128 
129  label nGrow_;
130 
131  scalar maxFaceThicknessRatio_;
132 
133  label nBufferCellsNoExtrude_;
134 
135  label nLayerIter_;
136 
137  label nRelaxedIter_;
138 
139  word meshShrinker_;
140 
141 
142  // Private Member Functions
143 
144  //- Calculate expansion ratio from overall size v.s. thickness of
145  // first layer.
146  scalar layerExpansionRatio
147  (
148  const label n,
149  const scalar totalOverFirst
150  ) const;
151 
152  //- No copy construct
153  layerParameters(const layerParameters&) = delete;
154 
155  //- No copy assignment
156  void operator=(const layerParameters&) = delete;
157 
158 
159 public:
160 
161  // Constructors
162 
163  //- Construct from dictionary
165  (
166  const dictionary& dict,
167  const polyBoundaryMesh&,
168  const bool dryRun = false
169  );
170 
171 
172  // Member Functions
173 
174  const dictionary& dict() const
175  {
176  return dict_;
177  }
178 
179 
180  // Per patch information
181 
182  //- How many layers to add.
183  // -1 : no specification. Assume 0 layers but allow sliding
184  // to make layers
185  // 0 : specified to have 0 layers. No sliding allowed.
186  // >0 : number of layers
187  const labelList& numLayers() const
188  {
189  return numLayers_;
190  }
191 
192  //- Are size parameters relative to inner cell size or
193  // absolute distances.
194  bool relativeSizes() const
195  {
196  return relativeSizes_;
197  }
198 
199  //- Any additional reporting requested?
200  bool additionalReporting() const
201  {
202  return additionalReporting_;
203  }
204 
205  // Expansion factor for layer mesh
206  const scalarField& expansionRatio() const
207  {
208  return expansionRatio_;
209  }
210 
211  //- Wanted thickness of the layer furthest away
212  // from the wall (i.e. nearest the original mesh).
213  // If relativeSize() this number is relative to undistorted
214  // size of the cell outside layer.
215  const scalarField& finalLayerThickness() const
216  {
217  return finalLayerThickness_;
218  }
219 
220  //- Wanted thickness of the layer nearest to the wall.
221  // If relativeSize() this number is relative to undistorted
222  // size of the cell outside layer.
223  const scalarField& firstLayerThickness() const
224  {
225  return firstLayerThickness_;
226  }
227 
228  //- Wanted overall thickness of all layers.
229  // If relativeSize() this number is relative to undistorted
230  // size of the cell outside layer.
231  const scalarField& thickness() const
232  {
233  return thickness_;
234  }
235 
236  //- Minimum overall thickness of cell layer. If for any reason layer
237  // cannot be above minThickness do not add layer.
238  // If relativeSize() this number is relative to undistorted
239  // size of the cell outside layer.
240  const scalarField& minThickness() const
241  {
242  return minThickness_;
243  }
244 
245 
246  // Control
247 
248  //- Number of overall layer addition iterations
249  label nLayerIter() const
250  {
251  return nLayerIter_;
252  }
253 
254  //- Number of iterations after which relaxed motion rules
255  // are to be used.
256  label nRelaxedIter() const
257  {
258  return nRelaxedIter_;
259  }
260 
261 
262  // Control
263 
264  scalar featureAngle() const
265  {
266  return featureAngle_;
267  }
268 
269  scalar mergePatchFacesAngle() const
270  {
271  return mergePatchFacesAngle_;
272  }
273 
274  scalar concaveAngle() const
275  {
276  return concaveAngle_;
277  }
278 
279  //- If points get not extruded do nGrow layers of connected faces
280  // that are not grown. Is used to not do layers at all close to
281  // features.
282  label nGrow() const
283  {
284  return nGrow_;
285  }
286 
287  //- Stop layer growth on highly warped cells
288  scalar maxFaceThicknessRatio() const
289  {
290  return maxFaceThicknessRatio_;
291  }
292 
293  //- Create buffer region for new layer terminations
294  label nBufferCellsNoExtrude() const
295  {
296  return nBufferCellsNoExtrude_;
297  }
298 
299  //- Type of mesh shrinker
300  const word& meshShrinker() const
301  {
302  return meshShrinker_;
303  }
304 
305 
306  // Helper
307 
308  //- Determine overall thickness. Uses two of the four parameters
309  // according to the layerSpecification
310  scalar layerThickness
311  (
312  const label nLayers,
313  const scalar firstLayerThickess,
314  const scalar finalLayerThickess,
315  const scalar totalThickness,
316  const scalar expansionRatio
317  ) const;
318 
319  //- Determine expansion ratio. Uses two of the four parameters
320  // according to the layerSpecification
321  scalar layerExpansionRatio
322  (
323  const label nLayers,
324  const scalar firstLayerThickess,
325  const scalar finalLayerThickess,
326  const scalar totalThickness,
327  const scalar expansionRatio
328  ) const;
329 
330  //- Determine first layer (near-wall) thickness. Uses two of the
331  // four parameters according to the layerSpecification
332  scalar firstLayerThickness
333  (
334  const label nLayers,
335  const scalar firstLayerThickess,
336  const scalar finalLayerThickess,
337  const scalar totalThickness,
338  const scalar expansionRatio
339  ) const;
340 
341  //- Determine ratio of final layer thickness to
342  // overall layer thickness
344  (
345  const label nLayers,
346  const scalar expansionRatio
347  ) const;
348 };
349 
350 
351 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
352 
353 } // End namespace Foam
354 
355 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
356 
357 #endif
358 
359 // ************************************************************************* //
Foam::layerParameters::nGrow
label nGrow() const
If points get not extruded do nGrow layers of connected faces.
Definition: layerParameters.H:281
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::polyBoundaryMesh
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Definition: polyBoundaryMesh.H:62
Foam::layerParameters::dict
const dictionary & dict() const
Definition: layerParameters.H:173
scalarField.H
Foam::layerParameters::maxFaceThicknessRatio
scalar maxFaceThicknessRatio() const
Stop layer growth on highly warped cells.
Definition: layerParameters.H:287
Foam::layerParameters::additionalReporting
bool additionalReporting() const
Any additional reporting requested?
Definition: layerParameters.H:199
Foam::layerParameters::nRelaxedIter
label nRelaxedIter() const
Number of iterations after which relaxed motion rules.
Definition: layerParameters.H:255
Foam::layerParameters::FINAL_AND_EXPANSION
Definition: layerParameters.H:75
Foam::layerParameters::ILLEGAL
Definition: layerParameters.H:71
Foam::layerParameters::nLayerIter
label nLayerIter() const
Number of overall layer addition iterations.
Definition: layerParameters.H:248
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::layerParameters::minThickness
const scalarField & minThickness() const
Minimum overall thickness of cell layer. If for any reason layer.
Definition: layerParameters.H:239
Foam::layerParameters::nBufferCellsNoExtrude
label nBufferCellsNoExtrude() const
Create buffer region for new layer terminations.
Definition: layerParameters.H:293
labelList.H
Foam::Field< scalar >
Foam::layerParameters::FIRST_AND_TOTAL
Definition: layerParameters.H:72
Foam::layerParameters::TOTAL_AND_EXPANSION
Definition: layerParameters.H:76
Foam::layerParameters::mergePatchFacesAngle
scalar mergePatchFacesAngle() const
Definition: layerParameters.H:268
Switch.H
Foam::layerParameters::FIRST_AND_EXPANSION
Definition: layerParameters.H:73
Foam::layerParameters
Simple container to keep together layer specific information.
Definition: layerParameters.H:57
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::layerParameters::numLayers
const labelList & numLayers() const
How many layers to add.
Definition: layerParameters.H:186
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::layerParameters::layerThickness
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.
Definition: layerParameters.C:384
Foam::layerParameters::finalLayerThicknessRatio
scalar finalLayerThicknessRatio(const label nLayers, const scalar expansionRatio) const
Determine ratio of final layer thickness to.
Definition: layerParameters.C:554
Foam::layerParameters::FINAL_AND_TOTAL
Definition: layerParameters.H:74
Foam::layerParameters::featureAngle
scalar featureAngle() const
Definition: layerParameters.H:263
Foam::layerParameters::layerSpecification
layerSpecification
Enumeration defining the layer specification:
Definition: layerParameters.H:69
Foam::List< label >
Foam::layerParameters::firstLayerThickness
const scalarField & firstLayerThickness() const
Wanted thickness of the layer nearest to the wall.
Definition: layerParameters.H:222
dictionary.H
Foam::layerParameters::expansionRatio
const scalarField & expansionRatio() const
Definition: layerParameters.H:205
Foam::layerParameters::thickness
const scalarField & thickness() const
Wanted overall thickness of all layers.
Definition: layerParameters.H:230
Foam::layerParameters::relativeSizes
bool relativeSizes() const
Are size parameters relative to inner cell size or.
Definition: layerParameters.H:193
Foam::layerParameters::finalLayerThickness
const scalarField & finalLayerThickness() const
Wanted thickness of the layer furthest away.
Definition: layerParameters.H:214
Foam::layerParameters::meshShrinker
const word & meshShrinker() const
Type of mesh shrinker.
Definition: layerParameters.H:299
Foam::layerParameters::concaveAngle
scalar concaveAngle() const
Definition: layerParameters.H:273