December 6, 2025

Integrating the rTemp Water Temperature Model into GoldSim Using GSPy

Posted by Jason Lillywhite

This blog post describes a GoldSim model application that integrates the rTemp water temperature model. Originally developed by the Washington State Department of Ecology, the tool calculates the thermal dynamics of water bodies and has been ported to a Python library available on GitHub. This example demonstrates how to bridge daily timestep system models with hourly physics calculations, illustrated through a comparison of three distinct method configurations.

What is Response Temperature?

The name rTemp stands for Response Temperature. This is defined as the temperature that a fully mixed column of water would reach if surface heat fluxes were the only heat transfer processes occurring. The model calculates the rate of change in water temperature based on a net heat flux approach, represented by the governing equation:

dT/dt = Jnet / (D × ρw × Cpw)

Where the net heat flux (Jnet) accounts for the gain and loss of heat through:

  • Solar Shortwave Radiation: The largest heat source during the day.
  • Longwave Atmospheric Radiation: Thermal infrared radiation from the atmosphere.
  • Longwave Back Radiation: Heat lost from the water surface.
  • Convection & Evaporation: Driven by wind speed and vapor pressure gradients.
  • Sediment Conduction: Heat exchange with the streambed.

Method Selection

A feature of this Python implementation is the ability to select calculation methods based on available data.

For example, if atmospheric data is limited, the model can use the Bras method for solar radiation and the Brunt method for longwave radiation, which rely primarily on air temperature and turbidity estimates. For applications with detailed data (such as ozone and aerosols), the model can be configured to use the Bird-Hulstrom method. Wind functions can be selected based on the water body type, such as river-specific methods (e.g., Ryan-Harleman) or lake-specific methods (e.g., Marciano-Harbeck).

Screen capture of the GoldSim model with rTemp integration

Integration with GoldSim

This example demonstrates how to use the GSPy Python bridge to incorporate these physics calculations into GoldSim. GoldSim manages the system logic, water balance, and state, while rTemp performs the hourly heat budget calculations.

Because the Python physics engine is stateless, GoldSim acts as the controller, managing the water balance and passing data to Python only when a calculation is required.

Prerequisites

To run this integration, the following tools are required:

  • GoldSim 15 (or later)
  • Python 3.11 or 3.14 (64-bit distribution)
  • GSPy 1.8.8 (The platform-specific C++ bridge DLL)
  • Python Libraries: numpy, pandas, scipy, and the rtemp package.

The rtemp package is installed via pip: pip install git+https://github.com/jlillywh/rTemp.git


The Adapter Script

The integration relies on a Python script (rtemp_goldsim_adapter.py) that interfaces between the two environments. The script performs a temporal reconstruction at each step:

  1. Input & Validation: Accepts current conditions (flow, geometry, meteorology) and validates them. It checks for dry-bed conditions (depth < 0.01m) to prevent numerical instability.
  2. Disaggregation: Converts daily inputs (such as Min/Max Air Temp) into a 24-hour internal profile.
  3. Execution: Runs the rTemp physics engine for 24 hourly iterations.
  4. Return: Calculates final water and sediment temperatures and returns them to GoldSim along with diagnostic data.
Schematic diagram showing how the tools interact
Schematic diagram showing how the tools interact.

Managing State in GoldSim

Since the Python script is stateless, GoldSim must retain the water temperature from the previous timestep. This is achieved using a State Variable Feedback Loop:

  1. An External Element calls the Python script and outputs the New_Water_Temp.
  2. A Previous Value Element captures this result.
  3. In the next timestep, the Previous Value element feeds the temperature back into the External Element as the Initial_Water_Temp.
Screen capture showing how the GoldSim model interfaces with rTemp



Comparing Method Combinations

To demonstrate the application of different physics options, the model was run using three combinations of calculation methods. Each combination was selected to represent specific environmental conditions or data availability:

  • Standard (Bras-Brunt-BGG): The default configuration using Bras solar radiation, Brunt longwave radiation, and Brady-Graves-Geyer wind function. This combination is suitable for general applications.
  • Humid Climate (Ryan-Brutsaert-RH): Uses Ryan-Stolzenbach solar (elevation-aware), Brutsaert longwave, and Ryan-Harleman wind function. This combination is typically applied in humid climates and flowing water.
  • Variable Atmosphere (Iqbal-Brunt-MH): Employs Iqbal solar radiation (visibility-based), Brunt longwave, and Marciano-Harbeck wind function (from Lake Hefner studies). This configuration accounts for variable atmospheric conditions.
