Skip to content

Commit

Permalink
Reduce reporting tolerance of sum_part_size errors
Browse files Browse the repository at this point in the history
  Increased the sensitivity of the sum_part_size test in IST_bounds_check to
sum_part_size differs from 1 by slightly larger than roundoff, rather that
1e-5.  When the code is correct, no new error messages should be triggered.
Also improved the information content of the error messages when sum_part_sz =
~1.  All answers are bitwise identical but there may be new error messages when
certain code bugs have not been corrected.
  • Loading branch information
Hallberg-NOAA committed Feb 12, 2019
1 parent ef16e22 commit c159885
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/SIS_types.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2315,7 +2315,7 @@ subroutine IST_bounds_check(IST, G, IG, msg, OSS, Rad)
enddo ; enddo
endif
do j=jsc,jec ; do i=isc,iec
if (abs(sum_part_sz(i,j) - 1.0) > 1.0e-5) then
if (abs(sum_part_sz(i,j) - 1.0) > 2.0*(ncat+1)*epsilon(sum_part_sz(i,j))) then
n_bad = n_bad + 1
if (n_bad == 1) then ; i_bad = i ; j_bad = j ; err = "sum_part_sz" ; endif
endif
Expand Down Expand Up @@ -2367,10 +2367,19 @@ subroutine IST_bounds_check(IST, G, IG, msg, OSS, Rad)
write(mesg2,'("part_size = ",1pe12.4)') IST%part_size(i,j,k)
endif
elseif (present(OSS)) then
write(mesg2,'("T_ocn = ",1pe12.4,", S_sfc = ",1pe12.4,", sum_ps = ",1pe12.4)') &
OSS%SST_C(i,j), OSS%s_surf(i,j), sum_part_sz(i,j)
if (sum_part_sz(i,j) < 0.9999) then
write(mesg2,'("T_ocn = ",1pe12.4,", S_sfc = ",1pe12.4,", sum_ps = ",1pe12.4)') &
OSS%SST_C(i,j), OSS%s_surf(i,j), sum_part_sz(i,j)
else
write(mesg2,'("T_ocn = ",1pe12.4,", S_sfc = ",1pe12.4,", sum_ps = 1 - ",1pe12.4)') &
OSS%SST_C(i,j), OSS%s_surf(i,j), 1.0-sum_part_sz(i,j)
endif
else
write(mesg2,'("sum_part_sz = ",1pe12.4)') sum_part_sz(i,j)
if (sum_part_sz(i,j) < 0.9999) then
write(mesg2,'("sum_part_sz = ",1pe12.4)') sum_part_sz(i,j)
else
write(mesg2,'("sum_part_sz = 1 - ",1pe12.4)') 1.0-sum_part_sz(i,j)
endif
endif
call SIS_error(WARNING, "Bad ice state "//trim(err)//" "//trim(msg)//" ; "//trim(mesg1)//&
" ; "//trim(mesg2), all_print=.true.)
Expand Down

0 comments on commit c159885

Please sign in to comment.