Skip to content

Segmentation fault when merging MSH2 partition files

Context

  • For our application we are currently using gmsh-4.6.0 to generate meshes but we are about to upgrade to gmsh-4.11.1.
  • Our application only supports mesh formats MSH1 and MSH2. Supporting mesh format MSH4 is foreseen but not yet planned. For now, we wish to use gmsh-4.11.1 however keeping old mesh format (e.g. MSH2) and knowing that there will be limitations (i.e. features of format MSH4 which are not compatible with format MSH2).
  • For MPI computations, our application requires one mesh file per mesh partition (i.e. use of option -part_split when saving the mesh partitions).

Generating the mesh partition files

The partitioning (4 partitions) of the mesh (mesh.msh) is achieved as follows:

  gmsh -part 4 -part_split -part_no_ghosts -part_no_topo -part_no_physicals -format msh2 -preserve_numbering_msh2 -o test.msh mesh.msh -

This leads to 4 mesh partitions files (test_i.msh, i=1..4) in format MSH2 (actually format 2.2). The mesh partitions files obtained with gmsh-4.6.0 and gmsh-4.11.1 are identical. Editing the mesh partitions files with a text editor shows that everything is correct.

Viewing the mesh partitions files

  • Opening one mesh partitions file (e.g. gmsh test_1.msh) works fine either with gmsh-4.6.0 or gmsh-4.11.1.
  • Opening (i.e. merging) all mesh partitions files (i.e. gmsh test_*.msh) succeeds with gmsh-4.6.0. Especially, using Tools->Visibility->List->Mesh partitions allows to view each partition independently.
  • Opening (i.e. merging) all mesh partitions files (i.e. gmsh test_*.msh) fails (segmentation fault) with gmsh-4.11.1. It seems that the segmentation fault occurs while Converting old partitioning when the second mesh partitions file is merged.

Workaround(s) with gmsh-4.11.1

The segmentation fault can be avoided by specifying not to perform the Converting old partitioning as follows:

  gmsh -setnumber Mesh.PartitionConvertMsh2 0 test_*.msh

The drawback is that viewing each partition independently with Tools->Visibility->List->Mesh partitions does not work anymore.

This drawback can be circumvented by opening (i.e. use of option -open) instead merging (i.e. use of the default(?) option -merge) the mesh partition files as follows:

  gmsh -setnumber Mesh.PartitionConvertMsh2 0 -open test_*.msh

There is then one model for each partition and viewing each partition independently can be achieved with Tools->Visibility->List->Models.

Remark

gmsh-git (2023-08-03 17:09) behaves the same (segmentation fault and workaround(s)) as gmsh-4.11.1.

Questions

  • Is it possible to fix the segmentation fault (e.g. by returning an error or a warning) when Mesh.PartitionConvertMsh2=1?
  • Is it possible to fix the visibility issue (i.e. Tools->Visibility->List->Mesh partitions) when Mesh.PartitionConvertMsh2=0? If not, the workaround (see above) is a good enough solution for viewing the mesh partitions.

Thank you.