Comparison of water temperature predictions using three different method combinations over the simulation period.

While all three scenarios produce similar overall trends, predicted temperatures diverge based on the methodology. The Standard scenario provides a baseline, while the Humid Climate scenario predicts slightly higher temperatures due to reduced evaporative cooling from the Brutsaert longwave method. The Variable Atmosphere scenario demonstrates sensitivity to atmospheric changes via the Iqbal solar radiation method.

These differences indicate the importance of selecting methods appropriate to site conditions. The ability to switch between method combinations within GoldSim facilitates sensitivity analysis and uncertainty quantification. 

Assumptions

The model assumes a well-mixed water column, meaning there is no vertical stratification; the surface temperature is effectively the bulk temperature. This approach is applicable to streams, rivers, and shallow water bodies.

The physics are customizable. The ModelConfiguration can be adjusted within the Python script to toggle between different radiation models or wind functions without changing the GoldSim model structure. Alternatively, the adapter can be configured to control method selection directly from GoldSim using integer codes, enabling dynamic scenario comparison.

Conclusion

The GSPy bridge allows GoldSim to leverage rTemp's physics calculations within a probabilistic framework. This addresses the timescale difference between daily system models and hourly heat budget requirements, providing a solution for water quality modeling.

Download

November 6, 2025

Log Pearson Type III Flood Frequency Analysis of Simulated Streamflow

Posted by Jason Lillywhite

Engineers frequently need to estimate design floods that exceed the range of observed data, like the 100-year or 500-year flood that may not have occurred in the historical record. While GoldSim excels at empirical analysis using historical resampling (as shown in our previous post on annual peak flow statistics), parametric flood frequency analysis using the Log Pearson Type III distribution enables extrapolation beyond observed data.

This tutorial demonstrates a useful approach for those incorporating hydrology in your water balance models. The example model used in this tutorial performs Log Pearson Type III analysis on simulated annual peak flows generated from rainfall-runoff modeling within GoldSim. Rather than being limited by short historical streamflow records, this method uses rainfall-runoff simulation to generate extended flow datasets from much longer, available climate data.

The integration shows how to implement Log Pearson Type III flood frequency analysis for engineering applications using the methodology from USGS Bulletin 17C. Included in this tutorial are the following functions:

  • Simulation of streamflow using a rainfall runoff model
  • Design flood estimates for standard return periods (2, 5, 10, 25, 50, 100, 200, 500 years)
  • Quality assurance metrics

The integration uses GSPy (GoldSim-Python Bridge) to connect GoldSim's dynamic simulation capabilities with Python's advanced statistical analysis libraries, enabling flood frequency analysis within your existing GoldSim workflow.

GoldSim model displaying Log Pearson Type III flood frequency analysis results with regulatory compliance metrics
Figure 1. GoldSim model results - Log Pearson Type III flood frequency analysis results with time series of daily simulated streamflow.


November 5, 2025

GoldSim Tutorial: Calculating and Displaying Annual Peak Flow Statistics

Posted by Jason Lillywhite

Reliable peak river flow statistics are necessary for effective design, planning, and risk communication. GoldSim can calculate a range of statistics for flood frequency analysis, such as the flow associated with a specific return period (e.g., the 99th percentile flow) or the timing distribution of the annual peak flow. This tutorial walks you through building a model to calculate these types of statistics in GoldSim, focusing on displaying results on a dashboard: 

  • Median Peak Flow
  • Median Time of Peak (Day of the Year)
The GoldSim Extrema element captures these annual extreme values. To display specific statistics (like a percentile or value at a percentile), these statistics need to be shown on a Dashboard, which requires a specific setup. I will show the process of screening out a certain group of results, so the result statistics reflect that screening.

GoldSim Model Dashboard showing Annual Peak Flow Statistics

Figure 1. GoldSim Model Dashboard: Annual Peak Flow Statistics

November 3, 2025

Coupling GoldSim and MODFLOW using a Python Interface

