There are two parts in thi readme file.
Part I is for fully coupled with WRF model. Part II is for offline version.


Part I Fully coupled with WRF Model
1. Building

1) General description
WRF-Hydro is a coupling architecture designed to simplify the coupling of terrestrial 
hydrological models with the WRF model. The WRF-Hydro system is compiled as an independent 
library to link with the WRF model and called by the WRF model as a function. The calling 
of WRF-Hydro within the WRF model is controlled by a macro definition that is specified 
as an environment setting during the compiling process. When WRF-Hydro is not activated 
within the environment setting before the WRF configuration process, the entire system 
defaults to the standard WRF model. To compile WRF-Hydro system, user only needs to set 
environment variable ("setenv WRF_HYDRO 1"), and then follow the standard WRF model 
configure and compiling process.

2) Environment settings
The following environment variables need to be set before configuring and compiling the WRF-HYDRO model:

setenv WRF_HYDRO 1
"1" is to activate WRF-Hydro. "0" or no definition will default to the WRF model only.

setenv HYDRO_D 1
A "1" for HYDRO_D results in WRF-Hydro producing some run-time diagnostic information. 
When HYDRO_D is set to "0 "or not defined, the diagnostic information will not be produced 
during run-time. 

You can explicitly set the "NETCDF_INC" and "NETCDF_LIB" environment variables or just set "NETCDF".  
If you only set "NETCDF" environment variable, the default NETCDF_INC and NETCDF_LIB inside WRF-Hydro 
will be "$NETCDF/include" and "NETCDF/lib".

setenv NETCDF_INC   "$path/netcdf/include"
setenv NETCDF_LIB   "$path/netcdf/lib"

"NETCDF_INC" and "NETCDF_LIB" are defined for the WRF-Hydro only and can be different from those 
set for the WRF model. WRF-Hydro has two netcdf libraries for Fortran and C respectively: 
libnetcdff and ibnetcdf. If the user's netcdf library combined them together (only has one), 
the user will need to manually change this part in order to successfully compile WRF-Hydro. 
See the section below on porting about how to change this.

Notes:  If you are going to create model output file that is more than 2Gb,
      you should consider using netCDF large file support function. To activate
      this, one must set the environment variable WRFIO_NCD_LARGE_FILE_SUPPORT.
      In c-shell environment, do

      setenv WRFIO_NCD_LARGE_FILE_SUPPORT 1

3) Configuring and compiling
On the following platforms, the configuring and compiling commands are the same as WRF model 
after the user has set up the above four environment variables. The default supported platform 
is Linux with the PGI (Portland Group) compiler.  The compiler options IBM AIX with xlf fortran, 
Linux with GFORTRAN and Intel are not fully tested yet and may not readily work.  As stated above, 
the WRF-Hydro system is called as a function inside the WRF model and thus only one executable 
is created when WRF-Hydro is compiled with WRF.  If user compiles the system successfully, 
only a single "wrf.exe" file will be created.

2. Running

The fully coupled WRF/WRF-Hydro system has the same running or execution command as that of WRF.  
Generally the same parameters and initial files are used as when normally running WRF.  However, 
WRF-Hydro has an additional namelist called "hydro.namelist" as well as some additional parameter 
files (.TBL files) that are located under the "hydro/Run" directory. Users need to copy those 
files to the directory where the "wrf.exe" is going to be executed. 

For a WRF-Hydro cold start run (i.e. not from a restart file), the user needs to provide three 
additional files that are specified in the "hydro.namelist": "GEO_STATIC_FLNM", "GEO_FINEGRID_FLNM" 
and, depending on whether or not the baseflow-bucket model is activated, "gwbasmskfil".

For running WRF-Hydro from restart file, the user needs to uncomment RESTART_FILE from 
"hydro.namelist" by removing "!" and provide the exact name for the existing restart file 
to be used.  Running from a restart condition is common when the land surface has been 
`spun-up' by running WRF-Hydro in an offline or `uncoupled' capacity.

3. Porting

The WRF-Hydro does not presently support OPENMP. The default support platform is Linux 
with the PGI compiler, IBM AIX with the xlf fortran compiler, and Linux with the GFORTRAN 
(sequential) compiler. However, WRF-Hydro is fairly easy to port to other systems.  
The basic steps to do so are as follows:

1) Edit "hydro/configure", and add "exit(0);" to the second line so that "configure" will not be executed.
2) Edit "hydro/macros" to set desired compiling options. 
3) Under hydro/WRF_cpl directory:
"make -f Makefile.cpl clean"
"make -f Makefile.cpl "

If there is no error, then user can compile the fully coupled WRF and WRF-Hydro model on the new platform.


Part II Offline compiling
Under hydro/ directory.
1. setenv WRF_HYDRO 1
2. setenv NETCDF your_netcdf_library_path
or
setenv NETCDF_INC   "$path/netcdf/include"
setenv NETCDF_LIB   "$path/netcdf/lib"
3. ./configure    
     -------> choose correct compiler
4. ./compile_offline_NoahMP.csh   
     ---->compile offine version with NoahMP driver
or
 ./compile_offline_Noah.csh  
     ----->compile offline version with Noah driver
5. Executable files are created under hydro/Run directory.

Note: Noah and NoahMP have the same name of "namelist.hrldas". But they are different.


6. Other Issues
If you are doing fully coupled run and your fine mesh grid time step is  <= 1.

Edit the file "dyn_em/module_first_rk_step_part1.F", change the line from
if(HYDRO_dt .gt. 1 ) call wrf_drv_HYDRO(HYDRO_dt, grid,  &
to
if(HYDRO_dt .gt. 0 ) call wrf_drv_HYDRO(HYDRO_dt, grid,  &