From bf5b72bddf8f6955878df57cb47af4736c1b4008 Mon Sep 17 00:00:00 2001 From: smileMchen Date: Tue, 10 Mar 2020 09:32:10 -0600 Subject: [PATCH] bug fix: NoahMP STEPWTD==0, divide by zero (#1129) TYPE: bug fix KEYWORDS: NoahMP, opt_run option SOURCE: internal DESCRIPTION OF CHANGES: Problem: When running the NoahMP scheme with the ground water option (opt_run=5), the STEPWTD variable is initialized to a non-zero value. However when opt_run!=5, then the STEPWTD variable remains an uninitialized zero value. In the WRF source code, there are a couple of places where mod(x,STEPWTD) occurs. This causes an immediate "divide by zero" error in the first call to the surface driver. Solution: The IF test logic is re-arranged so that only when opt_run=5 (which means that STEPWTD is non-zero) is there a second IF test (using mod(x,STEPWTD)) to compute whether additional processing takes place. This modification was made separately to the develop branch after the branch release-v4.1.4 was released. See #1101. The purpose of this modification is to allow users access to the latest v4.1.* branch that works with NoahMP. As this will be a single issue release, the README and inc/version_decl are also modified in preparation for the release of WRF release-v4.1.5 with this PR. LIST OF MODIFIED FILES: M dyn_em/module_first_rk_step_part1.F M phys/module_surface_driver.F M README M inc/version_decl TESTS CONDUCTED: Jenkins test PASS (positively tests NoahMP) Regression test in NCAR-MMM classroom machine PASS. --- README | 2 +- dyn_em/module_first_rk_step_part1.F | 4 ++-- inc/version_decl | 2 +- phys/module_surface_driver.F | 6 ++++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README b/README index db1e49fdd0..9ed129aeca 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -WRF Model Version 4.1.4 +WRF Model Version 4.1.5 http://www2.mmm.ucar.edu/wrf/users/ diff --git a/dyn_em/module_first_rk_step_part1.F b/dyn_em/module_first_rk_step_part1.F index f2737e86b9..c303e7954f 100644 --- a/dyn_em/module_first_rk_step_part1.F +++ b/dyn_em/module_first_rk_step_part1.F @@ -437,8 +437,8 @@ SUBROUTINE first_rk_step_part1 ( grid , config_flags & !gmm halo of wtd and riverflow for leafhydro #ifdef DM_PARALLEL - IF ( config_flags%sf_surface_physics.eq.NOAHMPSCHEME ) THEN - IF ( config_flags%opt_run.eq.5.and.mod(grid%itimestep,grid%STEPWTD).eq.0 ) THEN + IF ( ( config_flags%sf_surface_physics.EQ.NOAHMPSCHEME ) .and. ( config_flags%opt_run.EQ.5 ) ) THEN + IF ( mod(grid%itimestep,grid%STEPWTD).EQ.0 ) THEN # include "HALO_EM_HYDRO_NOAHMP.inc" ENDIF ENDIF diff --git a/inc/version_decl b/inc/version_decl index 9f4b2c2b7d..a8dc975b68 100644 --- a/inc/version_decl +++ b/inc/version_decl @@ -1 +1 @@ - CHARACTER (LEN=*), PARAMETER :: release_version = 'V4.1.4' + CHARACTER (LEN=*), PARAMETER :: release_version = 'V4.1.5' diff --git a/phys/module_surface_driver.F b/phys/module_surface_driver.F index 9481299df3..7e346f4908 100644 --- a/phys/module_surface_driver.F +++ b/phys/module_surface_driver.F @@ -3103,7 +3103,8 @@ SUBROUTINE surface_driver( & ENDIF - if(iopt_run.eq.5.and.mod(itimestep,STEPWTD).eq.0)then + IF ( iopt_run .EQ. 5 ) THEN + IF ( MOD(itimestep,STEPWTD) .EQ. 0 ) THEN ! STEPWTD always and only non-zero for iopt_run == 5 CALL wrf_debug( 100, 'calling WTABLE' ) !gmm update wtable from lateral flow and shed water to rivers @@ -3118,7 +3119,8 @@ SUBROUTINE surface_driver( & ims,ime, jms,jme, kms,kme, & i_start(ij),i_end(ij), j_start(ij),j_end(ij), kts,kte ) - endif + ENDIF + ENDIF call seaice_noah( SEAICE_ALBEDO_OPT, SEAICE_ALBEDO_DEFAULT, SEAICE_THICKNESS_OPT, & & SEAICE_THICKNESS_DEFAULT, SEAICE_SNOWDEPTH_OPT, &