Unexpected 0 calving on some HPC
Jean-Marc and I, independently, on 2 different HPCs (Jean-Zay and TGCC) with 2 different configurations faced issues with NEMO 4.0.4 on iceberg generation: in icbclv.F90, the stored_ice array is not filled because variable zdist
always 0. It is working perfectly fine on Occigen HPC. Splitting zdist
in 2 parts fixed the issue. We don't know why, because the line looks legitimate. As this bits of code didn't changed since, I think it is likely to affect NEMO 4.2 and trunk on some HPC.
Original code:
DO_2D( 1, 1, 1, 1 )
imx = berg_grid%maxclass(ji,jj)
zdist = SUM( rn_distribution(1:nclasses) ) / SUM( rn_distribution(1:imx) )
DO jn = 1, imx
berg_grid%stored_ice(ji,jj,jn) = berg_grid%stored_ice(ji,jj,jn) &
& + berg_dt * berg_grid%calving(ji,jj) * rn_distribution(jn) * zdist
END DO
END_2D
Suggested code:
za = SUM( rn_distribution(1:nclasses) )
DO jj = 1, jpj
DO ji = 1, jpi
imx = berg_grid%maxclass(ji,jj)
zb = SUM( rn_distribution(1:imx) )
zdist = za / zb
DO jn = 1, imx
berg_grid%stored_ice(ji,jj,jn) = berg_grid%stored_ice(ji,jj,jn) &
& + berg_dt * berg_grid%calving(ji,jj) * rn_distribution(jn) * zdist
END DO
END DO
END DO