Lesson 4 - Run-time options for Gridded configuration

Overview

In Lesson 2 we covered the basics of constructing and running a WRF-Hydro simulation using a prepared domain for the 'Gridded' configuration. And in Lesson 3, we covered how to do some basic plotting for the 2D input/output files and also plot some time series.

In this lesson, we experiment with few different run-time options and do some basic visualization of the outputs using the Python library xarray.

NOTE: If you have not completed Lessons 2 and 3, please stop and do so now.

Recap of Lessons 1 and 2, compiling and running WRF-Hydro

In this section, we quickly recap the commands issued in Lessons 1 and 2 to compile WRF-Hydro and create our simulation directory. We use the prepared domain for the remaining lessons, but feel free to replace the prepared domain with the domain you create in the geospatial hands-on training session.

NOTE: Your domain directory structure and filenames must match the prepared domain EXACTLY

Compiling WRF-Hydro

Below are the commands to compile WRF-Hydro.

Set compile-time options

Edit the setEnvar.sh script to set environment variables required by the compile script. Your setEnvar.sh should look like the bash script below when you are finished. NOTE: We are compiling with spatial soil active for this exercise.


#!/bin/bash
# WRF-Hydro compile time options

# This is a WRF environment variable. Always set to 1=On for compiling WRF-Hydro.
export WRF_HYDRO=1

# Enhanced diagnostic output for debugging: 0=Off, 1=On.
export HYDRO_D=1

# Spatially distributed parameters for NoahMP: 0=Off, 1=On.
export SPATIAL_SOIL=1  

# RAPID model: 0=Off, 1=On.
export WRF_HYDRO_RAPID=0

# WCOSS file units: 0=Off, 1=On. 
export NCEP_WCOSS=0

# NWM output metadata: 0=Off, 1=On.
export NWM_META=0

# Streamflow nudging: 0=Off, 1=On.
export WRF_HYDRO_NUDGING=0

Compile WRF-Hydro in standalone mode

We have successfully compiled WRF-Hydro and we will use this binary and *.TBL files for the remaining simulations in this lesson

Creating the simulation directory and running a baseline WRF-Hydro simulation

Below are the commands from Lesson 2 to create the simulation directory and run a WRF-Hydro simulation. This simulation will be run exactly as was done in Lesson 2 and will serve as our baseline simulation. We will modify run-time options in subsequent simulations in the lesson and compare the outputs.

Experimenting with run-time options

Setup

In this section we will run a few different simulations with different run-time options and explore their effects on the model output.

We will create a new simulation directory for each experiment. First, we will make a new simulation directory as we did with the baseline run above and use this as a template for creating multiple new simulation directories.

Step 1: Create a simulation directory to use as a template

Step 2: View the contents

We now have our template simulation directory ready to go. In each experiment we will copy this directory and edit the two namelist files namelist.hrldas and hydro.namelist to change run-time options.

Experiment 1 - Warm vs cold start

Background

A model cold start is when you start your simulation with default initial conditions. In this case, model states are initialized from the wrfinput.nc file (land surface states) and GWBUCKPARM.nc (groundwater bucket states, if active). Often these initial values are guesses at global, physically plausible starting values. However, model states like soil moisture, groundwater levels, and stream levels need time to adjust to local climate and environment. So in most cases, we first spinup the model to reach an equilibrium state before launching a model experiment and evaluating output. Model states at the end of this spinup period can be used to warm start a simulation. A warm start is when the model simulation begins with the simulated values from a previous run. How long you need to spinup your model varies based on the local climate (e.g., drier climates generally take longer than wetter climates), the variables you are interested in (e.g., a fast stabilizing state like shallow soil moisture vs. a slower evolving state like deep groundwater), and local topography and soil types (e.g., sands have shorter memory than clays).

Objective

The goal of this experiment is to demonstrate the effect of starting a simulation from a cold stat vs. a warm start. The Gridded baseline run was started from a warm start, so all we need to do is construct a simulation directory and edit the namelists to start from a cold start.

Create experiment simulation directory

We will copy our template directory ~/wrf-hydro-training/output/lesson4/run_gridded_template and edit the namelist.hrldas and hydro.namelist files to start the model from a cold start.

Edit the namelists and run the simulation

If restart files are not provided in the namelist.hrldas and hydro.namelist files then the simulation will start from a cold start.

Step 1: Edit the namelist.hrldas file

Comment out this line RESTART_FILENAME_REQUESTED = "RESTART/RESTART.2011082600_DOMAIN1" in the namelist.hrldas by adding ! to the start of the line.

!RESTART_FILENAME_REQUESTED = "RESTART/RESTART.2011082600_DOMAIN1"

Step 2: Edit the hydro.namelist file

Comment out this line RESTART_FILE = 'RESTART/HYDRO_RST.2011-08-26_00_00_DOMAIN1' in the hydro.namelist by adding ! to the start of the line.

! Specify the name of the restart file if starting from restart...comment out with '!' if not...
!RESTART_FILE  = 'RESTART/HYDRO_RST.2011-08-26_00_00_DOMAIN1'

Tell the code to use GWBUCKPARM.nc initialization values vs. the restart file starting states by editing the GW_RESTART option in the hydro.namelist.

! Specify baseflow/bucket model initialization...(0=cold start from table, 1=restart file)
GW_RESTART = 0

