You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-22Lines changed: 30 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,9 @@ Python classes for easier creation of OpenFOAM's blockMesh dictionaries.
4
4
5
5
# About
6
6
7
-
_blockMesh_ is a very powerful mesher but the amount of manual labour it requires to make even the simplest meshes makes it mostly useless. Even attempts to simplify or parametrize blockMeshDicts with `#calc` or even the dreadful `m4`quickly become unmanageable and cryptic.
7
+
`blockMesh` is a very powerful mesher but creating even simple meshes requires a lot of manual work. Attempts to simplify or parametrize blockMeshDicts with `#calc` or `m4`often become cryptic and hard to maintain.
8
8
9
-
classy_blocks' aim is to minimize the amount of meticulous work by providing a
10
-
more intuitive workflow, off-the-shelf parts and some automatic helpers for building and optimization of block-structured hexahedral meshes.
11
-
Still it is not an automatic mesher and therefore some kinds of geometry are more suited than others.
9
+
`classy_blocks` aims to reduce this overhead by providing a more intuitive workflow, reusable building blocks and automatic helpers for constructing and optimizing block-structured hexahedral meshes. Nonetheless, it is not an automatic mesher, so some geometries are better suited than others.
12
10
13
11
## Tutorial
14
12
@@ -54,7 +52,7 @@ Check out the [classy_blocks tutorial on damogranlabs.com](https://damogranlabs.
54
52
55
53
## Workflow
56
54
57
-
As opposed to blockMesh, where the user is expected to manually enter pre-calculated vertices, edges, blocks and whatnot, classy_blocks tries to mimic procedural modeling of modern 3D CAD programs. Here, a Python script contains steps that describe geometry of blocks, their cell count, grading, patches and so on. At the end, the procedure is translated directly to blockMeshDict and no manual editing of the latter should be required.
55
+
As opposed to blockMesh where the user is expected to manually enter pre-calculated vertices, edges, blocks and whatnot, classy_blocks tries to mimic procedural modeling of modern 3D CAD programs. Here, a Python script contains steps that describe geometry of blocks, their cell count, grading, patches and so on. At the end, the procedure is translated directly to blockMeshDict and no manual editing of the latter should be required.
58
56
59
57
## Building Elements
60
58
@@ -67,7 +65,7 @@ _Unchecked items are not implemented yet but are on a TODO list_
67
65
-[x] Revolve
68
66
-[x] Wedge (a shortcut to Revolve for 2D axisymmetric cases)
69
67
-[x] Connector (A Loft between two existing Operations)
70
-
-[x] Sketches of common cross-sections
68
+
-[x] Sketches (collections of 2D faces) of common cross-sections
71
69
-[x] Quarter and Semi circle
72
70
-[x] Circle
73
71
-[x] Boxed circle
@@ -102,19 +100,19 @@ After blocks have been placed, it is possible to create new geometry based on pl
102
100
-[x] Move Vertex/Edge/Face
103
101
-[x] Delete a Block created by a Shape or Object
104
102
-[x] Project Vertex/Edge/Face
105
-
-[x] Optimize point position of a Sketch or mesh vertices
103
+
-[x] Optimize point position of a sketch/shape (with arbitrarily constrained movement)
106
104
107
105
## Meshing Specification
108
106
109
107
-[x] Simple definition of all supported kinds of edges with a dedicated class (Arc/Origin/Angle/Spline/PolyLine/Project)
110
108
-[x] Automatic sorting/reorienting of block vertices based on specified _front_ and _top_ points
111
109
-[x] Automatic calculation of cell count and grading by specifying any of a number of parameters (cell-to-cell expansion ratio, start cell width, end cell width, total expansion ratio)
112
-
-[][Edge grading](https://www.openfoam.com/documentation/user-guide/4-mesh-generation-and-conversion/4.3-mesh-generation-with-the-blockmesh-utility#x13-450004.3.1.3) (separate specification for each edge)
110
+
-[x][Edge grading](https://www.openfoam.com/documentation/user-guide/4-mesh-generation-and-conversion/4.3-mesh-generation-with-the-blockmesh-utility#x13-450004.3.1.3) (separate specification for each edge)
113
111
-[x] Automatic propagation of grading and cell count from a single block to all connected blocks as required by blockMesh
114
112
-[x] Projections of vertices, edges and block faces to geometry (triangulated and [searchable surfaces](https://www.openfoam.com/documentation/guides/latest/doc/guide-meshing-snappyhexmesh-geometry.html#meshing-snappyhexmesh-searchable-objects))
115
113
-[x] Face merging as described by [blockMesh user guide](https://www.openfoam.com/documentation/user-guide/4-mesh-generation-and-conversion/4.3-mesh-generation-with-the-blockmesh-utility#x13-470004.3.2). Breaks the pure-hexahedral-mesh rule but can often save the day for trickier geometries. Automatic duplication of points on merged block faces
116
114
-[x] Auto grading for high-Re meshes
117
-
-[] Auto grading for Low-Re meshes: boundary layer with specified cell-to-cell expansion, transition with 2:1 expansion, and specified 'bulk' cell size
115
+
-[x] Auto grading for Low-Re meshes: boundary layer with specified cell-to-cell expansion, transition with 2:1 (or user-defined) expansion, and specified 'bulk' cell size
118
116
119
117
# Examples
120
118
@@ -266,17 +264,6 @@ A collection of pre-assembled parametric Shapes, ready to be used for further co
266
264
Three pipes, joined in a single point.
267
265

268
266
269
-
## Automatic Grading
270
-
271
-
After blocks have been positioned their cell count must be defined. This can be done manually with something like `operation.chop(axis, start_size=..., c2c_expansion=...)` or anything that `.chop()` method supports. Not all blocks need to be chopped as cell counts will be propagated throughout the mesh so it is advisable to only _chop_ the minimum required.
272
-
273
-
All that can also be avoided by using automatic graders, for instance, `SmoothGrader` will set counts so that desired cell size will be obtained but will also use multigrading to keep cell sizes between neighbouring blocks as uniform as possible.
274
-
275
-

276
-
277
-
Also other, quicker and simpler graders are available.
278
-
The ultimate grader that will also create inflation layers on walls for resolved boundary layer is in development.
279
-
280
267
## Projection To Geometry
281
268
282
269
[Any geometry that snappyHexMesh understands](https://www.openfoam.com/documentation/guides/latest/doc/guide-meshing-snappyhexmesh-geometry.html)
@@ -389,15 +376,36 @@ Airfoil core with blunt trailing edge (imported points from NACA generator) and
389
376
(see `examples/complex/airfoil.py`). A simulation-ready mesh needs additional blocks to expand domain further away from the airfoil.
In classy_blocks lingo, _chopping_ means setting block's cell count and optionally grading. For best control it can be specified manually with something like `operation.chop(axis, start_size=..., c2c_expansion=...)` (or any other supported combination of parameters) but it only needs to be done on a single block in a _row_ of connected blocks. All touching blocks will inherit user-specified chops automatically.
382
+
383
+
## Edge Grading
393
384
394
-
When setting cell counts and expansion ratios, it is possible to specify which value to keep constant. Mostly this will be used for keeping thickness of the first cell at the wall consistent to maintain desired `y+` throughout the mesh. This is done by simple specifying a `preserve="..."` keyword.
385
+
When setting cell counts and expansion ratios, it is possible to specify which value to keep constant. When propagating chops through the mesh this will keep the required value constant. For instance, thickness of the first cell at the wall can be maintained to keep desired `y+` throughout the mesh. This is done by simply specifying a `preserve="..."` keyword.
395
386
396
387
Example: a block chopped in a classic way where cell sizes will increase when block size increases:
The same case but with a specified `preserve="start_size"` keyword for the bottom and `preserve="end_size"` for the top edge:
399
390

400
391
392
+
It is also possible to locate a specific edge and modify its grading by using `operation.chop_edge(corner_1, corner_2, ...)`. For example, this cylinder with wall boundary layers has some edges manually redefined:
classy_blocks offers automatic graders that will set cell counts and gradings throughout the whole mesh with no user intervention:
399
+
400
+
-`FixedCountGrader` will simply set the same cell count on all blocks.
401
+
-`SimpleGrader` will try to maintain user-specified cell size.
402
+
-`InflationGrader` will require the user to set wall patches first, then it will set cell sizes on the wall to maintain required first cell thickness,
403
+
make a boundary (inflation) layer that will maintain specified cell-to-cell expansion. Between the last boundary-layer cell and the bulk, a _buffer_ layer will be created with a larger (user-specified) cell-to-cell expansion to save on cell count.
404
+
405
+
All automatic graders will only grade what the user has not chopped yet - so it's easy to override grader's doings by manually chopping shapes first.
406
+
407
+
> Check out `examples/complex/cyclone` to see that almost no manual chopping is required to grade the whole mesh!
408
+
401
409
## Debugging
402
410
403
411
By default, a `debug.vtk` file is created where each block represents a hexahedral cell.
0 commit comments