[v4.0.x] *p4zopt.f90* crash: out of lower bound value for `rkrgb`

Dear users,

I’m trying to run r4.0.7 version of nemo using r05 resolution and get the error message:

forrtl: severe (408): fort: (3): Subscript #2 of the array RKRGB has value "-2147483648" which is less than the lower bound of 1

Default version of nemo-r4.0.7 and 4.0.x runs ok without the problems described below.
Forcing input data for r05 worked ok with nemo v3.6.
The problem could be input data remapped from input for r2 default version?
Or maybe there may be inconsistencies of nemo compiled with mpiifort with MPI, netcdf, HDF, xios-2.5 and others ?
I’d appreciate any suggestions as to how to solve this problem.
Thanks

ocean.output
..........
  dyn_nxt : time stepping
  ~~~~~~~

  ssh_swp : Asselin time filter and swap of sea surface height
  ~~~~~~~

  dom_vvl_sf_swp : - time filter and swap of scale factors
  ~~~~~~~~~~~~~~   - interpolate scale factors and compute depths for next time s
  tep

  stp_ctl : time-stepping control
  ~~~~~~~
       file   : time.step open ok
       unit   =           31
       status = REPLACE
       form   = FORMATTED
       access = SEQUENTIAL

    fld_read: var dust kt =        2 (   0.0375 days), Y/M/D = 2000/01/01, records b/a:   0012/  0001 (days  -15.5000/  15.5000)
        it_offset is :            0
    fld_read: var riverdic kt =        2 (   0.0375 days), Y/M/D = 2000/01/01, records b/a:   0073/  0001 (days   -2.5000/   2.5000)
        it_offset is :            0
    fld_read: var riverdoc kt =        2 (   0.0375 days), Y/M/D = 2000/01/01, records b/a:   0073/  0001 (days   -2.5000/   2.5000)
        it_offset is :            0
    fld_read: var riverdin kt =        2 (   0.0375 days), Y/M/D = 2000/01/01, records b/a:   0073/  0001 (days   -2.5000/   2.5000)
        it_offset is :            0
    fld_read: var riverdon kt =        2 (   0.0375 days), Y/M/D = 2000/01/01, records b/a:   0073/  0001 (days   -2.5000/   2.5000)
        it_offset is :            0
==== >>>
==== >>> run ends here <<< ====
terminal
  -> info : CClientBuffer: allocated 2 x 547150440 bytes for server 0 with a maximum of 58 buffered events
  ........................................................................................
    forrtl: severe (408): fort: (3): Subscript #2 of the array RKRGB has value -2147483648 which is less than the lower bound of 1
 
  Image              PC                Routine            Line        Source
  nemo.exe           0000000002BB7A76  Unknown               Unknown  Unknown
  nemo.exe           0000000001339D61  p4zopt_mp_p4z_opt         101  p4zopt.f90
  nemo.exe           0000000001BDE609  p4zbio_mp_p4z_bio          90  p4zbio.f90
  nemo.exe           0000000001426AE5  p4zsms_mp_p4z_sms         132  p4zsms.f90
  nemo.exe           0000000001731109  trcsms_mp_trc_sms          61  trcsms.f90
  nemo.exe           0000000000682DB6  trcstp_mp_trc_stp         113  trcstp.f90
  nemo.exe           00000000004B47E4  step_mp_stp_              207  step.f90
  nemo.exe           000000000043CFC0  nemogcm_mp_nemo_g         161  nemogcm.f90
  nemo.exe           000000000043CED0  MAIN__                     18  nemo.f90
  nemo.exe           000000000043CE9E  Unknown               Unknown  Unknown
  libc-2.17.so       00002B2B07828555  __libc_start_main     Unknown  Unknown
  nemo.exe           000000000043CDA9  Unknown               Unknown  Unknown
  forrtl: severe (408): fort: (3): Subscript #2 of the array RKRGB has value -2147483648 which is less than the lower bound of 1
