Skip to content

Commit

Permalink
Update to WRF-Hydro v5.3.0 (#1809)
Browse files Browse the repository at this point in the history
Update `hydro` directory to match WRF-Hydro v5.3.0

TYPE: enhancement

KEYWORDS: hydro,wrf-hydro

SOURCE: WRF-Hydro Team

DESCRIPTION OF CHANGES:

- Fixed issue with snow/glacier accumulation on domain boundaries
- New impervious runoff adjustment options
- New channel-bypass option
- New NEXP (exponent controlling the decay of Ksat with depth) subsurface routing configuration parameter
- Modernized MPI library usage
- Corrected various Fortran usage issues
- Added debug build to Makefiles
- Included Orchestrator code missing from previous version
- Removed deprecated RAPID routing scheme

LIST OF MODIFIED FILES:
M       hydro/.version
M       hydro/Data_Rec/module_namelist.F
M       hydro/Data_Rec/namelist.inc
M       hydro/Data_Rec/rt_include.inc
M       hydro/HYDRO_drv/module_HYDRO_drv.F
M       hydro/MPP/module_mpp_GWBUCKET.F
M       hydro/MPP/module_mpp_ReachLS.F
M       hydro/Makefile
A       hydro/OrchestratorLayer/config.f90
A       hydro/OrchestratorLayer/io_manager.f90
A       hydro/OrchestratorLayer/orchestrator.f90
D       hydro/Rapid_routing/.gitignore
D       hydro/Rapid_routing/.rapid_init.F90.swp
D       hydro/Rapid_routing/LICENSE
D       hydro/Rapid_routing/README
D       hydro/Rapid_routing/makefile
D       hydro/Rapid_routing/makefile.cpl
D       hydro/Rapid_routing/makefile.orig
D       hydro/Rapid_routing/rapid_namelist
D       hydro/Rapid_routing/rapid_script.sh
M       hydro/Routing/Noah_distr_routing.F
M       hydro/Routing/Noah_distr_routing_overland.F
M       hydro/Routing/Noah_distr_routing_subsurface.F
M   hydro/Routing/Reservoirs/Persistence_Level_Pool_Hybrid/module_persistence_levelpool_hybrid_properties.F
M       hydro/Routing/Reservoirs/RFC_Forecasts/module_rfc_forecasts.F
M       hydro/Routing/Reservoirs/RFC_Forecasts/module_rfc_forecasts_properties.F
M       hydro/Routing/Reservoirs/RFC_Forecasts/module_rfc_forecasts_state.F
M       hydro/Routing/Reservoirs/reservoir_tests.F
M       hydro/Routing/Subsurface/module_subsurface_properties.F
M       hydro/Routing/module_GW_baseflow.F
M       hydro/Routing/module_HYDRO_io.F
M       hydro/Routing/module_HYDRO_utils.F
M       hydro/Routing/module_NWM_io.F
M       hydro/Routing/module_NWM_io_dict.F
M       hydro/Routing/module_RT.F
M       hydro/Routing/module_channel_routing.F
M       hydro/Routing/module_lsm_forcing.F
M       hydro/arc/Makefile.Noah
M       hydro/arc/Makefile.NoahMP
M       hydro/arc/macros.gordon
M       hydro/arc/macros.mpp.IBM.xlf90_r
M       hydro/arc/macros.mpp.gfort
M       hydro/arc/macros.mpp.ifort
M       hydro/arc/macros.mpp.ifort.luna
M       hydro/arc/macros.mpp.ifort.omp
M       hydro/arc/macros.mpp.ifort.summit_has
M       hydro/arc/macros.mpp.ifort.theia
M       hydro/arc/macros.mpp.intel.cray_xc
M       hydro/arc/macros.mpp.linux
M       hydro/arc/macros.mpp.mpiifort
M       hydro/arc/macros.seq.IBM.xlf90_r
M       hydro/arc/macros.seq.gfort
M       hydro/arc/macros.seq.ifort
M       hydro/arc/macros.seq.linux
M       hydro/arc/macros.yellowstone
M       hydro/template/HYDRO/hydro.namelist
M       hydro/template/NoahMP/namelist.hrldas

TESTS CONDUCTED: 
Passed regression tests and does not impact other part of the code.

RELEASE NOTES:
Available at [https://github.com/NCAR/wrf_hydro_nwm_public](https://github.com/NCAR/wrf_hydro_nwm_public)
  • Loading branch information
rcabell committed Jan 20, 2023
1 parent 52e2dfb commit 2a29582
Show file tree
Hide file tree
Showing 57 changed files with 2,250 additions and 1,078 deletions.
2 changes: 1 addition & 1 deletion hydro/.version
@@ -1 +1 @@
v5.2.0_WRFv4.4
v5.3.0-WRFv4.5
15 changes: 13 additions & 2 deletions hydro/Data_Rec/module_namelist.F
Expand Up @@ -46,7 +46,7 @@ subroutine read_rt_nlst(nlst)
GWBASESWCRT, GW_RESTART,RSTRT_SWC,TERADJ_SOLAR, &
sys_cpl, rst_typ, rst_bi_in, rst_bi_out, &
gwChanCondSw, GwPreCycles, GwSpinCycles, GwPreDiagInterval, gwsoilcpl, &
UDMP_OPT, io_form_outputs, bucket_loss
UDMP_OPT, io_form_outputs, bucket_loss, imperv_adj
real:: DTRT_TER,DTRT_CH,dxrt, gwChanCondConstIn, gwChanCondConstOut, gwIhShift
character(len=256) :: route_topo_f=""
character(len=256) :: route_chan_f=""
Expand Down Expand Up @@ -138,7 +138,7 @@ subroutine read_rt_nlst(nlst)
CHRTOUT_DOMAIN,CHANOBS_DOMAIN,CHRTOUT_GRID,LSMOUT_DOMAIN,&
RTOUT_DOMAIN, output_gw, outlake, &
frxst_pts_out, udmap_file, UDMP_OPT, GWBUCKPARM_file, bucket_loss, &
io_config_outputs, io_form_outputs, hydrotbl_f, t0OutputFlag, output_channelBucket_influx
io_config_outputs, io_form_outputs, hydrotbl_f, t0OutputFlag, output_channelBucket_influx, imperv_adj

#ifdef WRF_HYDRO_NUDGING
namelist /NUDGING_nlist/ nudgingParamFile, netwkReExFile, &
Expand Down Expand Up @@ -173,6 +173,7 @@ subroutine read_rt_nlst(nlst)
reservoir_rfc_forecasts = .FALSE.
reservoir_rfc_forecasts_lookback_hours = 24
reservoir_type_specified = .FALSE.
imperv_adj = 0

#ifdef WRF_HYDRO_NUDGING
! Default values for NUDGING_nlist
Expand Down Expand Up @@ -359,6 +360,7 @@ subroutine read_rt_nlst(nlst)
call mpp_land_bcast_int1(RTOUT_DOMAIN)
call mpp_land_bcast_int1(UDMP_OPT)
call mpp_land_bcast_int1(reservoir_data_ingest)
call mpp_land_bcast_int1(imperv_adj)
#ifdef WRF_HYDRO_NUDGING
call mpp_land_bcast_char(256, nudgingParamFile )
call mpp_land_bcast_char(256, netwkReExFile )
Expand Down Expand Up @@ -450,6 +452,7 @@ subroutine read_rt_nlst(nlst)
nlst%rst_bi_out = rst_bi_out
nlst%order_to_write = order_to_write
nlst%compound_channel = compound_channel
nlst%imperv_adj = imperv_adj

! files
nlst%route_topo_f = route_topo_f
Expand Down Expand Up @@ -533,6 +536,7 @@ subroutine read_rt_nlst(nlst)
write(6,*) " nlst%gwstrmfil ", gwstrmfil
write(6,*) " nlst%geo_finegrid_flnm ", geo_finegrid_flnm
write(6,*) " nlst%reservoir_data_ingest ", reservoir_data_ingest
write(6,*) " nlst%imperv_adj ", imperv_adj
#ifdef WRF_HYDRO_NUDGING
write(6,*) " nlst%nudgingParamFile ", trim(nudgingParamFile)
write(6,*) " nlst%netWkReExFile ", trim(netWkReExFile)
Expand Down Expand Up @@ -720,6 +724,10 @@ subroutine rt_nlst_check(nlst)
call hydro_stop('hydro.namelist ERROR: Invalid CHANRTSWCRT specified')
endif
if(nlst%CHANRTSWCRT .eq. 1) then
if ( nlst%channel_option .eq. 5 ) then
nlst%channel_option = 2
nlst%channel_bypass = .TRUE.
endif
if( (nlst%channel_option .lt. 1 ) .or. (nlst%channel_option .gt. 3) ) then
call hydro_stop('hydro.namelist ERROR: Invalid channel_option specified')
endif
Expand Down Expand Up @@ -780,6 +788,9 @@ subroutine rt_nlst_check(nlst)
inquire(file=trim(nlst%route_lake_f),exist=fileExists)
if (.not. fileExists) call hydro_stop('hydro.namelist ERROR: route_lake_f not found.')
endif
if( (nlst%imperv_adj .lt. 0 ) .or. (nlst%imperv_adj .gt. 1) ) then
call hydro_stop('hydro.namelist ERROR: Invalid imperv_adj specified')
endif
! Only allow lakes to be ran with gridded routing or NWM routing
if(len(trim(nlst%route_lake_f)) .ne. 0) then
if(nlst%channel_option .ne. 3) then
Expand Down
4 changes: 3 additions & 1 deletion hydro/Data_Rec/namelist.inc
Expand Up @@ -34,7 +34,7 @@
SUBRTSWCRT, OVRTSWCRT, AGGFACTRT, &
GWBASESWCRT, GW_RESTART,RSTRT_SWC,TERADJ_SOLAR, &
sys_cpl, gwChanCondSw, GwPreCycles, GwSpinCycles, GwPreDiagInterval, &
gwsoilcpl, UDMP_OPT, bucket_loss
gwsoilcpl, UDMP_OPT, bucket_loss, imperv_adj
logical:: GwPreDiag, GwSpinUp
real:: DTRT_TER,DTRT_CH, DTCT, dxrt0, gwChanCondConstIn, gwChanCondConstOut, gwIhShift
character(len=256) :: route_topo_f=""
Expand Down Expand Up @@ -74,6 +74,8 @@
integer :: rtFlag
integer ::khour

logical :: channel_bypass = .FALSE.

!#ifdef WRF_HYDRO_NUDGING
character(len=256) :: nudgingParamFile
character(len=256) :: netwkReExFile
Expand Down
2 changes: 2 additions & 0 deletions hydro/Data_Rec/rt_include.inc
Expand Up @@ -66,6 +66,7 @@
REAL, allocatable, DIMENSION(:,:) :: INFXSRT,LKSAT,LKSATRT
!REAL, allocatable, DIMENSION(:,:) :: SFCHEADSUBRT,INFXSUBRT,LKSATFAC ! SFCHEADSUBRT, INFXSUBRT moved to overland control module
REAL, allocatable, DIMENSION(:,:) :: LKSATFAC
REAL, allocatable, DIMENSION(:,:) :: IMPERVFRAC
!REAL, allocatable, DIMENSION(:,:) :: SOLDEPRT ! QSUBRT, QSUBBDRYRT moved to subsurface io module, SOLDEPRT, ZWATTABLRT move to susurface properties
REAL, allocatable, DIMENSION(:,:) :: SUB_RESID
REAL, allocatable, DIMENSION(:,:) :: q_sfcflx_x,q_sfcflx_y
Expand Down Expand Up @@ -243,6 +244,7 @@
INTEGER, allocatable, DIMENSION(:,:) :: VEGTYP
REAL, allocatable, DIMENSION(:,:) :: OV_ROUGH2d
!REAL, allocatable, DIMENSION(:) :: SLDPTH
REAL, allocatable, DIMENSION(:,:) :: NEXP

!!! define constant/parameter
real :: ov_rough(50)!, ZSOIL(100) ! ZSOIL moved to subsurface properties module
Expand Down
42 changes: 19 additions & 23 deletions hydro/HYDRO_drv/module_HYDRO_drv.F
Expand Up @@ -40,7 +40,7 @@ module module_HYDRO_drv
use module_gw_gw2d_data, only: gw2d
use module_channel_routing, only: drive_channel, drive_channel_rsl
use orchestrator_base
use config_base, only: nlst
use config_base, only: nlst, noah_lsm
use module_routing, only: getChanDim, landrt_ini
use module_HYDRO_utils
use module_lsm_forcing, only: geth_newdate
Expand Down Expand Up @@ -960,7 +960,7 @@ subroutine driveChannelRouting(did)
, rt_domain(did)%nlinksize, nlst(did)%OVRTSWCRT &
, nlst(did)%SUBRTSWCRT &
, nlst(did)%channel_only , nlst(did)%channelBucket_only &
)
, nlst(did)%channel_bypass )
else
Expand Down Expand Up @@ -1770,21 +1770,15 @@ subroutine lsm_input(did,ix0,jx0,vegtyp0,soltyp0)
do i = 1, RT_DOMAIN(did)%ix
!yw rt_domain(did)%lksat(i,j) = xdum1(soltyp(i,j) ) * 1000.0
rt_domain(did)%lksat(i,j) = xdum1(soltyp(i,j) )
IF(rt_domain(did)%VEGTYP(i,j) == rt_domain(did)%isurban ) THEN ! urban
rt_domain(did)%SMCMAX1(i,j) = 0.45
rt_domain(did)%SMCREF1(i,j) = 0.42
rt_domain(did)%SMCWLT1(i,j) = 0.40
else
rt_domain(did)%SMCMAX1(i,j) = MAXSMC(soltyp(I,J))
rt_domain(did)%SMCREF1(i,j) = refsmc(soltyp(I,J))
rt_domain(did)%SMCWLT1(i,j) = wltsmc(soltyp(I,J))
!ADCHANGE: Add some sanity checks in case calibration knocks the order of these out of sequence.
!The min diffs were pulled from the existing HYDRO.TBL defaults.
!Currently water is 0, so enforcing 0 as the absolute min.
rt_domain(did)%SMCMAX1(i,j) = min(rt_domain(did)%SMCMAX1(i,j), 1.0)
rt_domain(did)%SMCREF1(i,j) = max(min(rt_domain(did)%SMCREF1(i,j), rt_domain(did)%SMCMAX1(i,j) - 0.01), 0.0)
rt_domain(did)%SMCWLT1(i,j) = max(min(rt_domain(did)%SMCWLT1(i,j), rt_domain(did)%SMCREF1(i,j) - 0.01), 0.0)
ENDIF
rt_domain(did)%SMCMAX1(i,j) = MAXSMC(soltyp(I,J))
rt_domain(did)%SMCREF1(i,j) = refsmc(soltyp(I,J))
rt_domain(did)%SMCWLT1(i,j) = wltsmc(soltyp(I,J))
!ADCHANGE: Add some sanity checks in case calibration knocks the order of these out of sequence.
!The min diffs were pulled from the existing HYDRO.TBL defaults.
!Currently water is 0, so enforcing 0 as the absolute min.
rt_domain(did)%SMCMAX1(i,j) = min(rt_domain(did)%SMCMAX1(i,j), 1.0)
rt_domain(did)%SMCREF1(i,j) = max(min(rt_domain(did)%SMCREF1(i,j), rt_domain(did)%SMCMAX1(i,j) - 0.01), 0.0)
rt_domain(did)%SMCWLT1(i,j) = max(min(rt_domain(did)%SMCWLT1(i,j), rt_domain(did)%SMCREF1(i,j) - 0.01), 0.0)
IF(rt_domain(did)%VEGTYP(i,j) > 0 ) THEN ! created 2d ov_rough
rt_domain(did)%OV_ROUGH2d(i,j) = RT_DOMAIN(did)%OV_ROUGH(rt_domain(did)%VEGTYP(I,J))
endif
Expand All @@ -1796,12 +1790,14 @@ subroutine lsm_input(did,ix0,jx0,vegtyp0,soltyp0)
! input from HYDRO.TBL.nc file
print*, "reading from hydrotbl_f(HYDRO.TBL.nc) file ...."
call hdtbl_in_nc(did)
!ADCHANGE: For consistency, mirror urban and param value checks used in table read
where (rt_domain(did)%VEGTYP == rt_domain(did)%isurban)
rt_domain(did)%SMCMAX1 = 0.45
rt_domain(did)%SMCREF1 = 0.42
rt_domain(did)%SMCWLT1 = 0.40
endwhere
if (noah_lsm%imperv_option .eq. 9) then
!ADCHANGE: For consistency, mirror urban and param value checks used in table read
where (rt_domain(did)%VEGTYP == rt_domain(did)%isurban)
rt_domain(did)%SMCMAX1 = 0.45
rt_domain(did)%SMCREF1 = 0.42
rt_domain(did)%SMCWLT1 = 0.40
endwhere
endif
where (rt_domain(did)%SMCMAX1 .gt. 1.0) rt_domain(did)%SMCMAX1 = 1.0
rt_domain(did)%SMCREF1 = max(min(rt_domain(did)%SMCREF1, rt_domain(did)%SMCMAX1 - 0.01), 0.0)
rt_domain(did)%SMCWLT1 = max(min(rt_domain(did)%SMCWLT1, rt_domain(did)%SMCREF1 - 0.01), 0.0)
Expand Down
4 changes: 1 addition & 3 deletions hydro/MPP/module_mpp_GWBUCKET.F
Expand Up @@ -25,11 +25,11 @@ MODULE MODULE_mpp_GWBUCKET
use module_mpp_land, only: io_id, my_id, mpp_status, mpp_land_max_int1, numprocs, &
mpp_land_bcast_real, sum_real8, mpp_land_sync
use iso_fortran_env, only: int64
use mpi
implicit none



