I have made a mesh in Salome and made a resulting .med file which I then converted into a .msh file using gmsh, being sure that the surface of the mesh and the bulk volume of the mesh are imported as seperate groups. The mesh I have is a simple cylinder, with two surface groups and a bulk volume group. What I would like to do is vary the number of elements in the mesh and observe how the calculation I am performing converges to an answer.
I wish to convert the gmsh file into a .h5 file next and import it into my Fenics code using the following:
data = 'mesh_output'
mesh = Mesh()
hdf = HDF5File(mesh.mpi_comm(), data+'.h5', 'r')
hdf.read(mesh, '/mesh', False)
cells_f = MeshFunction('size_t', mesh, 3)
hdf.read(cells_f, '/cells')
facets_f = MeshFunction('size_t', mesh, 2)
hdf.read(facets_f, '/facets')
boundaries = facets_f
The prioir code that I was using to convert med to h5, no longer seems to work as I have swapped from Linux to Windows due to work commitments. Does anyone know of a simple way in which a med/msh file can be converted to a h5 file, while preserving the groups of the mesh?
For further calculations, the original conversion code and the file I am trying to convert is linked here: Med2h5 conversion - Google Drive
I should note that I run the med2h5_serverversion.py code, I get the following:
(base) [jsmith@iffcluster2103 Mesh_convergence]$ python3 med2h5_serverversion.py mesh_3mm_1.med
keep temporary files after conversion? (y/N): n starting conversion...
sh: line 1: /home/prog/gmsh-4.7.1-Linux64/bin/gmsh: No such file or directory
Converting from Gmsh format (.msh, .gmsh) to DOLFIN XML format
Traceback (most recent call last):
File "/Users/jsmith/Fenics/Mesh_convergence/med2h5_serverversion.py", line 636, in <module>
gmsh2xml(msh_path, objectConvert)
File "/Users/jsmith/Fenics/Mesh_convergence/med2h5_serverversion.py", line 379, in gmsh2xml
num_elements = int(line)
ValueError: invalid literal for int() with base 10: '3 13522 88 13609\n
Does anyone have idea how to rectify this or how to better convert med/msh files to h5 files on a windows system.
Thanks in advance.