p4zopt.f90
    SUBROUTINE p4z_opt( kt, knt )
       !!---------------------------------------------------------------------
       !!                     ***  ROUTINE p4z_opt  ***
       !!
       !! ** Purpose :   Compute the light availability in the water column
       !!              depending on the depth and the chlorophyll concentration
       !!
       !! ** Method  : - ???
       !!---------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt, knt   ! ocean time step
       !
       INTEGER  ::   ji, jj, jk
       INTEGER  ::   irgb
       REAL(wp) ::   zchl
       REAL(wp) ::   zc0 , zc1 , zc2, zc3, z1_dep
       REAL(wp), ALLOCATABLE, DIMENSION(:,:  ) :: zetmp5
       REAL(wp), DIMENSION(jpi,jpj    ) :: zdepmoy, zetmp1, zetmp2, zetmp3, zetmp4
       REAL(wp), DIMENSION(jpi,jpj    ) :: zqsr100, zqsr_corr
       REAL(wp), DIMENSION(jpi,jpj,jpk) :: zpar, ze0, ze1, ze2, ze3, zchl3d
       !!---------------------------------------------------------------------
       !
       IF( ln_timing )   CALL timing_start('p4z_opt')

       IF( knt == 1 .AND. ln_varpar )   CALL p4z_opt_sbc( kt )

       !     Initialisation of variables used to compute PAR
       !     -----------------------------------------------
       ze1(:,:,:) = 0._wp
       ze2(:,:,:) = 0._wp
       ze3(:,:,:) = 0._wp
       !
       !                                        !* attenuation coef. function of Chlorophyll and wavelength (Red-Green-Blue)
       !                                        !  --------------------------------------------------------
                      zchl3d(:,:,:) = trb(:,:,:,jpnch) + trb(:,:,:,jpdch)
       IF( ln_p5z )   zchl3d(:,:,:) = zchl3d(:,:,:)    + trb(:,:,:,jppch)
       !
       DO jk = 1, jpkm1
          DO jj = 1, jpj
             DO ji = 1, jpi
                zchl = ( zchl3d(ji,jj,jk) + rtrn ) * 1.e6
                zchl = MIN(  10. , MAX( 0.05, zchl )  )
                irgb = NINT( 41 + 20.* LOG10( zchl ) + rtrn )
                !
                ekb(ji,jj,jk) = rkrgb(1,irgb) * e3t_n(ji,jj,jk) <<<< ===========================================
                ekg(ji,jj,jk) = rkrgb(2,irgb) * e3t_n(ji,jj,jk)
                ekr(ji,jj,jk) = rkrgb(3,irgb) * e3t_n(ji,jj,jk)
             END DO
          END DO
       END DO
rkrgb

oce_trc.f90

   USE traqsr  , ONLY :   rkrgb      =>    rkrgb      !: tabulated attenuation coefficients for RGB absorption

traqsr.f90

   REAL(wp) , PUBLIC, DIMENSION(3,61)   ::   rkrgb    ! tabulated attenuation coefficients for RGB absorption
                  zekb(ji,jj) = rkrgb(1,irgb)
                  zekg(ji,jj) = rkrgb(2,irgb)
                  zekr(ji,jj) = rkrgb(3,irgb)
         CALL trc_oce_rgb( rkrgb )                 ! tabulated attenuation coef.
         CALL trc_oce_rgb( rkrgb )                 ! tabulated attenuation coef.
zchl

p4zopt.f90

               zchl = ( zchl3d(ji,jj,jk) + rtrn ) * 1.e6
               zchl = MIN(  10. , MAX( 0.05, zchl )  )

trc_oce.f90

      REAL(wp) ::   zchl   ! temporary scalar
         zchl = zrgb(1,jc)

traqsr.f90:

      REAL(wp) ::   zchl, zcoef, z1_2        ! local scalars
                            zchl = MIN( 10. , MAX( 0.03, sf_chl(1)%fnow(ji,jj,1) ) )
                            zchl = MIN( 10. , MAX( 0.03, zchl3d(ji,jj,jk) ) )
zrgb

trc_oce.f90

      REAL(wp), DIMENSION(4,61) ::   zrgb   ! tabulated attenuation coefficient (formerly read in 'kRGB61.txt')
      zrgb(1, 1) =  0.010   ;   zrgb(2, 1) = 0.01618   ;   zrgb(3, 1) = 0.07464   ;   zrgb(4, 1) = 0.37807
      zrgb(1, 2) =  0.011   ;   zrgb(2, 2) = 0.01654   ;   zrgb(3, 2) = 0.07480   ;   zrgb(4, 2) = 0.37823
      zrgb(1, 3) =  0.013   ;   zrgb(2, 3) = 0.01693   ;   zrgb(3, 3) = 0.07499   ;   zrgb(4, 3) = 0.37840
...
      zrgb(1,60) =  8.912   ;   zrgb(2,60) = 0.44336   ;   zrgb(3,60) = 0.25725   ;   zrgb(4,60) = 0.55457
      zrgb(1,61) = 10.000   ;   zrgb(2,61) = 0.47804   ;   zrgb(3,61) = 0.27178   ;   zrgb(4,61) = 0.56870
      prgb(:,:) = zrgb(2:4,:)
      r_si2 = 1.e0 / zrgb(2, 1)        ! blue with the smallest chlorophyll concentration)

       DO jc = 1, 61                         ! check
         zchl = zrgb(1,jc)
zchl3d

p4zopt.f90

      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zpar, ze0, ze1, ze2, ze3, zchl3d
                     zchl3d(:,:,:) = trb(:,:,:,jpnch) + trb(:,:,:,jpdch)
      IF( ln_p5z )   zchl3d(:,:,:) = zchl3d(:,:,:)    + trb(:,:,:,jppch)
               zchl = ( zchl3d(ji,jj,jk) + rtrn ) * 1.e6

