1 !#**********************************************************************************
2 ! This computer software was prepared by Battelle Memorial Institute, hereinafter
3 ! the Contractor, under Contract No. DE-AC05-76RL0 1830 with the Department of
4 ! Energy (DOE). NEITHER THE GOVERNMENT NOR THE CONTRACTOR MAKES ANY WARRANTY,
5 ! EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE.
7 ! miscellaneous debuging routines for CBMZ and MOSAIC
8 !**********************************************************************************
15 !-----------------------------------------------------------------------
16 subroutine peg_debugmsg( lun, level, str )
18 ! when lun > 0, writes "str" to unit "lun"
19 ! when lun <= 0, passes "str" on to wrf_debug
23 integer, intent(in) :: lun, level
24 character(len=*), intent(in) :: str
28 n = max( 1, len_trim(str) )
30 write(lun,'(a)') str(1:n)
32 call wrf_debug( level, str(1:n) )
35 end subroutine peg_debugmsg
38 !-----------------------------------------------------------------------
39 subroutine peg_message( lun, str )
41 ! when lun > 0, writes "str" to unit "lun"
42 ! when lun <= 0, passes "str" on to wrf_message
46 integer, intent(in) :: lun
47 character(len=*), intent(in) :: str
51 n = max( 1, len_trim(str) )
53 write(lun,'(a)') str(1:n)
55 call wrf_message( str(1:n) )
58 end subroutine peg_message
61 !-----------------------------------------------------------------------
62 subroutine peg_error_fatal( lun, str )
64 ! when lun > 0, writes "str" to unit "lun"
65 ! then (always) passes "str" on to wrf_error_fatal
69 integer, intent(in) :: lun
70 character(len=*), intent(in) :: str
74 n = max( 1, len_trim(str) )
75 if (lun .gt. 0) write(lun,'(a)') str(1:n)
76 call wrf_error_fatal( str(1:n) )
78 end subroutine peg_error_fatal
81 !-----------------------------------------------------------------------
82 end module module_peg_util