Hi,
I have a simple 2D geometry where I fillet each corner. Everything works in gmsh but somehow it causes the `model_to_mesh` operation to fail. I will appreciate if someone could point a way to get around this. Below is an MWE that was tried on dolfinx 0.9 installed through conda:
import dolfinx, gmsh, numpy as np, mpi4py
from dolfinx.io import gmshio
gmsh.finalize()
gmsh.initialize()
gmsh.option.setNumber("General.Terminal", 0) # disable output messages
gmsh.clear()
model_rank = 0
occ = gmsh.model.occ
gdim = 2
fillet = 0.1 # 0.0 means no fillet and the code works
ID = 5
OD = 10
L = 10
pnts_fl = 4*[[]]
pnts_fl[0] = occ.addPoint(ID/2, -L/2, 0)
pnts_fl[1] = occ.addPoint(OD/2, -L/2, 0)
pnts_fl[2] = occ.addPoint(OD/2, L/2, 0)
pnts_fl[3] = occ.addPoint(ID/2, L/2, 0)
lines_fl = 4*[[]]
for j in range(len(lines_fl)):
lines_fl[j] = occ.addLine(pnts_fl[j], pnts_fl[(j+1)%len(lines_fl)])
if fillet > 0.0:
occ.synchronize()
fillet_tags = 4*[[]]
for j in range(len(lines_fl)):
fillet_tags[j] = occ.fillet2D(lines_fl[j], lines_fl[(j+1)%len(lines_fl)], fillet)
lines_tmp = 8*[[]]
for j in range(0, 2*len(lines_fl), 2):
lines_tmp[j] = lines_fl[j//2]
lines_tmp[j+1] = fillet_tags[j//2]
lines_fl = lines_tmp
loop_fl1 = occ.addCurveLoop(lines_fl)
fl1 = occ.addPlaneSurface([loop_fl1])
occ.synchronize()
gmsh.model.mesh.generate(gdim)
all_doms = gmsh.model.getEntities(gdim)
for j, dom in enumerate(all_doms):
gmsh.model.addPhysicalGroup(dom[0], [dom[1]], j + 1) # create the main group/node
# number all boundaries
all_edges = gmsh.model.getEntities(gdim - 1)
for j, edge in enumerate(all_edges):
gmsh.model.addPhysicalGroup(edge[0], [edge[1]], edge[1]) # create the main group/node
model_rank = 0
mesh, ct, ft = gmshio.model_to_mesh(gmsh.model, mpi4py.MPI.COMM_WORLD, model_rank, gdim)