Bug in sbc_flx: Double count of 0.5 averaging for taum in sbcflx
Just a simple double use of 0.5 introduced in NEMO 4.0 that needs correction
! Note the use of 0.5*(2-umask) in order to unmask the stress along coastlines
zcoef = 1. / ( zrhoa * zcdrag )
DO_2D( 0, 0, 0, 0 )
ztx = ( utau(ji-1,jj ) + utau(ji,jj) ) * 0.5_wp * ( 2._wp - MIN( umask(ji-1,jj ,1), umask(ji,jj,1) ) )
zty = ( vtau(ji ,jj-1) + vtau(ji,jj) ) * 0.5_wp * ( 2._wp - MIN( vmask(ji ,jj-1,1), vmask(ji,jj,1) ) )
zmod = 0.5_wp * SQRT( ztx * ztx + zty * zty ) * tmask(ji,jj,1)
taum(ji,jj) = zmod
wndm(ji,jj) = SQRT( zmod * zcoef ) !!clem: not used?
END_2D
The issue is that ztx and zty have the mean over 2 points already accounted for before the zmod is calculated. But the 0.5 factor as in previous versions of the code is still present when zmod is calculated, so in effect taum is half what it should be.
Fix is trivial, remove one of the 0.5 factors.
e.g.
zmod = SQRT( ztx * ztx + zty * zty ) * tmask(ji,jj,1)