Unexpected partitioning conversion (leading to an error) with Gmsh-4.11.1 when MSH2 format is set to 2 0 8
We use Gmsh not only for generating meshes but also for post-processing results coming from our FE code. So far we rely on gmsh-4.6.0 and everything works fine. We wish to upgrade to gmsh-4.11.1. No problem regarding mesh generation with gmsh-4.11.1. We are facing issues for the post-processing of results with gmsh-4.11.1.
For now, our FE code exports results (mesh with/without data) in MSH2 format with the following header
$MeshFormat
2 0 8
$EndMeshFormat
Opening such file with gmsh-4.6.0 works fine, results are OK and no warning or error is issued by Gmsh. However, with gmsh-4.11.1, while the results are OK, we get
Info : Converting old partitioning...
Info : Creating partition topology...
Info : - Creating partition curves
Info : - Creating partition points
Error : No mesh elements were found
This is problematic as, when running in batch, gmsh-4.11.1 exists with error status 256 (i.e. exit(1)). Recall that this does not happen with Gmsh-4.6.0. The same problem occurs with the trunk version (tested on 2023/07/31). I did not try for Gmsh versions in-between.
I found a quick fix which consists in changing the header of the file (MSH2 format) written by our FE code for
$MeshFormat
2.2 0 8
$EndMeshFormat
Then, no error is reported by Gmsh-4.6.0, Gmsh-4.11.1, or Gmsh-trunk. This fix follows the Gmsh-4.11.1 documentation (section 10.3.1 MSH file format version 2 (Legacy)) which says
version-number
is a real number equal to 2.2
Notice however that the problem with Gmsh-4.11.1 only occurs when 3 tags (i.e. physical, elementary, partition) are set in the MSH2 file. No problem when only 2 tags (i.e. physical, elementary) are set.
Questions:
- Is the quick fix (i.e. specify
2.2 0 8
instead of2 0 8
) safe (enough)? - Without the quick fix, why is the behavior of Gmsh-4.11.1 (and Gmsh-trunk) different depending on the number (3 or 2, i.e. with or without the partition tag) of tags? Doesn't it reveal a problem in the actual implementation?
I will provide a reproducer.