From aec5eb43562a5e254ce889e270b2925f900a394a Mon Sep 17 00:00:00 2001 From: Marshall Ward Date: Mon, 4 Nov 2019 12:02:37 -0500 Subject: [PATCH] opacity: netPen explicit summation The net penetrating shortwave heat flux at the top level was using colon notation and a SUM() intrinsic, which was causing sums over NaN in Nan-initialized mode, as well as a potentially ambiguous summation ordering. This patch replaces the implicit update and summation with explicit sums over the reduced non-halo domain. --- src/parameterizations/vertical/MOM_opacity.F90 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/parameterizations/vertical/MOM_opacity.F90 b/src/parameterizations/vertical/MOM_opacity.F90 index 5e42de0fea..2c0bfc424e 100644 --- a/src/parameterizations/vertical/MOM_opacity.F90 +++ b/src/parameterizations/vertical/MOM_opacity.F90 @@ -841,7 +841,12 @@ subroutine sumSWoverBands(G, GV, US, h, nsw, optics, j, dt, & pen_SW_bnd(:,:) = iPen_SW_bnd(:,:) do i=is,ie ; h_heat(i) = 0.0 ; enddo - netPen(:,1) = sum( pen_SW_bnd(:,:), dim=1 ) ! Surface interface + do i=is,ie + netPen(i,1) = 0. + do n=1,max(nsw,1) + netPen(i,1) = netPen(i,1) + pen_SW_bnd(n,i) ! Surface interface + enddo + enddo ! Apply penetrating SW radiation to remaining parts of layers. ! Excessively thin layers are not heated to avoid runaway temps.