This post describes a method for coupling GoldSim with MODFLOW using GSPy (GoldSim's Python interface) and FloPy (a Python package for creating MODFLOW models). The approach builds on existing work like the Dynamic Coupling of GoldSim and MODFLOW/MT3D project but focuses on a simplified implementation suitable for educational purposes.

Implementation Approach

Traditional model coupling typically requires:

  • Writing temporary input files
  • Managing external executable calls
  • Parsing output files for results
  • Handling timing and synchronization
  • Managing file system operations

The GSPy + FloPy approach uses:

  1. GSPy to handle communication between GoldSim and Python
  2. FloPy to create and manage MODFLOW models in memory
  3. Python functions that receive GoldSim inputs and return results
  4. FloPy's built-in file management for MODFLOW input/output

This implementation uses a Tutorial 2 style MODFLOW setup for educational purposes.

October 19, 2025

River Network Optimization using GoldSim - Python Integration

In this post, I'll explore a use case for the GSPy bridge: dynamically solving a complex river allocation problem using Python's PuLP Linear Programming (LP) library at every timestep of a GoldSim simulation.

The challenge of simulating a river network with sequential diversions, return flows, and competing demands governed by priorities is non-trivial. By moving the allocation decision to an external optimizer, we can achieve optimal water delivery in a way that is challenging to replicate with explicit rules-based logic.

September 29, 2025

Modeling Integrated Water Resources Management (IWRM) with GoldSim

Creating an Integrated Water Resources Management (IWRM) model is useful for making informed decisions. In this post, I'll explore how to use GoldSim and a combination of pre-built model examples from the GoldSim model library to build an IWRM model that can be used for forecasting and long-term planning.

The model you see here is an example of IWRM because it combines several components: hydrology, a system network, operating rules, water rights law, and water demand forecasting. Let's take a look at how I've modeled each of these.

Screen Capture of the IWRM Example Model

Note: As you read through this post, you'll see references to many example models in our library and links to our Help Documentation. These resources are designed to help you build and customize your own model.

September 6, 2025

An Investigation into Long-Term Precipitation Patterns in the Pacific Northwest

When modeling long-term precipitation, a question is how to account for climate change. A common approach is to analyze historical data for trends, but what happens when a simple analysis of precipitation totals doesn't show a clear signal? This post documents an investigation into a more nuanced approach for a stochastic precipitation model.



August 26, 2025

Clones, Arrays and Indexing for Large Multi-node Models; Solubility calculations and other uses

We are pleased to showcase an interesting presentation by Alex Fitzpatrick, a Senior Modeler at Klohn Crippen Berger Australia. Presented at the 2024 GoldSim User Conference, Alex's work presents a practical and innovative approach to managing the inherent complexity of large-scale water quality models in GoldSim. 

This approach can address the challenge of managing many parameters in models that track water, water quality, and material across numerous locations. By strategically employing GoldSim's cloning, array, and indexing capabilities, Alex demonstrates how modelers can achieve better organization, transparency, and scalability. This technique can be valuable for models with thousands of elements and multiple levels of sub-containment, such as those simulating complex interactions within chemistry control points, reservoirs, and various mine operation and closure plans. 

Read on to see how these advanced GoldSim features transform large datasets into manageable simulations.

July 21, 2025

GoldSim Dashboard Tips ‘n’ Tricks

Illustrative examples from models for radioactive waste management
John Tauxe, PhD, PE • Tauxian Solutions, LLC
with Jason Lillywhite • GoldSim Technology Group

Designing effective graphical user interfaces (GUIs) makes complex models accessible and interactive. This blog post, based on a poster presentation submitted by John Tauxe of Tauxian Solutions, LLC at the 2024 GoldSim User's Conference, shares practical tips and "tricks" for building powerful GoldSim Dashboards. These strategies are particularly well-suited for applications such as radioactive waste management models, where clear visualization and user flexibility are required. We'll explore various techniques for organizing interactive elements, visualizing model changes, and even implementing workarounds for advanced functionalities to enhance the user experience.

July 14, 2025

Modeling Shared Water Rights in Reservoir Systems

 Posted by Jason Lillywhite

Managing water in the Western United States is a complex challenge, especially in shared reservoir systems governed by the "prior appropriation" doctrine. This legal framework determines who gets water, and when, based on their legal rights and the ever-changing natural water supply. Dynamic simulation is a tool that enables you to better understand this type of system and visualize its behavior, leading to clearer insights and more reliable predictions.


This guide outlines a methodology for simulating shared water rights within a reservoir using dynamic simulation, applicable to various modeling environments. While the concepts are demonstrated using an example model built in GoldSim (with full details and the model available here), the principles are broadly transferable to other platforms, such as Python.

May 12, 2025

Updated Mine Water Balance Model

 Posted by Jason Lillywhite

Our conceptual Mine Water Balance model, built in GoldSim, has been updated to take advantage of the latest software features and align it with to our own Style Recommendations. This model, designed as an educational template rather than a site-specific solution, demonstrates the interconnectedness of key facilities such as a Process Water Dam (PWD), a secondary buffer dam (Dam 2), a Tailings Storage Facility (TSF), and the Process Plant.

A glimpse into the simulated mine water system.


This updated version includes a re-organization of model elements to provide a clearer and more intuitive visualization of the water balance pathways throughout the simulated mine site. To build confidence in simulation outputs, a mass balance validation test has been integrated, allowing users to verify the conservation of water across the system. The accompanying model documentation has been updated, offering more detailed explanations of the model's logic, components, and operational assumptions. Finally, the dashboards have been refreshed to demonstrate how to create a "navigation tabs" feel.

May 6, 2025

Modeling Spatially Correlated Rainfall in GoldSim

 Posted by Jason Lillywhite

Effective water resource management hinges on accurately modeling precipitation. But what happens when rainfall patterns differ significantly between 2 locations within your study area. For example, precipitation on a valley floor compared to the mountainous watershed nearby? This post explores a practical method using GoldSim to simulate precipitation that is linked, or spatially correlated, across different locations. 


We'll use real-world daily rainfall data from two distinct sites in Utah to demonstrate how to set up and parameterize such a model. Read on to see how rainfall correlation between these valley and mountain locations led to more realistic hydrological simulations in GoldSim.

April 29, 2025

An evaluation of scenarios for a radioactive repository using GoldSim

  Posted by        Jason Lillywhite

Safely isolating high-level radioactive waste for millennia requires more than just deep geological disposal; it relies on a "multi-barrier" approach. This involves several layers of protection designed to contain the hazardous waste. Key components are the "engineered barriers," which are man-made structures placed within the repository. These can include the waste's immediate disposal container, the surrounding structure often called a silo, and robust materials like concrete used extensively within the repository environment. These work together with the natural geological barrier (the surrounding rock) to prevent or slow the release of radioactive materials.

Today, I want to showcase a study evaluating scenarios for a radioactive waste repository using GoldSim. This study was presented at the recent GoldSim 2024 User Conference. It looks at the long-term durability of concrete and how its deterioration might affect the overall safety of these facilities over vast timescales.

This study, by researchers at Chosun University, explores how dynamic, probabilistic simulation can help predict the performance of these engineered barriers. Ensuring the long-term safety of high-level radioactive waste disposal requires understanding complex phenomena, and GoldSim provides a powerful way to evaluate potential scenarios.

Here's a visual representation of the kind of post-closure scenario they're modeling, showing how groundwater might interact with the repository barriers:

Figure 1: Disposal facility post-closure performance modeling evaluation scenario

Read on to explore how they combined experimental data with GoldSim modeling to assess the impact of concrete degradation.

March 31, 2025

Using Conditional Containers to Simulate Crop Growing Seasons

 Posted by Jason Lillywhite

Modeling sequential, time-dependent processes lies at the heart of many dynamic simulations. But what happens when the duration of each step is uncertain or changing during the simulation? Consider simulating crop growth stages based on the FAO Irrigation and Drainage paper 56 for modeling crop water demand. Accurately capturing the variability in crop stage durations is important, and ensuring stages trigger correctly using traditional conditional logic can become complex and error-prone under uncertain conditions.  A previous version of the model described here that I built years ago relied heavily on nested IF statements to manage stage transitions. I was always bothered by this implementation, knowing that if the precise duration of each stage wasn't fixed at the simulation start, dynamically ensuring the correct sequence could become extremely difficult to implement reliably.

Screen Capture of the Crop Growing Season Scheduler using Conditional Containers

This post explores how GoldSim's Conditional Containers provide an improved solution. I'll walk through the new version where each growth stage resides in its own Container, dynamically triggered by the completion of the previous one (as shown in the model structure pictured). Discover how this approach not only simplifies the representation of sequential logic but also seamlessly integrates stochastic durations, leading to a more robust, understandable, and maintainable model for Monte Carlo analysis. Read on to see this powerful technique in action! 

March 4, 2025

GoldSim as a Predictive Tool for Oil Sands Mining Operations

Posted by  Jason Lillywhite

We are pleased to share insights from a recent presentation by Candace Whitten, GIT and Matthew Ryans, P.Eng from WSP.  This work was presented at the 2024 GoldSim User Conference. 

Oil sands mining operations generate multiple tailings types requiring various treatment methods, storage components, and time for tailings maturation. GoldSim was employed to develop a dynamic material mass balance model simulating future tailings production and treatment alternatives.

Figure 1 - Schematic diagram of bitumen extraction and tailings storage and treatment

The model provided insights into the production of coarse and fine solids, informed by ore grade and production schedules. It identified high-sensitivity parameters and ensured compliance with site-specific thresholds, as established by Directive 085. This compliance guarantees that the modeled treatment technologies are sufficient for managing fluid tailings and that there is no net growth of fluid tailings beyond the life of mine (LOM) production. Additionally, the model offered insights into optimizing tailings management to minimize environmental impact and support sustainable mining practices. 

February 7, 2025

Physically Based vs. Feedback Control Models: Choosing the Right Approach for Water System Simulation

 Posted by  Jason Lillywhite

We’ve often been asked about the best way to simulate flow between two tanks: should it be modeled physically, based on fluid mechanics, or actively controlled using a feedback mechanism? With the release of GoldSim 15 and its new Controller element, now is a good time to compare these approaches and perhaps even combine them. In this post, we’ll examine the performance of our existing physically based model (Flow Between Two Tanks) alongside a feedback-controlled version using the Controller element. By comparing these methods, we’ll explore their strengths, limitations, and when one approach might be preferable over the other.



January 14, 2025

Building Better Water Balance Models for Tailings and Mine Rock Stockpiles

Posted by  Jason Lillywhite

We are pleased to share insights from a recent presentation by Tony Zheng (University of Alberta Geotechnical Centre / OKane Consultants), Rebecca Hurtubise (AECOM), and Nicholas Beier (University of Alberta Geotechnical Centre).  This work was presented at the 2024 GoldSim User Conference. Their work focuses on building better water balance models for tailings and mine rock stockpiles, addressing critical challenges in mining operations.

In this blog post, you'll discover how physics-based models developed in GoldSim can provide insights into water balance, acid rock drainage (ARD) risks, and effective closure strategies. These advanced modeling techniques offer actionable knowledge to improve mine closure practices and ensure long-term environmental sustainability.


Read on to explore their innovative approaches and practical applications in the field of mining hydrology and geotechnical engineering.

December 8, 2024

Testing PrecipGen Across Four Sites

Posted by  Jason Lillywhite

This blog post presents the results of testing PrecipGen across four diverse locations to evaluate its performance:

  • Australia Plains, AU
  • Grand Junction Walker Field, CO, USA
  • Dublin, EI
  • Orlando, FL, USA

The findings demonstrate that PrecipGen successfully represents both short- and long-term daily precipitation totals at individual locations, validating its ability to replicate observed climatic behavior across varied environments.


To read more about the PrecipGen model and how to use it, please refer to the GoldSim Library where you can read about it and download PrecipGen PAR and PrecipGen for your own use: Precipitation Simulator (PrecipGen) – GoldSim Help Center

October 9, 2024

Estimating Exchange Fluxes Between Surface Water and Groundwater Using Stable Isotope and Radon Models

Posted by  Jason Lillywhite

I'm excited to share a recent paper by Lloyd Townley and Jeffrey Turner, which showcases the use of GoldSim software in modeling surface and groundwater interactions. The research introduces the Lake Water Balance Calculator (LWBC), a tool developed using GoldSim, to estimate groundwater-surface water flow rates. This tool leverages transient balance solutions for radon, coupled with volumetric flow equations, and presents results from multiple case studies.

LWBC dashboard in GoldSim
LWBC dashboard in GoldSim


May 13, 2024

PrecipGen: Long-Term Precipitation Forecasting

Posted by Jason Lillywhite

A GoldSim model that simulates long-term daily precipitation (PrecipGen) has been added to the GoldSim Model Library. We applied the model to locations in Logan, Utah and Dublin Ireland to help evaluate the effectiveness of this model's ability to forecast daily precipitation rates and capture long term droughts. This application is useful for GoldSim modelers looking to incorporate randomly generated rainfall forecasts in their water balance models. The model shows promise in simulating precipitation for a site that is influenced by multi-year wet and dry cycles. Informal testing has been showing signs of robustness and some refinements to the testing are currently underway.

Figure 1 - Screen Capture of PrecipGen with Results