Extruded hex mesh not working with boolean operations
I'm seeing some strange results when trying to generate a hex mesh. I have provided steps to replicate, what the issue is, an MWE Python script, and some images of the results for a few cases. Thanks in advance!
Steps to replicate
- Create a 2D geometry which includes boolean operations.
- Extrude the geometry (with
recombine=True
). - Generate a 2D quad mesh using the Quasi-structured Quad algorithm.
- Then generate the 3D mesh; the quad mesh and
recombine=True
should produce a hex mesh.
Issues
- A layer of elements around the boundaries of the 2D geometry fails to generate (this depends on the boolean operation used).
- It appears that the surface mesh down the "sides" of the extrusion is always double the resolution of the
numElements
specified - could this be causing the problems?. - Sometimes (in the case of the "cut" example below), an entire layer of elements fails to generate.
MWE script
hex_failure.py
import gmsh
occ = gmsh.model.occ
mesh = gmsh.model.mesh
gmsh.initialize()
r1 = occ.addRectangle(0, 0, 0, 1, 1)
r2 = occ.addRectangle(1, 0, 0, 1, 1)
f, _ = occ.fuse([(2, r1)], [(2, r2)])
# r1 = occ.addRectangle(0, 0, 0, 1, 1)
# r2 = occ.addRectangle(1, 0, 0, 1, 1)
# f, _ = occ.fragment([(2, r1)], [(2, r2)])
# r1 = occ.addRectangle(0, 0, 0, 1, 1)
# r2 = occ.addRectangle(0.4, 0.4, 0, 0.2, 0.2)
# f, _ = occ.cut([(2, r1)], [(2, r2)])
ex = occ.extrude(f, 0, 0, 1, numElements=[2], recombine=True)
occ.synchronize()
gmsh.option.setNumber("Mesh.Algorithm", 11)
mesh.generate()
gmsh.fltk.run()
gmsh.finalize()
Example images
Edited by Leo Nolan