snappyHexMeshDict 12.6 KB
Newer Older
1
/*--------------------------------*- C++ -*----------------------------------*\
Mattijs Janssens's avatar
Mattijs Janssens committed
2
3
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
mattijs's avatar
mattijs committed
4
|  \\    /   O peration     | Version:  dev                                   |
henry's avatar
henry committed
5
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
Mattijs Janssens's avatar
Mattijs Janssens committed
6
7
8
9
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
10
11
12
    version     2.0;
    format      ascii;
    class       dictionary;
13
    object      snappyHexMeshDict;
Mattijs Janssens's avatar
Mattijs Janssens committed
14
15
16
17
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Mattijs Janssens's avatar
Mattijs Janssens committed
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Which of the steps to run
castellatedMesh true;
snap            true;
addLayers       false;


// Geometry. Definition of all surfaces. All surfaces are of class
// searchableSurface.
// Surfaces are used
// - to specify refinement for any mesh cell intersecting it
// - to specify refinement for any mesh cell inside/outside/near
// - to 'snap' the mesh boundary to the surface
geometry
{
32
33
34
35
36
37
38
39
40
41
42
    box1x1x1
    {
        type searchableBox;
        min (1.5 1 -0.5);
        max (3.5 2 0.5);
    }

    sphere.stl
    {
        type triSurfaceMesh;

43
        //tolerance   1E-5;   // optional:non-default tolerance on intersections
mattijs's avatar
mattijs committed
44
45
46
        //maxTreeDepth 10;    // optional:depth of octree. Decrease only in case
                              // of memory limitations.

47
48
49
50
51
52
53
54
55
        // Per region the patchname. If not provided will be <name>_<region>.
        regions
        {
            secondSolid
            {
                name mySecondPatch;
            }
        }
    }
Mattijs Janssens's avatar
Mattijs Janssens committed
56
57
58
59
60
61
62
63
64
65
66
67
68

    sphere2
    {
        type searchableSphere;
        centre  (1.5 1.5 1.5);
        radius  1.03;
    }
};



// Settings for the castellatedMesh generation.
castellatedMeshControls
Mattijs Janssens's avatar
Mattijs Janssens committed
69
70
{

Mattijs Janssens's avatar
Mattijs Janssens committed
71
72
    // Refinement parameters
    // ~~~~~~~~~~~~~~~~~~~~~
Mattijs Janssens's avatar
Mattijs Janssens committed
73

74
75
76
    // If local number of cells is >= maxLocalCells on any processor
    // switches from from refinement followed by balancing
    // (current method) to (weighted) balancing before refinement.
Mattijs Janssens's avatar
Mattijs Janssens committed
77
    maxLocalCells 1000000;
Mattijs Janssens's avatar
Mattijs Janssens committed
78
79
80
81

    // Overall cell limit (approximately). Refinement will stop immediately
    // upon reaching this number so a refinement level might not complete.
    // Note that this is the number of cells before removing the part which
Mattijs Janssens's avatar
Mattijs Janssens committed
82
83
84
    // is not 'visible' from the keepPoint. The final number of cells might
    // actually be a lot less.
    maxGlobalCells 2000000;
Mattijs Janssens's avatar
Mattijs Janssens committed
85
86
87
88
89

    // The surface refinement loop might spend lots of iterations refining just a
    // few cells. This setting will cause refinement to stop if <= minimumRefine
    // are selected for refinement. Note: it will at least do one iteration
    // (unless the number of cells to refine is 0)
Mattijs Janssens's avatar
Mattijs Janssens committed
90
    minRefinementCells 0;
Mattijs Janssens's avatar
Mattijs Janssens committed
91

92
93
94
95
96
97
98
    // Allow a certain level of imbalance during refining
    // (since balancing is quite expensive)
    // Expressed as fraction of perfect balance (= overall number of cells /
    // nProcs). 0=balance always.
    maxLoadUnbalance 0.10;


Mattijs Janssens's avatar
Mattijs Janssens committed
99
100
101
    // Number of buffer layers between different levels.
    // 1 means normal 2:1 refinement restriction, larger means slower
    // refinement.
Mattijs Janssens's avatar
Mattijs Janssens committed
102
103
    nCellsBetweenLevels 1;

Mattijs Janssens's avatar
Mattijs Janssens committed
104
105


Mattijs Janssens's avatar
Mattijs Janssens committed
106
107
    // Explicit feature edge refinement
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mattijs Janssens's avatar
Mattijs Janssens committed
108

109
110
    // Specifies a level for any cell intersected by explicitly provided
    // edges.
Mattijs Janssens's avatar
Mattijs Janssens committed
111
    // This is a featureEdgeMesh, read from constant/triSurface for now.
Mattijs Janssens's avatar
Mattijs Janssens committed
112
113
    features
    (
Mattijs Janssens's avatar
Mattijs Janssens committed
114
115
116
117
        //{
        //    file "someLine.eMesh";
        //    level 2;
        //}
Mattijs Janssens's avatar
Mattijs Janssens committed
118
119
120
121
122
123
124
    );



    // Surface based refinement
    // ~~~~~~~~~~~~~~~~~~~~~~~~

Mattijs Janssens's avatar
Mattijs Janssens committed
125
126
127
128
129
    // Specifies two levels for every surface. The first is the minimum level,
    // every cell intersecting a surface gets refined up to the minimum level.
    // The second level is the maximum level. Cells that 'see' multiple
    // intersections where the intersections make an
    // angle > resolveFeatureAngle get refined up to the maximum level.
Mattijs Janssens's avatar
Mattijs Janssens committed
130

Mattijs Janssens's avatar
Mattijs Janssens committed
131
132
133
    refinementSurfaces
    {
        sphere.stl
Mattijs Janssens's avatar
Mattijs Janssens committed
134
        {
Mattijs Janssens's avatar
Mattijs Janssens committed
135
136
            // Surface-wise min and max refinement level
            level (2 2);
137

Mattijs Janssens's avatar
Mattijs Janssens committed
138
            // Optional region-wise level specification
Mattijs Janssens's avatar
Mattijs Janssens committed
139
            regions
Mattijs Janssens's avatar
Mattijs Janssens committed
140
141
            {
                secondSolid
Mattijs Janssens's avatar
Mattijs Janssens committed
142
                {
Mattijs Janssens's avatar
Mattijs Janssens committed
143
                    level (3 3);
Mattijs Janssens's avatar
Mattijs Janssens committed
144
                }
Mattijs Janssens's avatar
Mattijs Janssens committed
145
            }
mattijs's avatar
mattijs committed
146

147
148
149
150
            //- Optional angle to detect small-large cell situation
            //  perpendicular to the surface. Is the angle of face w.r.t.
            //  the local surface normal. Use on flat(ish) surfaces only.
            //  Otherwise leave out or set to negative number.
mattijs's avatar
mattijs committed
151
            //perpendicularAngle 10;
152
153
154
155
156


            //- Optional faceZone and (for closed surface) cellZone with
            //  how to select the cells that are in the cellZone
            //  (inside / outside / specified insidePoint)
graham's avatar
graham committed
157
            //faceZone sphere;
158
159
            //cellZone sphere;
            //cellZoneInside inside;  //outside/insidePoint
Mattijs Janssens's avatar
Mattijs Janssens committed
160
        }
Mattijs Janssens's avatar
Mattijs Janssens committed
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
    }

    resolveFeatureAngle 30;


    // Region-wise refinement
    // ~~~~~~~~~~~~~~~~~~~~~~

    // Specifies refinement level for cells in relation to a surface. One of
    // three modes
    // - distance. 'levels' specifies per distance to the surface the
    //   wanted refinement level. The distances need to be specified in
    //   descending order.
    // - inside. 'levels' is only one entry and only the level is used. All
    //   cells inside the surface get refined up to the level. The surface
    //   needs to be closed for this to be possible.
    // - outside. Same but cells outside.

    refinementRegions
    {
181
182
183
184
185
        box1x1x1
        {
            mode inside;
            levels ((1.0 4));
        }
Mattijs Janssens's avatar
Mattijs Janssens committed
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
        //sphere.stl
        //{
        //    mode distance;
        //    levels ((1.0 5) (2.0 3));
        //}
    }


    // Mesh selection
    // ~~~~~~~~~~~~~~

    // After refinement patches get added for all refinementSurfaces and
    // all cells intersecting the surfaces get put into these patches. The
    // section reachable from the locationInMesh is kept.
    // NOTE: This point should never be on a face, always inside a cell, even
    // after refinement.
    locationInMesh (5 0.28 0.43);
203
204
205
206
207
208


    // Whether any faceZones (as specified in the refinementSurfaces)
    // are only on the boundary of corresponding cellZones or also allow
    // free-standing zone faces. Not used if there are no faceZones.
    allowFreeStandingZoneFaces true;
Mattijs Janssens's avatar
Mattijs Janssens committed
209
210
}

Mattijs Janssens's avatar
Mattijs Janssens committed
211
212
213
214


// Settings for the snapping.
snapControls
Mattijs Janssens's avatar
Mattijs Janssens committed
215
216
217
218
219
{
    //- Number of patch smoothing iterations before finding correspondence
    //  to surface
    nSmoothPatch 3;

220
221
222
    //- Maximum relative distance for points to be attracted by surface.
    //  True distance is this factor times local maximum edge length.
    // Note: changed(corrected) w.r.t 17x! (17x used 2* tolerance)
mattijs's avatar
mattijs committed
223
    tolerance 1.0;
Mattijs Janssens's avatar
Mattijs Janssens committed
224

Mattijs Janssens's avatar
Mattijs Janssens committed
225
226
    //- Number of mesh displacement relaxation iterations.
    nSolveIter 30;
Mattijs Janssens's avatar
Mattijs Janssens committed
227
228
229

    //- Maximum number of snapping relaxation iterations. Should stop
    //  before upon reaching a correct mesh.
Mattijs Janssens's avatar
Mattijs Janssens committed
230
    nRelaxIter 5;
mattijs's avatar
mattijs committed
231
232
233
234

    //- Highly experimental and wip: number of feature edge snapping
    //  iterations. Leave out altogether to disable.
    //nFeatureSnapIter 10;
Mattijs Janssens's avatar
Mattijs Janssens committed
235
236
237
}


Mattijs Janssens's avatar
Mattijs Janssens committed
238
239
240

// Settings for the layer addition.
addLayersControls
Mattijs Janssens's avatar
Mattijs Janssens committed
241
{
mattijs's avatar
mattijs committed
242
243
    // Are the thickness parameters below relative to the undistorted
    // size of the refined cell outside layer (true) or absolute sizes (false).
mattijs's avatar
mattijs committed
244
245
    relativeSizes true;

Mattijs Janssens's avatar
Mattijs Janssens committed
246
247
248
249
250
251
    // Per final patch (so not geometry!) the layer information
    layers
    {
        sphere.stl_firstSolid
        {
            nSurfaceLayers 1;
Mattijs Janssens's avatar
Mattijs Janssens committed
252

Mattijs Janssens's avatar
Mattijs Janssens committed
253
254
255
256
257
258
259
260
261
        }
        maxY
        {
            nSurfaceLayers 1;
        }
    }

    // Expansion factor for layer mesh
    expansionRatio 1.0;
Mattijs Janssens's avatar
Mattijs Janssens committed
262

mattijs's avatar
mattijs committed
263

Mattijs Janssens's avatar
Mattijs Janssens committed
264
    //- Wanted thickness of final added cell layer. If multiple layers
mattijs's avatar
mattijs committed
265
266
267
    //  is the
    //  thickness of the layer furthest away from the wall.
    //  Relative to undistorted size of cell outside layer.
mattijs's avatar
mattijs committed
268
269
    //  is the thickness of the layer furthest away from the wall.
    //  See relativeSizes parameter.
mattijs's avatar
mattijs committed
270
    finalLayerThickness 0.3;
Mattijs Janssens's avatar
Mattijs Janssens committed
271

Mattijs Janssens's avatar
Mattijs Janssens committed
272
273
    //- Minimum thickness of cell layer. If for any reason layer
    //  cannot be above minThickness do not add layer.
mattijs's avatar
mattijs committed
274
    //  See relativeSizes parameter.
Mattijs Janssens's avatar
Mattijs Janssens committed
275
276
277
    minThickness 0.25;

    //- If points get not extruded do nGrow layers of connected faces that are
Mattijs Janssens's avatar
Mattijs Janssens committed
278
279
    //  also not grown. This helps convergence of the layer addition process
    //  close to features.
280
    // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x)
281
    nGrow 0;
Mattijs Janssens's avatar
Mattijs Janssens committed
282
283


Mattijs Janssens's avatar
Mattijs Janssens committed
284
285
286
287
288
289
290
291
292
    // Advanced settings

    //- When not to extrude surface. 0 is flat surface, 90 is when two faces
    //  make straight angle.
    featureAngle 60;

    //- Maximum number of snapping relaxation iterations. Should stop
    //  before upon reaching a correct mesh.
    nRelaxIter 5;
Mattijs Janssens's avatar
Mattijs Janssens committed
293

294
    // Number of smoothing iterations of surface normals
Mattijs Janssens's avatar
Mattijs Janssens committed
295
296
    nSmoothSurfaceNormals 1;

297
    // Number of smoothing iterations of interior mesh movement direction
Mattijs Janssens's avatar
Mattijs Janssens committed
298
299
300
301
302
    nSmoothNormals 3;

    // Smooth layer thickness over surface patches
    nSmoothThickness 10;

303
    // Stop layer growth on highly warped cells
Mattijs Janssens's avatar
Mattijs Janssens committed
304
305
    maxFaceThicknessRatio 0.5;

306
307
    // Reduce layer growth where ratio thickness to medial
    // distance is large
Mattijs Janssens's avatar
Mattijs Janssens committed
308
309
310
    maxThicknessToMedialRatio 0.3;

    // Angle used to pick up medial axis points
311
    // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x.
312
    minMedianAxisAngle 90;
Mattijs Janssens's avatar
Mattijs Janssens committed
313
314
315

    // Create buffer region for new layer terminations
    nBufferCellsNoExtrude 0;
mattijs's avatar
mattijs committed
316
317


mattijs's avatar
mattijs committed
318
319
320
    // Overall max number of layer addition iterations. The mesher will exit
    // if it reaches this number of iterations; possibly with an illegal
    // mesh.
mattijs's avatar
mattijs committed
321
322
323
    nLayerIter 50;

    // Max number of iterations after which relaxed meshQuality controls
mattijs's avatar
mattijs committed
324
325
    // get used. Up to nRelaxIter it uses the settings in meshQualityControls,
    // after nRelaxIter it uses the values in meshQualityControls::relaxed.
mattijs's avatar
mattijs committed
326
    nRelaxedIter 20;
Mattijs Janssens's avatar
Mattijs Janssens committed
327
328
329
330
}



Mattijs Janssens's avatar
Mattijs Janssens committed
331
332
333
334
// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
Mattijs Janssens's avatar
Mattijs Janssens committed
335
336
337
338
339
340
341
342
343
344
345
346
347
    //- Maximum non-orthogonality allowed. Set to 180 to disable.
    maxNonOrtho 65;

    //- Max skewness allowed. Set to <0 to disable.
    maxBoundarySkewness 20;
    maxInternalSkewness 4;

    //- Max concaveness allowed. Is angle (in degrees) below which concavity
    //  is allowed. 0 is straight face, <0 would be convex face.
    //  Set to 180 to disable.
    maxConcave 80;

    //- Minimum pyramid volume. Is absolute volume of cell pyramid.
mattijs's avatar
comment    
mattijs committed
348
    //  Set to a sensible fraction of the smallest cell volume expected.
Mattijs Janssens's avatar
Mattijs Janssens committed
349
350
351
    //  Set to very negative number (e.g. -1E30) to disable.
    minVol 1e-13;

352
353
    //- Minimum quality of the tet formed by the face-centre
    //  and variable base point minimum decomposition triangles and
354
355
    //  the cell centre. This has to be a positive number for tracking
    //  to work. Set to very negative number (e.g. -1E30) to
356
357
358
359
360
    //  disable.
    //     <0 = inside out tet,
    //      0 = flat tet
    //      1 = regular tet
    minTetQuality 1e-9;
361

Mattijs Janssens's avatar
Mattijs Janssens committed
362
363
364
365
366
367
368
369
370
371
372
    //- Minimum face area. Set to <0 to disable.
    minArea -1;

    //- Minimum face twist. Set to <-1 to disable. dot product of face normal
    //- and face centre triangles normal
    minTwist 0.05;

    //- minimum normalised cell determinant
    //- 1 = hex, <= 0 = folded or flattened illegal cell
    minDeterminant 0.001;

373
    //- minFaceWeight (0 -> 0.5)
Mattijs Janssens's avatar
Mattijs Janssens committed
374
375
376
377
378
379
380
381
    minFaceWeight 0.05;

    //- minVolRatio (0 -> 1)
    minVolRatio 0.01;

    //must be >0 for Fluent compatibility
    minTriangleTwist -1;

mattijs's avatar
mattijs committed
382
    //- if >0 : preserve single cells with all points on the surface if the
mattijs's avatar
mattijs committed
383
384
385
386
    //  resulting volume after snapping (by approximation) is larger than
    //  minVolCollapseRatio times old volume (i.e. not collapsed to flat cell).
    //  If <0 : delete always.
    //minVolCollapseRatio 0.5;
mattijs's avatar
mattijs committed
387

Mattijs Janssens's avatar
Mattijs Janssens committed
388

Mattijs Janssens's avatar
Mattijs Janssens committed
389
390
391
392
393
394
    // Advanced

    //- Number of error distribution iterations
    nSmoothScale 4;
    //- amount to scale back displacement at error points
    errorReduction 0.75;
mattijs's avatar
mattijs committed
395
396
397
398
399
400
401
402
403
404



    // Optional : some meshing phases allow usage of relaxed rules.
    // See e.g. addLayersControls::nRelaxedIter.
    relaxed
    {
        //- Maximum non-orthogonality allowed. Set to 180 to disable.
        maxNonOrtho 75;
    }
Mattijs Janssens's avatar
Mattijs Janssens committed
405
406
407
}


Mattijs Janssens's avatar
Mattijs Janssens committed
408
409
410
411
412
413
414
415
416
417
418
419
// Advanced

// Flags for optional output
// 0 : only write final meshes
// 1 : write intermediate meshes
// 2 : write volScalarField with cellLevel for postprocessing
// 4 : write current intersections as .obj files
debug 0;


// Merge tolerance. Is fraction of overall bounding box of initial mesh.
// Note: the write tolerance needs to be higher than this.
mattijs's avatar
mattijs committed
420
mergeTolerance 1e-6;
Mattijs Janssens's avatar
Mattijs Janssens committed
421
422


Mattijs Janssens's avatar
Mattijs Janssens committed
423
// ************************************************************************* //