Skip to content

Commit

Permalink
opacity: netPen explicit summation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
marshallward committed Nov 4, 2019
1 parent 0eaeb81 commit aec5eb4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/parameterizations/vertical/MOM_opacity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit aec5eb4

Please sign in to comment.