traqsr.f90

      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: zetot, zchl3d
            &      ze3 (jpi,jpj,jpk) , zea (jpi,jpj,jpk) , zchl3d(jpi,jpj,jpk)   )
                     zchl3d(ji,jj,jk) = zCze * ( zCb + zCmax * EXP( -( (zpsi - zpsimax) / zdelpsi )**2 ) )
              zchl3d(:,:,jk) = 0.05
                  zchl = MIN( 10. , MAX( 0.03, zchl3d(ji,jj,jk) ) )
         DEALLOCATE( zekb , zekg , zekr , ze0 , ze1 , ze2 , ze3 , zea , zchl3d )

Hello, just to mention that I can also reproduce this issue with Nemo 4.2 and Nemo main using ORCA025 + PISCES, I will open an issue on Gitlab to keep track of it.

Guillaume

Hello,

I also have a similar error. I’m trying to run ORCA2_ICE_PISCES in NEMO4.0.6 using gfortran compiler. There was no E R R O R flag in ocean.output. I read the posting on Gitlab… Please let me know anyone know how to fix it.

Error termination. Backtrace:
At line 132 of file /media/cmlws/Data1/hjc/NEMO/r4.0.6/cfgs/ORCA_test4/BLD/ppsrc/nemo/p4zopt.f90
Fortran runtime error: Index '0' of dimension 2 of array 'rkrgb' below lower bound of 1

namelist_cfg

!-----------------------------------------------------------------------
&namtra_qsr    !   penetrative solar radiation                          (ln_traqsr =T)
!-----------------------------------------------------------------------
   !                       ! type of penetration                        (default: NO selection)
   ln_qsr_rgb  = .true.       !  RGB light penetration (Red-Green-Blue)
   !
   nn_chldta   =      0       !  RGB : Chl data (=1) or cst value (=0)

   cn_dir = './'  !  root directory for the chlorophyl data location
   !___________!_________________________!___________________!___________!_____________!________!___________!__________________!__________!_______________!
   !           !  file name              ! frequency (hours) ! variable  ! time interp.!  clim  ! 'yearly'/ ! weights filename ! rotation ! land/sea mask !
   !           !                         !  (if <0  months)  !   name    !   (logical) !  (T/F) ! 'monthly' !                  ! pairing  !    filename   !
   sn_chl      ='chl_clim_seawifs_modis_199710-202112',        -1.        , 'chlor_a'    ,   .true.    , .true. , 'yearly'  , 'weights_chl_nemo2_bilin.nc'               , ''       , ''
/

p4zopt.f90

!                                        !* attenuation coef. function of Chlorophyll and wavelength (Red-Green-Blue)
      !                                        !  --------------------------------------------------------
                     zchl3d(:,:,:) = trb(:,:,:,jpnch) + trb(:,:,:,jpdch)
      IF( ln_p5z )   zchl3d(:,:,:) = zchl3d(:,:,:)    + trb(:,:,:,jppch)
      !
      DO jk = 1, jpkm1
         DO jj = 1, jpj
            DO ji = 1, jpi
               zchl = ( zchl3d(ji,jj,jk) + rtrn ) * 1.e6
               zchl = MIN(  10. , MAX( 0.05, zchl )  )
               irgb = NINT( 41 + 20.* LOG10( zchl ) + rtrn )
               !
               ekb(ji,jj,jk) = rkrgb(1,irgb) * e3t_n(ji,jj,jk)  ! <<== 132 line
               ekg(ji,jj,jk) = rkrgb(2,irgb) * e3t_n(ji,jj,jk)
               ekr(ji,jj,jk) = rkrgb(3,irgb) * e3t_n(ji,jj,jk)
            END DO
         END DO
      END DO

the last part of ocean.output :

======>> time-step =    1225      New day, DATE Y/M/D = 2006/01/18      nday_year = 018
         nsec_year =  1469400   nsec_month = 1469400   nsec_day =   600
   nsec_week =   346200
           read UGRD_GDS0_HTGL (rec:     69) in ./anl_surf125_ugrd_y2006.nc ok
           read VGRD_GDS0_HTGL (rec:     69) in ./anl_surf125_vgrd_y2006.nc ok
           read TMP_GDS0_HTGL (rec:     69) in ./anl_surf125_tmp_y2006.nc ok
           read SPFH_GDS0_HTGL (rec:     69) in ./anl_surf125_spfh_y2006.nc ok
           read dswrf (rec:     18) in ./fcst_phy2m125_dswrf_y2006.nc ok
           read dlwrf (rec:     18) in ./fcst_phy2m125_dlwrf_y2006.nc ok
           read PRMSL_GDS0_MSL (rec:     69) in ./anl_surf125_prmsl_y2006.nc ok
           read UGRD_GDS0_HTGL (rec:     70) in ./anl_surf125_ugrd_y2006.nc ok
           read VGRD_GDS0_HTGL (rec:     70) in ./anl_surf125_vgrd_y2006.nc ok
           read TMP_GDS0_HTGL (rec:     70) in ./anl_surf125_tmp_y2006.nc ok

Thank you in advance.
Best regards,

Hwa-Jin Choi