January 18, 2026

Integrating EPA SWMM with GoldSim for Stormwater Quality

Combining hydraulic modeling with system-level simulation allows for a more detailed look at stormwater treatment. I recently built a bridge to link EPA SWMM with GoldSim to handle both complex water routing and probabilistic contaminant transport in a single model.



How the Integration Works

The integration uses a dynamic link library (DLL) to connect the two programs. During the simulation, the models stay synchronized through the following steps:

  • GoldSim sends current rainfall rate (SCS design storm type III for this example) and the elapsed time to the SWMM engine. This part of the model could be replaced or enhanced with a stochastic model that introduces uncertainty into the generation of the storm. Currently, the model is running with a 5-minute time step.
    Screen Capture of the Design Storm Used for this Example

  • The SWMM engine calculates the runoff from catchments and the flow through storage units. See the link at the bottom of this article for a zip file containing all the files, including the input file for the SWMM model that includes the catchment and storage nodes. 
    Schematic Diagram of SWMM Model Components

  • SWMM passes these flow rates and volumes back to GoldSim.
    Input and Output Interface of the External element
  • GoldSim uses these hydraulic values to drive the movement of TSS mass between Cell pathways.

Contaminant Transport in GoldSim

While SWMM handles the hydraulics, GoldSim manages the water quality. This approach allows for greater flexibility in modeling how pollutants accumulate and move through a system. I represent the treatment train using a series of Cell pathways: a bioswale, a detention pond, and a retention pond.

Screen Capture of Contaminant Transport Cell Pathways in GoldSim

The model simulates sediment dynamics using a two-part mass balance approach that separates dry-weather accumulation from wet-weather transport. By calculating these processes in GoldSim, we can track the specific mass of Total Suspended Solids (TSS) as it moves through each stage of the treatment train.

Buildup and Washoff Logic

The accumulation of sediment in the watershed during dry periods is modeled using an Integrator element to represent the mass currently sitting on the watershed surface. The buildup follows an exponential function where the rate of accumulation decreases as the surface reaches a maximum limit:

B = C1 * (1 - e^(-C2t))

Where:

  • B is the total buildup mass.
  • C1 is the maximum buildup capacity per acre.
  • C2 is the buildup rate constant.
  • t is the number of dry days since the last rainfall event.

When the SCS design storm begins, the SWMM bridge passes the calculated runoff flow rate back to GoldSim. This flow drives the washoff rate, which determines the mass flux entering the bioswale:

W = B * C3* Q^C4

Where:

  • W is the TSS washoff rate (mass per time).
  • C3 is the washoff coefficient.
  • Q is the runoff flow rate provided by the SWMM bridge.
  • C4 is the washoff exponent that defines the strength of the first-flush effect.

This calculated washoff rate is used to calculate the concentration of TSS in discharge into the Bioswale Cell pathway. 

Screen Capture of the Exponential Buildup and Washoff Model in GoldSim


Modeling Treatment with Fraction of Inflows

To simulate pollutant removal in the bioswale and ponds, we use Fraction of Inflows mass flux links. These links are configured as follows:

  • Removal Efficiency: A specific percentage of the incoming mass is removed before it enters the mixing volume of the Cell.
  • Link Requirements: These links only act on mass fluxes that are entering from outside the Cell net (Normal or Previous-value links). They do not impact mass moving through Coupled links.
  • Destination: The removed mass is sent to a Sink Cell, allowing for a clear mass balance of what has been captured by the treatment system.
Bioswale Treatment using Fraction of Inflow Removal Rate

For this specific model, the bioswale is set with a removal fraction for TSS, that can defined as needed for analysis of the impact to receiving waters. Because the flows are passed from SWMM in real time, the mass transport remains hydraulically consistent throughout the simulation.

Time History Plot of TSS Concentration for Different Treatment Scenarios


The end result is an integrated modeling system, allowing you to visualize the impact of stochastic climate drivers on downstream water quality.

Screen Capture of the GoldSim Model with SWMM Interaction



Probabilistic Analysis

The primary advantage of this hybrid setup is the ability to run Monte Carlo simulations. By including uncertainty in rainfall patterns or treatment efficiencies, you can evaluate the risk of exceeding water quality limits during different storm events. This provides a more comprehensive view of system performance than a single deterministic run. Currently, the model is set up as deterministic for simplicity but could easily be integrated by downloading the model files and customizing the GoldSim model as you need.

Download the Example Model Files from here.

If you have any questions about this implementation, let us know in the comments!

No comments:

Post a Comment