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
I want to create a mesh with physical groups using pygmsh and write it in XDMF format using meshio.
Is there a way to handle the mesh with meshio, without the intermediate step of writing and re-reading a .msh using gmsh?
Consider the following MWE with the flag gmsh_workaround = True|False:
Without writing the intermediary gmsh mesh (gmsh_workaround == False), I get this error:
Traceback (most recent call last):
File "/home/david/work/FEniCS/NavierStokes/examples/scripts/test_genmesh.py", line 38, in <module>
triangle_mesh = create_mesh(mesh, "triangle")
File "/home/david/work/FEniCS/NavierStokes/examples/scripts/test_genmesh.py", line 8, in create_mesh
cell_data = mesh.get_cell_data("gmsh:physical", cell_type)
File "/usr/lib/python3.10/site-packages/meshio/_mesh.py", line 250, in get_cell_data
[d for c, d in zip(self.cells, self.cell_data[name]) if c.type == cell_type]
KeyError: 'gmsh:physical'
Thanks!
Bonus question: is there a way to force the integer IDs for physical groups? Some versions ago ints could be specified instead of string labels for add_physical().
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi all,
I want to create a mesh with physical groups using pygmsh and write it in XDMF format using meshio.
Is there a way to handle the mesh with meshio, without the intermediate step of writing and re-reading a
.msh
using gmsh?Consider the following MWE with the flag
gmsh_workaround = True|False
:Without writing the intermediary gmsh mesh (
gmsh_workaround == False
), I get this error:Thanks!
Bonus question: is there a way to force the integer IDs for physical groups? Some versions ago ints could be specified instead of string labels for
add_physical()
.Beta Was this translation helpful? Give feedback.
All reactions