include "mpif.h"

integer,allocatable,dimension(:) :: sizeInd ! size of Basins for each tile
integer :: maxSizeInd
Expand Down Expand Up @@ -122,7 +122,6 @@ subroutine gw_write_io_real(numbasns,inV,ind,outV)
tag2 = 63
call mpi_recv(ibuff(1:sizeInd(i+1)),sizeInd(i+1),&
MPI_INTEGER8,i,tag2,HYDRO_COMM_WORLD,mpp_status,ierr)

do k = 1, sizeInd(i+1)
outV(ibuff(k)) = vbuff(k)
end do
Expand Down Expand Up @@ -181,7 +180,6 @@ subroutine gw_write_io_int(numbasns,inV,ind,outV)
tag2 = 63
call mpi_recv(ibuff(1:sizeInd(i+1)),sizeInd(i+1),&
MPI_INTEGER8,i,tag2,HYDRO_COMM_WORLD,mpp_status,ierr)

do k = 1, sizeInd(i+1)
outV(ibuff(k)) = vbuff(k)
end do
Expand Down
4 changes: 1 addition & 3 deletions hydro/MPP/module_mpp_ReachLS.F
Expand Up @@ -23,6 +23,7 @@ MODULE MODULE_mpp_ReachLS

use module_mpp_land, only: io_id, my_id, mpp_status, mpp_land_max_int1, mpp_land_sync, HYDRO_COMM_WORLD
use hashtable
use mpi
implicit none


