Issue with .msh conversion into .xml

I want to convert a .msh mesh into .xml, I used 2 method of conversion but unfortunately i faced the following message:

I would be grateful if you could help me.
I also uploaded the 3D mesh on:

  1. meshio-convert cavitya.msh out.xml


Blockquote Traceback (most recent call last):
File “/usr/bin/meshio-convert”, line 135, in
File “/usr/bin/meshio-convert”, line 18, in _main, file_format=args.input_format)
File “/usr/lib/python3/dist-packages/meshio/”, line 131, in read
return format_to_reader[file_format].read(filename)
File “/usr/lib/python3/dist-packages/meshio/”, line 99, in read
out = read_buffer(f)
File “/usr/lib/python3/dist-packages/meshio/”, line 344, in read_buffer
assert line[0] == ‘$’

  1. dolfin-convert cavitya.msh out.xml


Converting from Gmsh format (.msh, .gmsh) to DOLFIN XML format
*** Unable to find cells of supported type.


I would suggest switching to xdmf. See for instance: Converting simple 2D mesh from gmsh to dolfin for details on how to do that with meshio.

Thank you for your reply,
I did your hint but didnt work, i have created the mesh with gambit software and not with gmsh! I would like to know does it matter?


Looking at your msh file, the msh formats are quite different.

(0 "FOAM to Fluent Mesh File")

(0 "Dimension:")
(2 3)

(0 "Grid dimensions:")
(10 (0 1 372 0 3))
(12 (0 1 190 0 0))
(13 (0 1 668 0 0))

(10 (1 1 372 1 3)

Traditional msh from gmsh

4.1 0 8
12 15 9 2

I would ask the developers of meshio how to read gambit meshes.

1 Like