Step 3: Run the simulation

Step 4: Check that the simulation finished successfully

Results

We will now look at the differences in streamflow between our warm start simulation represented by the run_gridded_baseline simulation and our cold start simulation that we ran during this experiment.

We will use Python and the xarray library to create hydrographs and 2d plots of soil moisture. For an intro to these tools, please see Lesson 3.

Load the xarray python package

Hydrographs

Load the CHANOBS streamflow datasets

We are going to use the CHANOBS output files to extract the streamflow time series. CHANOBS output files contain information for only the grid cells where we have specified a gage is located.

Plot the hydrographs

Soil moisture at start of simulation

The option t0OutputFlag in the hydro.namelist can be used to output models states at the start of the simulation.

! Option to write output files at time 0 (restart cold start time): 0=no, 1=yes (default)
t0OutputFlag = 1

We had this option set to 1 for both of our simulations so that we have outputs at the first timestep.

Load the LDASOUT datasets from the land surface model

Plot soil moisture at start of simulation

Discussion

Note that the streamflow for the cold start at the start of the simulation is 0 while the streamflow from the warm start (baseline) is > 0. Additionally, the cold start simulation begins with relatively low soil moisture (coming from the SMOIS variable in the wrfinput_d01.nc file) while the warm start simulation begins with higher soil moisture content (coming from the restart file). As a result they have different responses to the rainfall event. Since in the cold-start simulation soil is relatively drier, it has a higher capacity to store water and therefore more precipitation is partitioned to soil moisture (vs. runoff) compared to the warm-start simulation.

This is a good example of why you almost always want to spinup your model prior to analyzing output.

Experiment 2 - Supplemental precipitation data

Background

Precipitation is commonly the most important driver of hydrologic response. In some applications, for example a flood simulation, you may want to combine atmospheric analyses from reanalysis products or other models with a separate analysis of precipitation (e.g. a gridded gauge product, radar QPE, nowcasts, satellite QPE, etc). To enable such behavior, WRF-Hydro has an option (forcing type 6) to pair standard HRLDAS atmospheric forcing files with supplemental precipitation files.

Objective

Demonstrate the use of supplemental precipiation data for forcing our simulation.

Create experiment simulation directory

First we will copy our template directory ~/wrf-hydro-training/output/lesson4/run_gridded_template to create a new simulation directory for this experiment.

Edit the namelist and FORCING data and run the simulation

Step 1: Edit the namelist.hrldas

The forcing data type is specified in the namelist.hrldas file with the variable FORC_TYP. We will change the value from FORC_TYP=1 for standard HRLDAS hourly format data (all input variables combined into a single LDASIN file per timestep) to FORC_TYP=6, which reads both the standard HRLDAS hourly input files AND supplemental precipitation data files.

&WRF_HYDRO_OFFLINE

! Specification of forcing data:  1=HRLDAS-hr format, 2=HRLDAS-min format, 3=WRF,
!    4=Idealized, 5=Ideal w/ Spec.Precip., 6=HRLDAS-hrl y fomat w/ Spec. Precip,
FORC_TYP = 6

Step 2: Extract the supplemental precipitation data included with the example case

In the supplemental folder in the example case there is a tar file supp_precip.tar.gz containing regridded StageIV precipitation data. We will extract this to use for augmenting our FORCING data.

Step 3: Create a symlink to the supplemental precipitation data

We will add in our supplemental precipitation data to the FORCING folder. Since these data can be rather large we will create a symbolic link.

Lets take a look at the FORCING directory with the new data.

Now you see two files per hour. The PRECIP_FORCING files will be used for precipitation inputs and LDASIN_DOMAIN files will be used for all other forcing fields (e.g., temperature, radiation, wind). Note that the supplemental PRECIP_FORCING files are always specified to the minute.

Step 3: Run the simulation

Results

We will now look at the differences in streamflow between our baseline run with NLDAS precipitation and our experiment with supplemental StageIV precipitation.

Hydrographs

Load the CHANOBS streamflow datasets

Again, we use the CHANOBS files to import the streamflow timeseries at specified gage locations.

Plot the hydrographs

Precipitation data

We read in the precipitation time series data from the two different products using xarray.

Now we calculate a domain-wide mean precipitation time series and plots the two products.

While the domain-average precipitation time series is mostly consistent between the products, Stage IV shows somewhat lower precipitation towards the end of the event.

Since the two products have different native spatial resolutions (NLDAS is ~13km while Stage IV is ~4km), we should also examine the spatial patterns of precipitation.

Discussion

The spatial pattern of the two precipitation forcing datasets are very different. Stage IV peaks on the north-west part of the domain and does not contribute to streamflow generation. Additionally, the upstream contributing area has generally a higher mean precipitation rate in the NLDAS forcing compared to the StageIV, resulting in lower streamflow when using the StageIV precip.

Next up - Exploring terrain physics

This concludes lesson 4.

In the next lesson, we will explore terrain physics options and parameters.

IT IS BEST TO EITHER SHUTDOWN THIS LESSON OR CLOSE IT BEFORE PROCEEDING TO THE NEXT LESSON TO AVOID POSSIBLY EXCEEDING ALLOCATED MEMORY. Shutdown the lesson be either closing the browser tab for the lesson or selecting Kernel -> Shut Down Kernel in JupyterLab.

© UCAR 2020