Problem when using icon and bcon with different hybrid vertical coordinate

Hi
when using bcon/icon in Interpolates different hybrid vertical coordinate, show the error msg
File type GRDDED3
Execution ID “ICON_v531.exe”
###############################################################################

Vertical Interpolation Section

###############################################################################
0: Subscript out of range for array vgdesc (m3_vinterp.F: 259)
subscript=-9999, lower bound=1, upper bound=8, dimension=1
1.932u 0.015s 0:01.95 99.4% 0+0k 200+128io 1pf+0w
exit ( )

the reason is
hybrid vertical coordinate in vgtyp_gd is imiss3( -9999 )

mcip/src/setgriddefs.f9
IF ( met_model == 2 ) THEN ! WRF-ARW
IF ( met_hybrid <= 0 ) THEN ! sigma-type vertical coordinate
vgtyp_gd = vgwrfem ! terrain-following dry hydrostatic pressure
ELSE ! hybrid sigma-pressure vertical coordinate
vgtyp_gd = imiss3
ENDIF
ENDIF

but icon/bcon using m3_vinterp.F is not define the type of -9999
IC_PARMS.F: CHARACTER( 23 ) :: VGDESC( 8 )

when comment out (m3_vinterp.F: 259),the bcon can running but I don’t know the result is correct or not

         janhon

This has come up before. If I recall correctly, you need to upgrade to version 5.3.2.

still have the same msg in 5.3.2

 Execution ID "ICON_v532.exe"
 Grid name "FD3"
 Dimensions: 137 rows, 83 cols, 45 lays, 206 vbles
 NetCDF ID:    196608  opened as VOLATILE READWRITE
 Starting date and time  2019274:120000 (12:00:00  Oct. 1, 2019)
 Timestep                          010000 (1:00:00 hh:mm:ss)
 Maximum current record number         0

###############################################################################

Vertical Interpolation Section

###############################################################################

 The Layer Defn and CTM vertical grid types are the same, but the resolution is different.
 Vertical interpolation using VGLVS (listed below).

0: Subscript out of range for array vgdesc (m3_vinterp.F: 259)
subscript=-9999, lower bound=1, upper bound=8, dimension=1

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:

  1. 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.

  2. 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 )

2 Likes