pygmsh
pygmsh copied to clipboard
OpenCascade, Boolean union and physical lines
I intend to get the union of few rectangles and still be able to mark the some of their lines as physical line.
I have noticed that in order to get the union / merge rectangles I need to use the OpenCascade engine and use boolean_union. At the same time, the object Rectangle that I create does not give me access to its lines to mark. Here is MWE.
import pygmsh as pg
height = 1.5
inlet_width = 0.2
inlet_depth = 0.2
width = 1.2
MOUTH1 = 2
INLET1 = 1
assert height > 0, "height cannot be 0"
assert width > 0, "width cannot be 0"
size = 2.e-2
geom = pg.opencascade.Geometry(
characteristic_length_min=size, characteristic_length_max=size)
ymax1 = 0.1
main_rect = geom.add_rectangle([0.0, 0.0, 0.0], width, height)
mouth_inlet1 = geom.add_rectangle([-inlet_depth, ymax1, 0.0], inlet_depth, inlet_width)
geom.add_physical_surface(mouth_inlet1, MOUTH1)
heat_exchanger = geom.boolean_union([main_rect, mouth_inlet1])
geom.add_physical_surface(heat_exchanger, 0)
mesh = pg.generate_mesh(geom, geo_filename="mesh_heat_exchanger.geo")
import meshio
meshio.write("mesh_heat_exchanger.vtk", mesh)
Ideally, I could mark one of the lines in heat_exchanger
as well
geom.add_physical_line(heat_exchanger.lines[0], 1)
Is there any way around this?
I have met the same question when I want to set physical line groups after a series of Boolean union and difference. I wonder if there is a solution for this problem after these years...
is this package still maintained? looks like the boolean issue for gmsh>=4.8.4 (#519) havn't been fixed for a long time