Fix CGNS mesh reader for multizone problems (one CGNS mesh per zone) by pcarruscag · Pull Request #1566 · su2code/SU2

I don't think the fix is as simple as it seems.
Indeed looking back at how we developed the CGNS reader, It was originally meant to read multiple zone in a single file. But during development, someone decided to restrict the reader to only one zone per file (and I don't know if it was validated). So now we are seating in the middle.

If we replace line 169 of CGNSFVMMeshReader :

if ( nzones > 1 ) {
    SU2_MPI::Error(string("CGNS reader currently expects only 1 zone per CGNS file.") +
                   string("Multizone problems can be run with separate CGNS files for each zone."), CURRENT_FUNCTION);
}

by

 if ( cgnsZone > nzones) {
  cgnsZone = 1;
}

we can easily support multiple zone in one file.

To support one CGNS zone per file, I guess that user should provide either the index in the cgns file of the zone we want to read or even better its name and not rely on SU2 numbering of zones.

I think that supporting multiple mesh zones in the same file at the same time as one zone per mesh file should be possible as long as enough information is provided by the user.

In this case, I am wondering how the option MULTIZONE_MESH and MULTIZONE option are interacting in the related issue.

When MULTIZONE_MESH is set to NO do we expect one mesh file per zone ?
And in this case we can force CGNS Reader to read only the first Zone.

In a more generic way something like this should be possible:
MULTIZONE=YES
CONFIG_LIST= (zone_1.cfg, zone_2.cfg, zone_3.cfg)
CGNSZONENAMES = ("FluidRotor", "Solid", "FluidStator") # To let CGNS pick the right zone in the file and if it not found the first zone can be used (current SU2 behavior).

CGNSZONENAMES could also be set in each config file.