I was wondering what the best strategy is for importing external meshes (2d/3d) into FEniCS. I have browsed various forums and found the following options:
(i) Create mesh in gmsh and use dolfin-convert to convert into xml file that can be imported into fenics.
(ii) Create mesh in gmsh and use meshio to import mesh into fenics
(iii) Create mesh in salome and import into fenics, via steps (i) or (ii).
I have also read that dolfin-convert is no longer maintained so it is not advisable. I have read somewhere that gmsh is okay if you used version 2 and not the latest version. I have also read that Salome is okay but it will not store geometric tags when you import mesh into FEniCS. Thus, I am not sure what to believe.
I have been successful in creating meshes with gmsh but I am having a hard time importing them to FeniCS. I have tried various meshio examples, but I have not been successful. Thus, I am wondering if there is a reliable strategy in place for importing 2d/3d meshes.
Thank you. For a 2d mesh, do I simply modify your script and remove the tetra section? or will your script work for both 2d (triangular) and 3d (tetrahedral) meshes.
One method, which I am using extensively, is Salome export as med to gmsh to xml to h5. You need to install Salome and import CAD or generate your CAD file in there. By using Salome you can also select and give names to boundaries. Then after exporting, in FEniCS you see these names as numbers.