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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::layerParameters
28
29Description
30 Simple container to keep together layer specific information.
31
32SourceFiles
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#include "Enum.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51// Class forward declarations
52class polyBoundaryMesh;
53class refinementSurfaces;
54
55/*---------------------------------------------------------------------------*\
56 Class layerParameters Declaration
57\*---------------------------------------------------------------------------*/
60{
61public:
62
63 // Public data types
64
65 //- Enumeration defining the layer specification:
66 // - first and total thickness specified
67 // - first and expansion ratio specified
68 // - final and total thickness specified
69 // - final and expansion ratio specified
70 // - total thickness and expansion ratio specified
72 {
79 };
80
81
82private:
83
84 // Static data members
85
86 //- Default angle for faces to be concave
87 static const scalar defaultConcaveAngle;
88
89 //- thicknessModelType names
90 static const Enum<thicknessModelType> thicknessModelTypeNames_;
91
92
93 // Private Data
94
95 const dictionary dict_;
96
97 //- In dry-run mode?
98 const bool dryRun_;
99
100
101 // Per patch (not region!) information
102
103 //- How many layers to add.
104 labelList numLayers_;
105
106 //- Are sizes relative to local cell size
107 boolList relativeSizes_;
108
109 //- How thickness is specified.
110 List<thicknessModelType> layerModels_;
111
112 scalarField firstLayerThickness_;
113
114 scalarField finalLayerThickness_;
115
116 scalarField thickness_;
117
118 scalarField expansionRatio_;
119
120 //- Minimum total thickness
121 scalarField minThickness_;
122
123
124 const scalar featureAngle_;
125
126 const scalar mergePatchFacesAngle_;
127
128 const scalar concaveAngle_;
129
130 const label nGrow_;
131
132 const scalar maxFaceThicknessRatio_;
133
134 const label nBufferCellsNoExtrude_;
135
136 const label nLayerIter_;
137
138 label nRelaxedIter_;
139
140 //- Any additional reporting
141 const bool additionalReporting_;
142
143 const word meshShrinker_;
144
145 const label nOuterIter_;
146
147
148 // Private Member Functions
149
150 //- Calculate expansion ratio from overall size v.s. thickness of
151 // first layer.
152 static scalar layerExpansionRatio
153 (
154 const label n,
155 const scalar totalOverFirst
156 );
157
158 //- Read parameters according to thickness model
159 static void readLayerParameters
160 (
161 const bool verbose,
162 const dictionary&,
163 const thicknessModelType& spec,
164 scalar& firstLayerThickness,
165 scalar& finalLayerThickness,
166 scalar& thickness,
167 scalar& expansionRatio
168 );
169
170 void calculateLayerParameters
171 (
172 const thicknessModelType& spec,
173 const label nLayers,
174 scalar& firstLayerThickness,
175 scalar& finalLayerThickness,
176 scalar& thickness,
177 scalar& expansionRatio
178 );
179
180 //- No copy construct
181 layerParameters(const layerParameters&) = delete;
182
183 //- No copy assignment
184 void operator=(const layerParameters&) = delete;
185
186
187public:
188
189 // Constructors
190
191 //- Construct from dictionary
193 (
194 const dictionary& dict,
195 const polyBoundaryMesh&,
196 const bool dryRun = false
197 );
198
199
200 // Member Functions
202 const dictionary& dict() const
203 {
204 return dict_;
205 }
206
207
208 // Per patch information
209
210 //- How many layers to add.
211 // -1 : no specification. Assume 0 layers but allow sliding
212 // to make layers
213 // 0 : specified to have 0 layers. No sliding allowed.
214 // >0 : number of layers
215 const labelList& numLayers() const
216 {
217 return numLayers_;
218 }
219
220 //- Are size parameters relative to inner cell size or
221 // absolute distances.
222 const boolList& relativeSizes() const
223 {
224 return relativeSizes_;
225 }
226
227 //- Specification of layer thickness
229 {
230 return layerModels_;
231 }
232
233 // Expansion factor for layer mesh
234 const scalarField& expansionRatio() const
235 {
236 return expansionRatio_;
237 }
238
239 //- Wanted thickness of the layer furthest away
240 // from the wall (i.e. nearest the original mesh).
241 // If relativeSize() this number is relative to undistorted
242 // size of the cell outside layer.
243 const scalarField& finalLayerThickness() const
244 {
245 return finalLayerThickness_;
246 }
247
248 //- Wanted thickness of the layer nearest to the wall.
249 // If relativeSize() this number is relative to undistorted
250 // size of the cell outside layer.
251 const scalarField& firstLayerThickness() const
252 {
253 return firstLayerThickness_;
254 }
255
256 //- Wanted overall thickness of all layers.
257 // If relativeSize() this number is relative to undistorted
258 // size of the cell outside layer.
259 const scalarField& thickness() const
260 {
261 return thickness_;
262 }
263
264 //- Minimum overall thickness of cell layer. If for any reason layer
265 // cannot be above minThickness do not add layer.
266 // If relativeSize() this number is relative to undistorted
267 // size of the cell outside layer.
268 const scalarField& minThickness() const
269 {
270 return minThickness_;
271 }
272
273
274 // Control
275
276 //- Number of overall layer addition iterations
277 label nLayerIter() const
278 {
279 return nLayerIter_;
280 }
281
282 //- Outer loop to add layer by layer. Can be set to >= max layers
283 // in which case layers get added one at a time. This can help
284 // layer insertion since the newly added layers get included in
285 // the shrinking. Default is 1 -> add all layers in one go.
286 label nOuterIter() const
287 {
288 return nOuterIter_;
289 }
290
291 //- Number of iterations after which relaxed motion rules
292 // are to be used.
293 label nRelaxedIter() const
294 {
295 return nRelaxedIter_;
296 }
297
298
299 // Control
301 scalar featureAngle() const
302 {
303 return featureAngle_;
304 }
306 scalar mergePatchFacesAngle() const
307 {
308 return mergePatchFacesAngle_;
309 }
311 scalar concaveAngle() const
312 {
313 return concaveAngle_;
314 }
315
316 //- If points get not extruded do nGrow layers of connected faces
317 // that are not grown. Is used to not do layers at all close to
318 // features.
319 label nGrow() const
320 {
321 return nGrow_;
322 }
323
324 //- Stop layer growth on highly warped cells
325 scalar maxFaceThicknessRatio() const
326 {
327 return maxFaceThicknessRatio_;
328 }
329
330 //- Create buffer region for new layer terminations
331 label nBufferCellsNoExtrude() const
332 {
333 return nBufferCellsNoExtrude_;
334 }
335
336 //- Any additional reporting requested?
337 bool additionalReporting() const
338 {
339 return additionalReporting_;
340 }
341
342 //- Type of mesh shrinker
343 const word& meshShrinker() const
344 {
345 return meshShrinker_;
346 }
347
348
349 // Helper
350
351 //- Determine overall thickness. Uses two of the four parameters
352 // according to the thicknessModel
353 static scalar layerThickness
354 (
355 const thicknessModelType,
356 const label nLayers,
357 const scalar firstLayerThickness,
358 const scalar finalLayerThickness,
359 const scalar totalThickness,
360 const scalar expansionRatio
361 );
362
363 //- Determine expansion ratio. Uses two of the four parameters
364 // according to the thicknessModel
365 static scalar layerExpansionRatio
366 (
367 const thicknessModelType,
368 const label nLayers,
369 const scalar firstLayerThickness,
370 const scalar finalLayerThickness,
371 const scalar totalThickness,
372 const scalar expansionRatio
373 );
374
375 //- Determine first layer (near-wall) thickness. Uses two of the
376 // four parameters according to the thicknessModel
377 static scalar firstLayerThickness
378 (
379 const thicknessModelType,
380 const label nLayers,
381 const scalar firstLayerThickness,
382 const scalar finalLayerThickness,
383 const scalar totalThickness,
384 const scalar expansionRatio
385 );
386
387 //- Determine ratio of final layer thickness to
388 // overall layer thickness
389 static scalar finalLayerThicknessRatio
390 (
391 const label nLayers,
392 const scalar expansionRatio
393 );
394
395 //- Determine overall thickness of a slice (usually 1 layer)
396 static scalar layerThickness
397 (
398 const label nLayers,
399 const scalar layerThickness, // overall thickness
400 const scalar expansionRatio, // expansion ratio
401 const label layerStart, // starting layer (0=firstLayer)
402 const label layerSize // number of layers in slice
403 );
404};
405
406
407// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
408
409} // End namespace Foam
410
411// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
412
413#endif
414
415// ************************************************************************* //
label n
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Simple container to keep together layer specific information.
const List< thicknessModelType > & layerModels() const
Specification of layer thickness.
scalar mergePatchFacesAngle() const
const scalarField & finalLayerThickness() const
Wanted thickness of the layer furthest away.
const scalarField & minThickness() const
Minimum overall thickness of cell layer. If for any reason layer.
scalar featureAngle() const
label nRelaxedIter() const
Number of iterations after which relaxed motion rules.
const scalarField & expansionRatio() const
const word & meshShrinker() const
Type of mesh shrinker.
bool additionalReporting() const
Any additional reporting requested?
const scalarField & thickness() const
Wanted overall thickness of all layers.
thicknessModelType
Enumeration defining the layer specification:
scalar concaveAngle() const
label nGrow() const
If points get not extruded do nGrow layers of connected faces.
static scalar layerThickness(const thicknessModelType, const label nLayers, const scalar firstLayerThickness, const scalar finalLayerThickness, const scalar totalThickness, const scalar expansionRatio)
Determine overall thickness. Uses two of the four parameters.
const scalarField & firstLayerThickness() const
Wanted thickness of the layer nearest to the wall.
label nOuterIter() const
Outer loop to add layer by layer. Can be set to >= max layers.
label nBufferCellsNoExtrude() const
Create buffer region for new layer terminations.
scalar maxFaceThicknessRatio() const
Stop layer growth on highly warped cells.
label nLayerIter() const
Number of overall layer addition iterations.
static scalar finalLayerThicknessRatio(const label nLayers, const scalar expansionRatio)
Determine ratio of final layer thickness to.
const dictionary & dict() const
const boolList & relativeSizes() const
Are size parameters relative to inner cell size or.
const labelList & numLayers() const
How many layers to add.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
List< bool > boolList
A List of bools.
Definition: List.H:64