## Friday, September 21, 2018

### Runoff Modeling in GoldSim

Posted by Jason Lillywhite

This blog post provides you with some pointers that should help you build a runoff model in GoldSim. Now that many models have been added to our Model Library, there are many components you can drag and drop into your model to help with the development and calibration of a watershed model that is used to calculate a downstream runoff hydrograph based on upstream precipitation and changing temperature. Snowmelt is also discussed.

A runoff model is a mathematical representation of the process of precipitation falling on a watershed and running off to produce streamflow at the outlet of the watershed. The model translates a precipitation event or multiple events to a runoff hydrograph or series of hydrographs.

## Should I Use GoldSim to Simulate Runoff?

There are many existing runoff modeling tools that are widely available, like the U.S. Army Corps of Engineers HEC-HMS or the U.S. National Weather Service's Sacramento Soil Moisture Accounting model. The algorithms in these kinds of tools are not always trivial and they do not come included in the GoldSim software. Many runoff algorithms may not be easy to build from scratch, have complex logic, and have been developed over many years with a lot of testing. These tools also have a fixed time step while GoldSim (being a dynamic simulator) can insert unscheduled events and time points. These differences likely require some changes in the model logic if implemented natively in GoldSim. Given these facts, why would I use GoldSim to simulate the process that these other tools already have the capability to do?
There are multiple reasons why it might be a good idea to build runoff modeling algorithms natively in GoldSim. The most obvious of these is probabilistic simulation. In many systems, the controlling parameters, processes and events may be uncertain and/or poorly understood. Probabilistic simulation is the process of explicitly representing this uncertainty by specifying inputs as probability distributions and specifying any random events that could affect the system. GoldSim has powerful capabilities for carrying out probabilistic simulations. In particular, it uses advanced Monte Carlo simulation techniques to propagate the uncertainty in model inputs to model outputs.
Some other reasons to choose GoldSim for the modeling platform for runoff modeling are portability, ease of use, and simulating feedback between the downstream system and the runoff process. For example, it is much easier to have all of your model logic in a single model file (all in GoldSim) so that you can distribute the model to your audience without having to refer back to multiple programs and maintain the linkages between them.
Keep in mind that there is a middle-ground: you can dynamically link GoldSim to other tools using a DLL and this has been done successfully with external software tools like EPA-SWMM.
If you decide that GoldSim is a good choice for your runoff modeling work, continue reading!

## Steps to Building a Runoff Model in GoldSim

Below are the recommended steps for constructing a runoff model natively in GoldSim. As always, there are multiple ways of accomplishing the same thing in GoldSim but the steps outlined below have proven to help guide me through multiple projects that involve a runoff component in the model.
1. Establish requirements: Before constructing the model, ask what the model is supposed to solve, what level of detail you need to include, who your audience will be, and how you will present your results. The level of detail will influence the time settings, which might impact the data collection and underlying logic of the model. You should also take a little time to estimate the sensitivity of the system to runoff that is received from the watershed. If the system isn't very sensitive to this process, then it might not be worth adding a lot of detail to the runoff model. If this is the case, consider choosing a more simplistic methodology. You can always go back later and add detail, if needed.
2. Gather and organize data: Once you have determined what kind of data is available, the actual process of data collection can be done in parallel with building the model (see next steps). Typical time series data required for runoff model includes temperature, precipitation, and downstream flow rate. Other data includes information that characterizes the watershed like soil types, aspect, elevation mapping, vegetation, etc. If the watershed runoff is driven by snow melt, then ideally you would also have snow water equivalent (SWE) time series data. You can also temporarily use Stochastic elements in lieu of time series so model construction can continue while waiting for data, if necessary.
3. Select model components: It is important to understand and choose the components you plan to assemble for the runoff model before you dive into model construction. The components you choose will partly be driven by how much detail you plan to include. For example, if you lack the necessary time series data records and must rely on monthly estimates of precipitation and temperature, then a runoff model of choice might be a simple Mass Balance model instead of something much more detailed like HSPF in GoldSim (both of which are available in our Model Library, by the way). The following model components are available in our GoldSim Model Library:
4. Delineate the watershed: One very simple tool to help with watershed delineation is Google Maps drawing tools with the terrain layer turned on. From this mapping tool, you can draw polygons along contour lines to delineate the elevation zones used for the snow melt model and/or runoff routing model. Below is an example of a map drawn in this tool. Of course, GIS tools could also be used for this same purpose.   I like to take a screen capture of the map, paste it into the model, then overlay the image with the model components.
5. Build a calibration model: This is the point at which the model actually starts to get assembled. You can use optimization to calibrate the model but it is recommended that you find ways to understand what parameters the model is most sensitive to first. Also, spend some time running manual iterations for calibration by visually inspecting time history results to see how the simulation results compare to the historic record. Below is a sample of what this kind of plot might look like. There are multiple ways to build a watershed model in GoldSim. Three of these are outlined below.
• Copy and paste containers: This is probably the easiest to build but the most difficult to maintain and change down the road. Once you have divided your watershed into multiple catchments, put all the runoff modeling logic for each catchment into a localized container. Now, copy and paste this container for all the other catchments. Doing this approach means that you should have the logic in the first container complete (or very near complete) before you copy and paste the components. Once you have them pasted, you can just link the discharge flows from each to build the flow network within the watershed. The sum of all the catchment flows should be the total watershed runoff.
• Cloned Containers: This is a little more difficult to design and build but easier to change and reconfigure down the road. In this process, you put the runoff model logic into a localized container and build the logic as a generic object that is going to be reused for each of your other catchments. The name of this container might be something like "Runoff". Next, move that container into yet another localized container that has a name that represents the catchment. Create localized containers for all the other catchments in the watershed then clone the "Runoff" container into all of those catchment containers. Now any future changes you make to the "Runoff" module will be replicated to the clones.
• Array Functions: This method is probably the most difficult to build because you are dealing with array expressions instead of scalar but it is the easiest to maintain down the road because all of your catchments are just rows within an array so you only need 1 set of equations to represent all of the catchments.
6. Modify the model to simulate future conditions: This is the final stage in the modeling process. Typically, once the calibration is completed, you would shelf that model and save it for documentation purposes. The calibration model becomes the foundation for all further work with this model. Carry forward the work you've done to this point by modifying it for simulations of current and future conditions. It's important that the calibration is solid at this point because if it isn't, there is a good chance you will find problems where your future conditions model is not robust enough and needs to be further refined. But if you do find problems with the underlying logic of the model at this point, you will need to fix it then circle back to the calibration model and merge these updates. If you plan to incorporate uncertainty and risk in your model, you would likely add some probabilistic climate simulation components to the model that replace the temperature and precipitation time series.

## Documentation and Version Control

Building your runoff model might involve many iterations of changes to the input data and model logic. It is important that you document the changes and additions made to the model along the way. I recommend that you implement GoldSim's versioning feature to help document these changes as the model progresses. My approach is to append the version number to the end of the file name.
In GoldSim's version manager, simply click on "Create Version..." and you will see that the version number automatically increments. Provide a meaningful name and description of the work you intend to do and make sure to keep it in a small manageable chunk of work. Trying to make too many changes to your model at once leads to lack of organization and eventually errors down the road.

## Conclusion

Hopefully this article provides you with some helpful tips to guide you through the process of first deciding if GoldSim is the best approach for your runoff model and if so, helps you successfully build, calibrate, and maintain an effecting representation of a watershed runoff model.