Expand Down Expand Up @@ -65,7 +66,6 @@ MODULE MODULE_mpp_ReachLS



include "mpif.h"

integer,allocatable,dimension(:) :: sDataRec ! sending data size
integer,allocatable,dimension(:) :: rDataRec ! receiving data size
Expand Down Expand Up @@ -1517,5 +1517,3 @@ subroutine TONODE2RSL8 (ind,inVar,size,gNLINKSL,NLINKSL,ioVar,flag)
end subroutine TONODE2RSL8

END MODULE MODULE_mpp_ReachLS


19 changes: 17 additions & 2 deletions hydro/Makefile
@@ -1,5 +1,10 @@
# Makefile
all:
#
CMD = Run/wrf_hydro.exe

all: $(CMD)

$(CMD):
@if [ ! -d "Run" ]; then \
(mkdir Run);\
fi
Expand All @@ -16,9 +21,19 @@ all:
fi

@if [ -d "LandModel" ]; then \
(cd LandModel; make ; rm -f ../../Run/wrf_hydro.exe; mv run/hrldas.exe ../../Run/wrf_hydro.exe ) \
(cd LandModel; make ) \
fi

debug::
@echo 'F90FLAGS := $$(DEBUGFLAGS) $$(F90FLAGS)' >> ./macros
@echo 'F90FLAGS := $$(DEBUGFLAGS) $$(F90FLAGS)' >> ./LandModel/user_build_options
debug:: $(CMD)

install:
-rm -f ./Run/wrf_hydro.exe; \
mv LandModel/run/hrldas.exe ./Run/wrf_hydro.exe
test:
@echo "No libraries or utilities are built, skip testing."
clean:
@if [ -d "LandModel_cpl" ]; then \
(cd LandModel_cpl; make clean) \
Expand Down

0 comments on commit 2a29582

Please sign in to comment.