Skip to content

Adding WRF-Hydro PRs#2263

Merged
islas merged 2 commits intowrf-model:developfrom
scrasmussen:develop-v4.8-hydro
Feb 12, 2026
Merged

Adding WRF-Hydro PRs#2263
islas merged 2 commits intowrf-model:developfrom
scrasmussen:develop-v4.8-hydro

Conversation

@scrasmussen
Copy link
Contributor

TYPE: bugfix, enhancement

KEYWORDS: syncing WRF-Hydro/hydro, gage-assisted diversion, bugfixes

SOURCE: internal hydro team + contributor

  • Soren Rasmussen, NSF NCAR
  • Ryan Cabell, NSF NCAR
  • Andrew Song, Inner Mongolia Meteorological Service / China Meteorological Administration (Wrote PR#829)

DESCRIPTION OF CHANGES: This PR updates the hydro directory to the NCAR/wrf_hydro_nwm_public repository. It includes the following PRs

LIST OF MODIFIED FILES:

$ git diff --name-status develop
M       hydro/CMakeLists.txt
M       hydro/CPL/WRF_cpl/CMakeLists.txt
M       hydro/Data_Rec/module_namelist.F90
M       hydro/Data_Rec/module_namelist_inc.F90
M       hydro/HYDRO_drv/module_HYDRO_drv.F90
M       hydro/Makefile
M       hydro/OrchestratorLayer/config.F90
M       hydro/Routing/CMakeLists.txt
A       hydro/Routing/Diversions/CMakeLists.txt
A       hydro/Routing/Diversions/Makefile
A       hydro/Routing/Diversions/module_diversions.F90
A       hydro/Routing/Diversions/module_diversions_timeslice.F90
M       hydro/Routing/Makefile
M       hydro/Routing/module_channel_routing.F90
M       hydro/arc/Makefile.mpp
D       hydro/arc/Makefile.seq
M       hydro/arc/macros.mpp.cray_fortran
M       hydro/arc/macros.mpp.gfort
M       hydro/arc/macros.mpp.ifort
D       hydro/arc/macros.mpp.ifort.luna
D       hydro/arc/macros.mpp.ifort.summit_has
D       hydro/arc/macros.mpp.ifort.theia
M       hydro/arc/macros.mpp.linux
D       hydro/arc/macros.seq.IBM.xlf90_r
D       hydro/arc/macros.seq.gfort
D       hydro/arc/macros.seq.ifort
D       hydro/arc/macros.seq.linux
D       hydro/arc/macros.theia.debug
D       hydro/arc/macros.yellowstone
D       hydro/arc/macros.yellowstone.debug
M       hydro/configure
M       hydro/nudging/CMakeLists.txt
A       hydro/nudging/io/CMakeLists.txt
R098    hydro/nudging/module_nudging_io.F90     hydro/nudging/io/module_nudging_io.F90
M       hydro/utils/CMakeLists.txt
A       hydro/utils/fortglob/CMakeLists.txt
A       hydro/utils/fortglob/Makefile
A       hydro/utils/fortglob/fortglob.F90
A       hydro/utils/fortglob/libfortglob.c
A       hydro/utils/fortglob/libfortglob.h

TESTS CONDUCTED: NOTE THAT THE PR IS IN DRAFT UNTIL TESTING IS COMPLETE. Current building and running

  1. WRF-Hydro Front Range, CO testcase
  2. Testing multiple configurations of Make and CMake build systems

RELEASE NOTE: Hydro bug fixes plus modifications to add initial support for gage-assisted diversions in channel routing, which requires a new optional Diversion netCDF parameter file. This adds a C compiler dependency

- NCAR/wrf_hydro_nwm_public#756 Add initial support for gage-assisted diversions in channel routing
- NCAR/wrf_hydro_nwm_public#811 bugfix: Diversions Makefiles for configure build
- NCAR/wrf_hydro_nwm_public#816 Revert TYPEL(k) check
- NCAR/wrf_hydro_nwm_public#823 make clean new directories
- NCAR/wrf_hydro_nwm_public#829 Rename fortglob.f90 to fortglob.F90 for preprocessor
- NCAR/wrf_hydro_nwm_public#827 Dropping .exe extension from wrf_hydro binary
- NCAR/wrf_hydro_nwm_public#855 Properly handle unexpected NaNs in diversion observations
- NCAR/wrf_hydro_nwm_public#856 Make diversion init errors non-fatal, proceed without diversions
- NCAR/wrf_hydro_nwm_public#861 Nudging, Fixing type mismatch when nudging turned on
- NCAR/wrf_hydro_nwm_public#862 OUTPUT_CHAN_CONN uses nudging io but not nudging

Co-authored-by: Ryan Cabell <rcabell@users.noreply.github.com>
Co-authored-by: Andrew Song <andrewsoong@users.noreply.github.com>
@scrasmussen scrasmussen requested a review from a team as a code owner November 26, 2025 20:20
@scrasmussen scrasmussen marked this pull request as draft November 26, 2025 20:20
@weiwangncar
Copy link
Collaborator

The regression test results:

Test Type              | Expected  | Received |  Failed
= = = = = = = = = = = = = = = = = = = = = = = =  = = = =
Number of Tests        : 23           24
Number of Builds       : 60           57
Number of Simulations  : 158           150        0
Number of Comparisons  : 95           86        0

Failed Simulations are: 
None
Which comparisons are not bit-for-bit: 
None

dudhia
dudhia previously approved these changes Dec 16, 2025
@weiwangncar
Copy link
Collaborator

@scrasmussen Is it possible to find another hydro person to review this PR?

@scrasmussen scrasmussen requested a review from rcabell December 17, 2025 15:28
@scrasmussen
Copy link
Contributor Author

@scrasmussen Is it possible to find another hydro person to review this PR?

Sure thing, thanks for the reminder! Just pinged @rcabell about this

@scrasmussen scrasmussen marked this pull request as ready for review December 24, 2025 17:58
@@ -0,0 +1,10 @@
add_library(hydro_routing_diversions STATIC
module_diversions.F90
module_diversions_timeslice.F90
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might be missing some compile / link info for netcdf. When I try to compile hydro from the top-level WRF build I get:

[ 42%] Building Fortran object hydro/Routing/Diversions/CMakeFiles/hydro_routing_diversions.dir/module_diversions_timeslice.F90.o
/home/aislas/wrf-model/wrf_extra/hydro/Routing/Diversions/module_diversions_timeslice.F90:5:9:

    5 |     use netcdf
      |         1
Fatal Error: Cannot open module file ‘netcdf.mod’ for reading at (1): No such file or directory
compilation terminated.
make[2]: *** [hydro/Routing/Diversions/CMakeFiles/hydro_routing_diversions.dir/build.make:88: hydro/Routing/Diversions/CMakeFiles/hydro_routing_diversions.dir/module_diversions_timeslice.F90.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2078: hydro/Routing/Diversions/CMakeFiles/hydro_routing_diversions.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 42%] Linking Fortran static library libhydro_routing_reservoirs.a
[ 42%] Built target hydro_routing_reservoirs
[ 42%] Building Fortran object external/io_netcdf/CMakeFiles/io_netcdf.dir/field_routines.F90.o
[ 42%] Linking Fortran static library libio_netcdf.a
[ 42%] Built target io_netcdf
[ 42%] Built target registry_code
make: *** [Makefile:136: all] Error 2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into this, thanks for finding this issue!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@islas I was not able to reproduce this error. What environment/setup are you using? How did you build (CMake or Makefile configure)?

I've been using

module purge
module load ncarenv gcc ncarcompilers cray-mpich craype netcdf cmake

That's from following the Old Method compile instructions in the readthedocs, without the number two step of replacing the hydro directory with WRF-Hydro repo.

I'm definitely interested in reproducing the bug so I can fix it, thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm building locally on my machine where I've installed mpich, netcdf, and netcdf-fortran to directories, making sure that they are found by the cmake build. I usually use this setup to test for anything that derecho hides.

This is the verbose compile output:

[  6%] Building Fortran object hydro/Routing/Diversions/CMakeFiles/hydro_routing_diversions.dir/module_diversions_timeslice.F90.o
cd /home/aislas/wrf-model/wrf_extra/_build/hydro/Routing/Diversions && /usr/bin/gfortran -DBUILD_RRTMG_FAST=0 -DBUILD_RRTMK=0 -DBUILD_SBM_FAST=1 -DCONFIG_BUF_LEN=65536 -DDA_CORE=0 -DDM_PARALLEL -DDWORDSIZE=8 -DEM_CORE=1 -DFSEEKO64_OK -DGRIB1 -DINTIO -DIWORDSIZE=4 -DKEEP_INT_AROUND -DLANDREAD_STUB -DLIMIT_ARGS -DLWORDSIZE=4 -DMAX_DOMAINS_F=21 -DMAX_HISTORY=25 -DMPP_LAND -DNETCDF -DNMM_CORE=0 -DNMM_MAX_DIM=2600 -DNONSTANDARD_SYSTEM_SUBR -DRWORDSIZE=4 -DSHOW_ALL_VARS_USED=0 -DUSE_ALLOCATABLES -DUSE_MPI=1 -DUSE_NETCDF4_FEATURES=1 -DWRFIO_NCD_LARGE_FILE_SUPPORT=1 -DWRFPLUS=0 -DWRF_HYDRO=1 -DWRF_USE_CLM -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -Dwrfmodel  -w -fconvert=big-endian -frecord-marker=4 -J../../mods -O2 -ftree-vectorize -funroll-loops -ffree-line-length-none -fallow-argument-mismatch -fallow-invalid-boz -cpp -c /home/aislas/wrf-model/wrf_extra/hydro/Routing/Diversions/module_diversions_timeslice.F90 -o CMakeFiles/hydro_routing_diversions.dir/module_diversions_timeslice.F90.o
/home/aislas/wrf-model/wrf_extra/hydro/Routing/Diversions/module_diversions_timeslice.F90:5:9:

    5 |     use netcdf
      |         1
Fatal Error: Cannot open module file ‘netcdf.mod’ for reading at (1): No such file or directory
compilation terminated.

I am able to recreate it on derecho, however, by doing:

module purge
module load gcc cmake netcdf cray-mpich
./configure_new <stuff, prompt select hydro>
./compile_new

I do have to fix finding CURL in the cmake build... if you do run into that just wholly comment that find_package( CURL ) line in the top-level CMakeLists.txt

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is my WRF build on derecho, if that helps: /glade/work/aislas/wrf-model/wrf_upstream

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module purge
module load gcc cmake netcdf cray-mpich
./configure_new <stuff, prompt select hydro>
./compile_new

I do have to fix finding CURL in the cmake build... if you do run into that just wholly comment that find_package( CURL ) line in the top-level CMakeLists.txt

Just an fyi if I also load ncarcompilers in addition to the ones you use, I don't get the CURL package error.

ml purge
ml gcc cmake netcdf cray-mpich ncarcompilers

Still working on replicating the error, will chat with you in the release meeting soon!

@islas islas merged commit f2c697e into wrf-model:develop Feb 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants