From 3a423dd6fbc14a0b7f0c80a414ce67f09664be3b Mon Sep 17 00:00:00 2001 From: Robert Arthur Date: Thu, 5 Sep 2019 10:50:48 -0700 Subject: [PATCH 1/3] Fix to use ra_lw_physics=4 (RRTMG) with vertical nesting. Follows what was done previously for ra_lw_physics=1. --- Makefile | 5 +++-- phys/module_radiation_driver.F | 22 +++++++++++++++++++++- share/module_check_a_mundo.F | 10 ++++++---- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 246a2a7b75..853470bbe4 100644 --- a/Makefile +++ b/Makefile @@ -1058,8 +1058,9 @@ fseek_test : # rule used by configure to test if this will compile with netcdf4 nc4_test: - @cd tools ; /bin/rm -f nc4_test.{exe,nc,o} ; $(SCC) -o nc4_test.exe nc4_test.c -I$(NETCDF)/include -L$(NETCDF)/lib $(USENETCDF) ; cd .. - + @cd tools ; /bin/rm -f nc4_test.{exe,nc,o} ; $(SCC) -o nc4_test.exe nc4_test.c -I$(NETCDF)/include -L$(NETCDF)/lib -lnetcdff -lnetcdf ; cd .. + +#KAL the above line is modified. The variable $(USENETCDF) has been replaced with the library names # rule used by configure to test if Fortran 2003 IEEE signaling is available fortran_2003_ieee_test: @cd tools ; /bin/rm -f fortran_2003_ieee_test.{exe,o} ; $(SFC) -o fortran_2003_ieee_test.exe fortran_2003_ieee_test.F ; cd .. diff --git a/phys/module_radiation_driver.F b/phys/module_radiation_driver.F index 009e2d8666..a600c856b5 100644 --- a/phys/module_radiation_driver.F +++ b/phys/module_radiation_driver.F @@ -218,7 +218,7 @@ SUBROUTINE radiation_driver ( & USE module_ra_sw , ONLY : swrad USE module_ra_gsfcsw , ONLY : gsfcswrad USE module_ra_rrtm , ONLY : rrtmlwrad - USE module_ra_rrtmg_lw , ONLY : rrtmg_lwrad + USE module_ra_rrtmg_lw , ONLY : rrtmg_lwrad, rrtmg_lwinit USE module_ra_rrtmg_sw , ONLY : rrtmg_swrad #if( BUILD_RRTMG_FAST == 1) USE module_ra_rrtmg_lwf , ONLY : rrtmg_lwrad_fast @@ -1836,6 +1836,26 @@ SUBROUTINE radiation_driver ( & ENDDO END IF + !Need to reset NLAYERS if vertical nesting is used. + !This code follows that for case RRTMSCHEME within + !subroutine RRTMLWRAD. + IF ( PRESENT(p_top) ) THEN + p_top_dummy = p_top + ELSE + p_top_dummy = -1. ! not used by NMM + END IF + IF ( p_top .GT. 0 ) THEN ! flag value for NMM = -1 + !NLAYERS is recalculated + !every time the radiation scheme is called. This is + !necessary if e_vert parent .NE. e_vert nest since + !NLAYERS could then be different for each domain. + CALL RRTMG_LWINIT( & + p_top, .FALSE. , & + ids, ide, jds, jde, kds, kde, & + ims, ime, jms, jme, kms, kme, & + its, ite, jts, jte, kts, kte ) + ENDIF + CALL RRTMG_LWRAD( & RTHRATENLW=RTHRATEN, & LWUPT=LWUPT,LWUPTC=LWUPTC,LWUPTCLN=LWUPTCLN, & diff --git a/share/module_check_a_mundo.F b/share/module_check_a_mundo.F index 8d77ce3660..9000cd97c3 100644 --- a/share/module_check_a_mundo.F +++ b/share/module_check_a_mundo.F @@ -1906,19 +1906,21 @@ END FUNCTION bep_bem_nbui_max !----------------------------------------------------------------------- ! Consistency checks between vertical refinement and radiation ! scheme selection. For "choose any vertical levels" for the nest, -! only RRTM is eligible. +! only option 1 (RRTM/Dudhia) or option 4 (RRTMG) are eligible. !----------------------------------------------------------------------- DO i = 2, model_config_rec % max_dom IF (model_config_rec%vert_refine_method(i) .NE. 0) THEN IF ( ( ( model_config_rec%ra_lw_physics(i) .EQ. 0 ) .OR. & - ( model_config_rec%ra_lw_physics(i) .EQ. RRTMSCHEME ) ) .AND. & + ( model_config_rec%ra_lw_physics(i) .EQ. RRTMSCHEME ) .OR. & + ( model_config_rec%ra_lw_physics(i) .EQ. RRTMG_LWSCHEME ) ) .AND. & ( ( model_config_rec%ra_sw_physics(i) .EQ. 0 ) .OR. & - ( model_config_rec%ra_sw_physics(i) .EQ. SWRADSCHEME ) ) ) THEN + ( model_config_rec%ra_sw_physics(i) .EQ. SWRADSCHEME ) .OR. & + ( model_config_rec%ra_sw_physics(i) .EQ. RRTMG_SWSCHEME ) ) ) THEN ! We are OK, I just hate writing backwards / negative / convoluted if tests ! that are not easily comprehensible. ELSE - wrf_err_message = '--- ERROR: vert_refine_method=2 only works with ra_lw_physics=1 (RRTM) and ra_sw_physics=1 (Dudhia)' + wrf_err_message = '--- ERROR: vert_refine_method=2 only works with ra_lw/sw_physics=1 (RRTM/Dudhia) or ra_lw/sw_physics=4 (RRTMG)' CALL wrf_debug ( 0, TRIM( wrf_err_message ) ) count_fatal_error = count_fatal_error + 1 END IF From 397b3daf985e5d94caa56ab7daea5b75a90a60ad Mon Sep 17 00:00:00 2001 From: Robert Arthur Date: Thu, 5 Sep 2019 11:16:33 -0700 Subject: [PATCH 2/3] Fixed Makefile. --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 853470bbe4..246a2a7b75 100644 --- a/Makefile +++ b/Makefile @@ -1058,9 +1058,8 @@ fseek_test : # rule used by configure to test if this will compile with netcdf4 nc4_test: - @cd tools ; /bin/rm -f nc4_test.{exe,nc,o} ; $(SCC) -o nc4_test.exe nc4_test.c -I$(NETCDF)/include -L$(NETCDF)/lib -lnetcdff -lnetcdf ; cd .. - -#KAL the above line is modified. The variable $(USENETCDF) has been replaced with the library names + @cd tools ; /bin/rm -f nc4_test.{exe,nc,o} ; $(SCC) -o nc4_test.exe nc4_test.c -I$(NETCDF)/include -L$(NETCDF)/lib $(USENETCDF) ; cd .. + # rule used by configure to test if Fortran 2003 IEEE signaling is available fortran_2003_ieee_test: @cd tools ; /bin/rm -f fortran_2003_ieee_test.{exe,o} ; $(SFC) -o fortran_2003_ieee_test.exe fortran_2003_ieee_test.F ; cd .. From 688c067e8edb5a3aa1f50d1d1a8847e80ab627c3 Mon Sep 17 00:00:00 2001 From: Dave Gill Date: Thu, 23 Jan 2020 12:11:35 -0700 Subject: [PATCH 3/3] p_top -> p_top_dummy, oops in IF test --- phys/module_radiation_driver.F | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phys/module_radiation_driver.F b/phys/module_radiation_driver.F index a600c856b5..58ba26bd14 100644 --- a/phys/module_radiation_driver.F +++ b/phys/module_radiation_driver.F @@ -1844,7 +1844,7 @@ SUBROUTINE radiation_driver ( & ELSE p_top_dummy = -1. ! not used by NMM END IF - IF ( p_top .GT. 0 ) THEN ! flag value for NMM = -1 + IF ( p_top_dummy .GT. 0 ) THEN ! flag value for NMM = -1 !NLAYERS is recalculated !every time the radiation scheme is called. This is !necessary if e_vert parent .NE. e_vert nest since