diff --git a/sat_vapor_pres/include/sat_vapor_pres.inc b/sat_vapor_pres/include/sat_vapor_pres.inc index 4412fe28b..68b4ad83a 100644 --- a/sat_vapor_pres/include/sat_vapor_pres.inc +++ b/sat_vapor_pres/include/sat_vapor_pres.inc @@ -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 @@ -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_ @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/sat_vapor_pres/sat_vapor_pres.F90 b/sat_vapor_pres/sat_vapor_pres.F90 index 727d2381b..93310f97c 100644 --- a/sat_vapor_pres/sat_vapor_pres.F90 +++ b/sat_vapor_pres/sat_vapor_pres.F90 @@ -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, &