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
- 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)
- 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
- 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
- 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
- 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:(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)gmsh -3 -format msh2 -order 1 -o mesh.msh mesh.geo
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.
- 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
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.