Hello Janhon,
we are aware of the issue you are encountering that arises when ICON and BCON are used with coarse and fine grids that both use the hybrid vertical coordinate system. You are also correct that the issue has not yet been addressed in CMAQv5.3.2. In my response, I will first provide some additional background and then post a potential code update that should resolve the crash and also forces ICON and BCON to perform vertical interpolation based on height or pressure rather than VGLVLS in these situations. We expect that a future model update will implement a code change along these lines but haven’t finalized our decision yet.
Background and statement of problem:
ICON and BCON need updates to more robustly handle vertical interpolation when hybrid vertical coordinates are used
In cases where both the coarse and fine grid use the same vertical coordinate system and the same ptop, ICON and BCON vertical interpolation currently is based on VGLVLS (unless VGLVLS also match between the two grids, in which case there is just a straight up mapping of input to output layers). In cases when the coarse and fine grid have different vertical coordinate systems and/or have a different ptop, vertical interpolation is based on coarse and fine grid layer heights and, if these aren’t available, coarse and fine grid pressure.
The “cheaper” VGLVLS-based interpolation which avoids having to read coarse and fine grid met fields seems fine when it is invoked for coordinate systems other than hybrid since for such coordinate systems, VGLVLS uniquely define vertical levels. However, in the hybrid system, they do not contain all the needed information, specifically information about the transition point between terrain-following sigma levels and pressure levels. Nevertheless, in cases where both the coarse and fine grid use the hybrid coordinate system, the current code in m3_vinterp.F still uses VGLVLS-based vertical interpolation, creating two issues:
-
In line 220 of BCON m3_vinterp.F, a message gets written to the log file which states the name of the common vertical coordinate system used in the VGLVLS interpolation. However, that message uses the VGTYP integer (-9999) as subscript to reference the vertical grid coordinate names stored in array VGDESC in BC_PARMS.F. This causes a segmentation fault when compiling BCON in non-debug mode.
-
While the first issue above could easily be fixed by updating the VGDESC array with a ninth element and bounding VGTYP_GD between 1 and 9 or by updating the LOGUNIT write statement to write out VGTYP_GD instead of VGDESC(VGTYP_GD), it seems desirable to force vertical interpolation based on heights (or pressure) if either the coarse or fine grid use the hybrid coordinate scheme because of the non-uniqueness of VGLVLS, specifically the fact that the transition point may vary between the grids but cannot be gleaned from VGLVLS.
Potential interim code fix addressing points #1 and #2 above:
ICON:
m3_vinterp.F
Insert the following block after line 222:
C If either grid uses hybrid, force height or pressure interpolation
IF ( ( VGTYP_GD . EQ. -9999 ) .OR. ( VGTYP3D . EQ. -9999 ) ) THEN
L_IDENTICAL = .FALSE.
L_SAME_SCALE = .FALSE.
ENDIF
change the write statement in line 259 to
WRITE( LOGUNIT, 92060 ) VGTYP_GD
change the format statement in line 461 to
92060 FORMAT( // 5X, 'Vertical grid type: ', I )
BCON
m3_driver.F
change line 271 to the following
IF ( VGTYP_GD .NE. VGTYP_IN .OR. VGTOP_GD .NE. VGTOP_IN . OR.
& VGTYP_GD .EQ. -9999 .OR. VGTYP_IN .EQ. -9999 ) THEN
m3_vinterp.F
Insert the following block after line 209:
C If either grid uses hybrid, force height or pressure interpolation
IF ( ( VGTYP_GD . EQ. -9999 ) .OR. ( VGTYP3D . EQ. -9999 ) ) THEN
L_IDENTICAL = .FALSE.
L_SAME_SCALE = .FALSE.
ENDIF
change line 253 to
MSG = 'Could not read DESC of ' // MET_CRO_3D_CRS
change the write statement in line 220 to
WRITE( LOGUNIT, 92060 ) VGTYP_GD
change the format statement in line 463 to
92060 FORMAT( // 5X, 'Vertical grid type: ', I )