This library model demonstrates how to simulate water temperature in a river reach or shallow water body using the rTemp Python package integrated with GoldSim. It allows you to drive a heat budget model using GoldSim's stochastic weather generators and system logic.
The model calculates the daily response temperature based on hourly heat flux calculations performed by the rTemp engine. It includes a complete stochastic weather generator (Precipitation, Air Temperature, and Wind) to demonstrate the model's response to variable environmental conditions.
Model Organization
The model is organized into the following containers:
- Water_Temperature: Contains the external interface to the Python script, state variables for water and sediment temperature, and the main flux calculations.
- Site_Parameters: Contains the static input data defining the physical location of the simulated water body.
- Precipitation, Air_Temperature, Wind: These containers generate stochastic weather data to drive the physics engine. In a real-world application, you might replace these with time series data from a spreadsheet.
Integration Logic
The integration uses the GSPy connector to pass daily state variables from GoldSim to Python. The Python script disaggregates this daily data into hourly time steps, solves the heat budget differential equation, and returns the final water temperature for the day. GoldSim stores this value using a Previous Value element (Current_Water_Temp) to initialize the next day's calculation.
Input Requirements
To adapt this model for your specific site, you must update the values in the Site_Parameters container:
- Latitude: Decimal degrees (positive for Northern Hemisphere).
- Longitude: Decimal degrees.
- Elevation: Site elevation in meters.
- Timezone: The offset from UTC (e.g., -8 for PST).
Additionally, you must define the Water_Depth (located at the model root). This determines the volume of the water column and significantly impacts the thermal inertia of the system.
Physics Method Configuration
The rTemp engine supports multiple calculation methods for solar radiation, longwave radiation, and wind effects. You can switch between these methods by changing the integer values in the Data elements located at the model root (Solar_Method, Long_Wave_Method, and Wind_Method).
Refer to the tables below to select the appropriate code for your site conditions.
Solar Radiation Methods (Solar_Method)
| Code | Method | Description |
| 1 | Bras (Default) | Simple atmospheric attenuation. Recommended for general use when data is limited. |
| 2 | Bird-Hulstrom | Detailed clear-sky model. Best for high-accuracy requirements. |
| 3 | Ryan-Stolzenbach | Elevation-corrected. Recommended for high-elevation sites. |
| 4 | Iqbal | Visibility-based. Accounts for variable atmospheric conditions. |
Longwave Radiation Methods (Long_Wave_Method)
| Code | Method | Description |
| 1 | Brunt (Default) | Classic vapor pressure model. Recommended for general use. |
| 2 | Brutsaert | Improved vapor pressure model. Recommended for humid climates. |
| 3 | Satterlund | Temperature-dependent. Better performance in cold climates. |
| 4 | Idso-Jackson | Simplified model for quick estimates. |
| 5 | Prata | Modern formulation used primarily in research. |
Wind Function Methods (Wind_Method)
| Code | Method | Description |
| 1 | Brady-Graves-Geyer (Default) | Modern formulation. Recommended for general use. |
| 2 | Marciano-Harbeck | Based on Lake Hefner study. Recommended for large lakes. |
| 3 | Ryan-Harleman | Classic formulation. Recommended for rivers and streams. |
| 4 | Weisman | Alternative formulation used for specific validation studies. |
Software Requirements
To run this model, the following software must be installed on your machine:
- GoldSim 15 (or later)
- Python 3.10+ (64-bit)
- GSPy 1.8.8+
- The rtemp Python library (install via pip: pip install git+https://github.com/jlillywh/rTemp.git)
See the rTemp project for full documentation on the underlying Python physics engine.
Contact:
Jason Lillywhite (Lillywhite Water Solutions)
Comments
0 comments
Please sign in to leave a comment.