Skip to content

Commit

Permalink
Change wrf_error_fatal and wrf_message calls to macros to remain unif…
Browse files Browse the repository at this point in the history
…ied with MPAS (#1891)

TYPE:  text only

KEYWORDS: urban schemes, message calls

SOURCE: internal

DESCRIPTION OF CHANGES:
Problem:
The three urban scheme routines have a few wrf_message and wrf_error_fatal calls that should be replaced by macros defined at the top of modules so that the code maintains consistency with those in MPAS.

Solution:
The calls are replaced by the macros.

LIST OF MODIFIED FILES: 
M       phys/module_sf_bem.F
M       phys/module_sf_bep_bem.F
M       phys/module_sf_urban.F

TESTS CONDUCTED: 
1. The code compiles. No impact on results.
2. The Jenkins tests are all passing.
  • Loading branch information
weiwangncar committed Jul 7, 2023
1 parent fb4be8f commit e916756
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
11 changes: 9 additions & 2 deletions phys/module_sf_bem.F
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
MODULE module_sf_bem
#if defined(mpas)
use mpas_atmphys_utilities, only: physics_error_fatal
#define FATAL_ERROR(M) call physics_error_fatal( M )
#else
use module_wrf_error
#define FATAL_ERROR(M) call wrf_error_fatal( M )
#endif
! -----------------------------------------------------------------------
! Variables and constants used in the BEM module
! -----------------------------------------------------------------------
Expand Down Expand Up @@ -2459,7 +2466,7 @@ subroutine gaussjbem(a,n,b,np)
icol=k
endif
elseif(ipiv(k).gt.1)then
CALL wrf_error_fatal('singular matrix in gaussjbem')
FATAL_ERROR('singular matrix in gaussjbem')
endif
enddo
endif
Expand All @@ -2480,7 +2487,7 @@ subroutine gaussjbem(a,n,b,np)

endif

if(a(icol,icol).eq.0) CALL wrf_error_fatal('singular matrix in gaussjbem')
if(a(icol,icol).eq.0) FATAL_ERROR('singular matrix in gaussjbem')

pivinv=1./a(icol,icol)
a(icol,icol)=1
Expand Down
4 changes: 2 additions & 2 deletions phys/module_sf_bep_bem.F
Original file line number Diff line number Diff line change
Expand Up @@ -3722,7 +3722,7 @@ subroutine gaussj(a,n,b,np)
icol=k
endif
elseif(ipiv(k).gt.1)then
CALL wrf_error_fatal('singular matrix in gaussj')
FATAL_ERROR('singular matrix in gaussj')
endif
enddo
endif
Expand All @@ -3743,7 +3743,7 @@ subroutine gaussj(a,n,b,np)

endif

if(a(icol,icol).eq.0) CALL wrf_error_fatal('singular matrix in gaussj')
if(a(icol,icol).eq.0) FATAL_ERROR('singular matrix in gaussj')

pivinv=1./a(icol,icol)
a(icol,icol)=1
Expand Down
6 changes: 3 additions & 3 deletions phys/module_sf_urban.F
Original file line number Diff line number Diff line change
Expand Up @@ -2161,9 +2161,9 @@ SUBROUTINE urban_param_init(DZR,DZB,DZG,num_soil_layers, &
ALLOCATE( HSESF_TBL(ICATE), stat=allocate_status )
if(allocate_status /= 0) FATAL_ERROR('Error allocating HSESF_TBL in urban_param_init')
ALLOCATE( PV_FRAC_ROOF_TBL(ICATE), stat=allocate_status )
if(allocate_status /= 0) CALL wrf_error_fatal('Error allocating PV_FRAC_ROOF_TBL in urban_param_init')
if(allocate_status /= 0) FATAL_ERROR('Error allocating PV_FRAC_ROOF_TBL in urban_param_init')
ALLOCATE( GR_FRAC_ROOF_TBL(ICATE), stat=allocate_status )
if(allocate_status /= 0) CALL wrf_error_fatal('Error allocating GR_FRAC_ROOF_TBL in urban_param_init')
if(allocate_status /= 0) FATAL_ERROR('Error allocating GR_FRAC_ROOF_TBL in urban_param_init')
endif
numdir_tbl = 0
Expand Down Expand Up @@ -2889,7 +2889,7 @@ SUBROUTINE urban_var_init(ISURBAN, TSURFACE0_URB,TLAYER0_URB,TDEEP0_URB,IVGTYP,
IF (CHECK.EQ.0)THEN
IF(IVGTYP(I,J).EQ.1)THEN
write(mesg,*) 'Sample of Urban settings'
call wrf_message(mesg)
WRITE_MESSAGE(mesg)
write(mesg,*) 'TSURFACE0_URB',TSURFACE0_URB(I,J)
WRITE_MESSAGE(mesg)
write(mesg,*) 'TDEEP0_URB', TDEEP0_URB(I,J)
Expand Down

0 comments on commit e916756

Please sign in to comment.