Hello!
I encountered the following case while running a program version 4.2.3: In algorithm of the absorption of solar radiation in the CdN_f_LG15_light function from the sbcblk_algo_ice_cdn.F90 value of zfri (==at_i_b) exceeded one. And the expression in the function (1._wp - zfri) turned out to be less than zero. This led to the beginning of NaN propagation to all arrays u_ice, v_ice, a_i, ssh, and others. Similar problems seem to be possible in other functions in this module. The functions are the same in version 5.0. Perhaps at_i_b shouldn’t exceed 1, but I made the following edit anyway:
! zfri = pfrice(ji,jj)
zfri = min(pfrice(ji,jj), 1._wp - 1.e-6)
or
! CdN_f_LG15_light(ji,jj) = rce10_i_0 *zrlog*zrlog * zfri * (1._wp - zfri)**rbeta_0
CdN_f_LG15_light(ji,jj) = rce10_i_0 *zrlog*zrlog * zfri * (abs(1._wp - zfri))**rbeta_0
And there is unpleasant effect of NaN propagation. For example, in the radiation absorption algorithm (traqsr.F90 module)
!* interior equi-partition in R-G-B depending on vertical profile of Chl
DO jk = 2, nksr + 1 ; DO jj = ntsj-( nn_hls-( nn_hls+ nn_hls)*nthb), ntej+( nn_hls-( nn_hls+ nn_hls)*ntht) ; DO ji = ntsi-( nn_hls-( nn_hls+ nn_hls)*nthl), ntei+( nn_hls-( nn_hls+ nn_hls)*nthr)
ze3t = (e3t_0(ji,jj,jk-1)*(1._wp+r3t(ji,jj,Kmm)*tmask(ji,jj,jk-1)))
irgb = NINT( ztmp3d(ji,jj,jk) )
zc0 = ze0(ji,jj) * EXP( - ze3t * xsi0r )
…
ztmp3d(ji,jj,jk) = ( zc0 + zc1 + zc2 + zc3 ) * wmask(ji,jj,jk)
END DO ; END DO ; END DO
when r3t = NaN, the irgb array index becomes undefined, and the program terminates with an uninformative message before reaching NEMO’s standard error abort output. Perhaps this section of the code should not be executed when r3t = NaN with the addition of nstop = nstop+1