Skip to content

Commit

Permalink
update show_all_bad in sat_vapor_pres to use mpp_error for warning ou…
Browse files Browse the repository at this point in the history
…tput
  • Loading branch information
rem1776 authored and rem1776 committed Dec 3, 2024
1 parent 3333fac commit 2bb4762
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
28 changes: 16 additions & 12 deletions sat_vapor_pres/include/sat_vapor_pres.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1878,7 +1878,8 @@

subroutine SHOW_ALL_BAD_0D_ ( temp )
real(kind=FMS_SVP_KIND_) , intent(in) :: temp !< temperature in degrees Kelvin (K)
integer :: ind, iunit
integer :: ind
character(len=256) :: output_msg
!> DTINV, TMIN, TEPS are module level variables declared in r8_kind
!! Thus they need to be converted to FMS_SVP_KIND_
real(FMS_SVP_KIND_) :: dtinvll !< local version of module variable dtinvl
Expand All @@ -1889,10 +1890,10 @@
tminll=real(tmin,FMS_SVP_KIND_)
tepsll=real(teps,FMS_SVP_KIND_)

iunit = stdoutunit
ind = int( dtinvll*(temp-tminll+tepsll) )
if (ind < 0 .or. ind > nlim) then
write(iunit,'(a,e10.3,a,i6)') 'Bad temperature=',temp,' pe=',mpp_pe()
write(output_msg,'(a,e10.3,a,i6)') 'Bad temperature=',temp,' pe=',mpp_pe()
call mpp_error(WARNING, output_msg)
endif

end subroutine SHOW_ALL_BAD_0D_
Expand All @@ -1901,7 +1902,8 @@

subroutine SHOW_ALL_BAD_1D_ ( temp )
real(kind=FMS_SVP_KIND_) , intent(in) :: temp(:) !< temperature in degrees Kelvin (K)
integer :: i, ind, iunit
integer :: i, ind
character(len=256) :: output_msg
!> DTINV, TMIN, TEPS are module level variables declared in r8_kind
!! Thus they need to be converted to FMS_SVP_KIND_
real(FMS_SVP_KIND_) :: dtinvll !< local version of module variable dtinvl
Expand All @@ -1912,11 +1914,11 @@
tminll=real(tmin,FMS_SVP_KIND_)
tepsll=real(teps,FMS_SVP_KIND_)

iunit = stdoutunit
do i=1,size(temp)
ind = int( dtinvll*(temp(i)-tminll+tepsll) )
if (ind < 0 .or. ind > nlim) then
write(iunit,'(a,e10.3,a,i4,a,i6)') 'Bad temperature=',temp(i),' at i=',i,' pe=',mpp_pe()
write(output_msg,'(a,e10.3,a,i4,a,i6)') 'Bad temperature=',temp(i),' at i=',i,' pe=',mpp_pe()
call mpp_error(WARNING,output_msg)
endif
enddo

Expand All @@ -1926,7 +1928,8 @@

subroutine SHOW_ALL_BAD_2D_ ( temp )
real(kind=FMS_SVP_KIND_) , intent(in) :: temp(:,:) !< temperature in degrees Kelvin (K)
integer :: i, j, ind, iunit
integer :: i, j, ind
character(len=256) :: output_msg
!> DTINV, TMIN, TEPS are module level variables declared in r8_kind
!! Thus they need to be converted to FMS_SVP_KIND_
real(FMS_SVP_KIND_) :: dtinvll !< local version of module variable dtinvl
Expand All @@ -1937,12 +1940,12 @@
tminll=real(tmin,FMS_SVP_KIND_)
tepsll=real(teps,FMS_SVP_KIND_)

iunit = stdoutunit
do j=1,size(temp,2)
do i=1,size(temp,1)
ind = int( dtinvll*(temp(i,j)-tminll+tepsll) )
if (ind < 0 .or. ind > nlim) then
write(iunit,'(a,e10.3,a,i4,a,i4,a,i6)') 'Bad temperature=',temp(i,j),' at i=',i,' j=',j,' pe=',mpp_pe()
write(output_msg,'(a,e10.3,a,i4,a,i4,a,i6)') 'Bad temperature=',temp(i,j),' at i=',i,' j=',j,' pe=',mpp_pe()
call mpp_error(WARNING, output_msg)
endif
enddo
enddo
Expand All @@ -1953,7 +1956,8 @@

subroutine SHOW_ALL_BAD_3D_ ( temp )
real(kind=FMS_SVP_KIND_), intent(in) :: temp(:,:,:) !< temperature in degrees Kelvin (K)
integer :: i, j, k, ind, iunit
integer :: i, j, k, ind
character(len=256) :: output_msg
!> DTINV, TMIN, TEPS are module level variables declared in r8_kind
!! Thus they need to be converted to FMS_SVP_KIND_
real(FMS_SVP_KIND_) :: dtinvll !< local version of module variable dtinvl
Expand All @@ -1964,14 +1968,14 @@
tminll=real(tmin,FMS_SVP_KIND_)
tepsll=real(teps,FMS_SVP_KIND_)

iunit = stdoutunit
do k=1,size(temp,3)
do j=1,size(temp,2)
do i=1,size(temp,1)
ind = int( dtinvll*(temp(i,j,k)-tminll+tepsll) )
if (ind < 0 .or. ind > nlim) then
write(iunit,'(a,e10.3,a,i4,a,i4,a,i4,a,i6)') 'Bad temperature=',temp(i,j,k),' at i=',i,' j=',j,' k=',k, &
write(output_msg,'(a,e10.3,a,i4,a,i4,a,i4,a,i6)') 'Bad temperature=',temp(i,j,k),' at i=',i,' j=',j,' k=',k, &
& ' pe=',mpp_pe()
call mpp_error(WARNING, output_msg)
endif
enddo
enddo
Expand Down
2 changes: 1 addition & 1 deletion sat_vapor_pres/sat_vapor_pres.F90
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ module sat_vapor_pres_mod

use constants_mod, only: TFREEZE, RDGAS, RVGAS, HLV, ES0
use fms_mod, only: write_version_number, stdout, stdlog, mpp_pe, mpp_root_pe, &
mpp_error, FATAL, fms_error_handler, &
mpp_error, FATAL, WARNING, fms_error_handler, &
error_mesg, check_nml_error
use mpp_mod, only: input_nml_file
use sat_vapor_pres_k_mod, only: sat_vapor_pres_init_k, lookup_es_k, &
Expand Down

0 comments on commit 2bb4762

Please sign in to comment.