I need to save my mesh (created with gmsh python api) in .msh
ASCII version 2 format in order to use the command dolfin-convert and import the mesh inside Fenics.
From the tutorials, to save the mesh I should use the command:
gmsh.write("filename.msh")
however, if i try to convert the mesh in .xml file (in order to use it in fenics) with the command:
dolfin-convert filenam.msh filename.xml
it returns an error:
ValueError: invalid literal for int() with base 10: '4 25240 1 25240\n'
If I save manually the mesh in .msh
ASCII 2 format everything works well.
I need an automated process so I can't save it manually every time, how can i use the Python api
to save the mesh in the correct way?
Thanks in advance!
Try this:
gmsh.option.setNumber("Mesh.MshFileVersion",2.2)
gmsh.write("filename.msh")