Issue with .msh conversion into .xml

Hi,
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: https://gofile.io/?c=3py0Wb

  1. meshio-convert cavitya.msh out.xml

result:

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

  1. dolfin-convert cavitya.msh out.xml

result:

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

regards,
mhd

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?

Regards,
Mhd

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

(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

$MeshFormat
4.1 0 8
$EndMeshFormat
$Entities
12 15 9 2

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

1 Like