Convert Gmsh and other meshes to Omega_h OSH format

Common types of mesh files can be converted to Omega_h’s OSH format using the omega_h utility programs. Find more details about the utility programs in the Omega_h documentation. The following examples show how to convert Gmsh to OSH format.

Convert Gmsh to OSH format

  1. Find the utility programs in the SCOREC machines. You can find them in the following directories:
    • /lore/hasanm4/Omega_H/bin/ (if it is not available, you can contact us or build it from the source code)
  2. Add the directory to your PATH environment variable. For example, if you are using bash, you can execute the following command:
    export PATH=/lore/hasanm4/Omega_H/bin/:$PATH
    
  3. Add the directory to your LD_LIBRARY_PATH environment variable using the following command:
    export LD_LIBRARY_PATH=/lore/hasanm4/Omega_H/lib64/:$LD_LIBRARY_PATH
    
  4. Gmsh is also needed to convert the mesh to Omega_h format. Get the Gmsh executable using the following command:
    export PATH=/lore/hasanm4/Gmsh/bin/:$PATH
    export LD_LIBRARY_PATH=/lore/hasanm4/Gmsh/lib64/:$LD_LIBRARY_PATH
    
  5. Now the environment should be ready for the conversion. If you have .geo mesh script file, you can convert it to .msh file using the following command:
    gmsh -3 -format msh2 -order 1 -o mesh.msh mesh.geo
    
    (it must be of order 1 and here mesh format 2 is shown since it was used for with MFEM and MFEM only supports mesh format 2) (consult the Gmsh documentation for more details about the command line options)

Important notes: Omega_h supports both 2D and 3D meshes with triangles and tetrahedra. It does not support quadrilaterals, prisms, and hexahedra. (omega_h can only accept linear simplices and hypercubes from Gmsh) Make sure that the mesh is composed of linear triangles and tetrahedra. Gmsh documentation has more details about the element types.

  1. Now the mesh is ready to be converted to OSH format. Use the following command to convert the mesh to OSH format:
    gmsh2osh mesh.msh mesh.osh