I’m trying to use physical groups for various different materials, as well as regions with a non-zero source term in Poisson’s equation. Consequently, regions with a source term are part of multiple physical groups. However, trying to read this mesh using DOLFINx v0.9.0 (from conda-forge) results in the error:
malloc(): mismatching next->prev_size (unsorted)
Here is a minimal working example:
import gmsh
from dolfinx.io import gmshio
from mpi4py import MPI
gmsh.initialize()
gmsh.option.setNumber("General.Terminal", 0) # suppress terminal output
gmodel = gmsh.model()
gmodel.add("model1")
gmodel.occ.addBox(0, 0, 0, 1, 1, 1, 1)
gmodel.occ.addBox(1, 0, 0, 1, 1, 1, 2)
gmodel.occ.addBox(2, 0, 0, 1, 1, 1, 3)
gmodel.occ.removeAllDuplicates() # remove duplicate surfaces and edges
gmodel.occ.synchronize()
gmodel.addPhysicalGroup(3, [1, 2], 1, "vol1")
gmodel.addPhysicalGroup(3, [2, 3], 2, "vol2") # entity (3, 2) is in both physical groups
gmodel.mesh.generate(3)
mesh, cell_markers, facet_markers = gmshio.model_to_mesh(gmodel, MPI.COMM_WORLD, 0, gdim=3) # error
gmsh.finalize()
Writing the mesh to a .msh file and reading it using dolfinx.io.gmshio.read_from_mesh()
results in the same error. Defining the physical groups such that entity (3, 2)
isn’t in both physical groups eliminates the error.
Is there no way to handle overlapping physical groups in DOLFINx? What is the best way to tag regions that may overlap? I’m hoping not to have to create disjoint physical groups.