13
$\begingroup$

I'm developing an FEM simulation. For early testing, I will use simple self-written mesher and visualisation of the mesh graph. But I want to prepare my program to use data generated by an existing mesher and output it to existing visualisation tools.

Is there a recommended (quasi-)standard for file format and internal data format for (FEM) meshes?

$\endgroup$
1
  • 4
    $\begingroup$ Exodus II for reading in the mesh and VTK for writing output. $\endgroup$
    – stali
    May 1, 2016 at 14:20

6 Answers 6

8
$\begingroup$

The short answer is no, there is not a standard format. But there are some common ones, like Gmsh for input/output and VTK for output.

Before making a decision you need to find out what do you want to do. If you want to have your (small) program for a while, then you can pick the format that best suit to your taste and needs. If you are planning to change to a "bigger" program in the future, it would be a good idea to start managing their file formats right now. If you are planning to use commercial pre/post-processors then I suggest that you stick to their formats, since they "update" those with every new version and it might be a pain in the head.

Below, I list some (open source) options.

Pre-processing

Post-processing

  • Visualization with Paraview/Mayavi. Then use VTK file formats. You can check the Paraview user guide here.
  • You can also do post-processing in Gmsh.
  • Salome-Meca is another option for post-processing, it works fine with VTK.
$\endgroup$
2
  • $\begingroup$ I think VTK is the right format for me: 1. I can use it as input for the mesh and as output for post-processing. 2. There exists a library to handle it. 3. It seems to be common, for example gmesh can generate it. Are those assumptions ok? $\endgroup$
    – Michael
    May 2, 2016 at 16:06
  • 1
    $\begingroup$ 1. You need to consider that the inclusion of material properties, BCs and constraints on your model. I am not completely sure how to implement these in VTK, but probably you can find a workaround. 2. Yes, but it depends on the programming language of your choice. 3. Yes, it is common. You can use directly vtk (in C++, Java or Python), Mayavi, Paraview, VisIt or even Chrome :P. And, yes, you can generate them in Gmesh, not sure about the physical groups, though. $\endgroup$
    – nicoguaro
    May 2, 2016 at 16:19
3
$\begingroup$

You might try either Gmsh's MSH file format or GAMBIT neutral file format.

$\endgroup$
1
  • 2
    $\begingroup$ I use gmsh mesh files for personal projects as well, that format is easy to understand and replicate yourself $\endgroup$
    – cbcoutinho
    May 1, 2016 at 16:17
3
$\begingroup$

There is actually a standard for this: ISO/TS 10303 (start with parts 1380 to 1386).

Prior to being hijacked by ISO, this initiative, which began back in the 1980s, was known as PDES/STEP. See https://www.pdesinc.org/index.html

But I don't believe anybody much uses it unless they are working in an environment where it is a mandatory requirement. A large number of international committees did an excellent job in subverting the original good intention, and produced a standard that attempts to cover everything from the describing the overall management structure of a company to the correct format for writing dates and times (and no, I'm not joking).

$\endgroup$
3
$\begingroup$

The number of file formats for FEM is ridiculous, partly due to the fact that every software package implemented its own format in the past.

enter image description here

(From xkcd.)

I've created meshio to alleviate the pain of converting between formats, so if you use any format supported by meshio, you should be able to easily make a switch in the future.

Out of all formats I know, VTU and XDMF are the ones I personally use most.

$\endgroup$
1
$\begingroup$

Besides MSH file format cited in Wes's answer, I am also using Gamma3's MESH file format. If you are programming in C/C++, there is an easy-to-use software library, LM6, for loading/saving in this file format [1]

[1] https://www.rocq.inria.fr/gamma/gamma/Membres/CIPD/Loic.Marechal/Research/LM6.html

$\endgroup$
0
$\begingroup$

I second the use of VTK for file output. If you wish to use a very generic mesh structure, I would point you in the direction of the CGNS library (CFD General Notation System) which is an opensource mesh format with its own library that is maintained by a consortium (including Boeing and NASA). Reading a list of nodes, properties, boundary conditions, etc. is extremely useful with this library and the library itself is very easy to compile. The library is in C++, but it can be linked with Fortran.

We use it in our in-house code and I have found it is a very efficient format. It uses HDF5 under the hood for binary files. Furthermore, ANSYS, Salome, GMSH all support the exportation to this format at varying degree. Here is the github: https://cgns.github.io/

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.