Science moves fast. With Inductiva, so can you.
This tutorial demonstrates how to run SWMM simulations using the Inductiva API, guiding you through the Example 8 use case from the SWMM Applications Manual.
Example 8 focuses on modeling combined sewer systems, which transport both sanitary wastewater and stormwater through shared pipes. During moderate to heavy rainfall, these systems may exceed their conveyance and treatment capacities, leading to Combined Sewer Overflows (CSOs). This example illustrates how SWMM can be used to simulate such systems in Inductiva.
For additional context and reference material, consult the Swmm_Apps_Manual.pdf included with the examples package.
Download the SWMM examples collection from the EPA website here.
Inside the downloaded archive, locate the files.zip folder, which contains the Example8.inp input file required for this example.
Here is the code required to run a SWMM simulation using the Inductiva API:
"""SWMM example."""
import inductiva
# Allocate cloud machine on Google Cloud Platform
cloud_machine = inductiva.resources.MachineGroup( \
provider="GCP",
machine_type="c2d-highcpu-2",
spot=True)
# Initialize the Simulator
swmm = inductiva.simulators.SWMM(version="5.2.4")
# List of commands to run
commands = [
"runswmm Example8.inp model.rpt",
]
# Run simulation
task = swmm.run(\
input_dir="/Path/to/epaswmm5_apps_manual/files",
commands=commands,
on=cloud_machine)
# Wait for the simulation to finish and download the results
task.wait()
cloud_machine.terminate()
task.download_outputs()
task.print_summary()
In this basic example, we're using a cloud machine (c2d-highcpu-2) equipped with 2 virtual CPUs. Since SWMM runs in a single thread, increasing the number of vCPUs wonโt speed up a single simulation. You may consider switching machine families via the machine_type parameter, as newer CPU generations can improve single-core performance. Explore the full range of available machines here.
Note: Setting
spot=Trueenables the use of spot machines, which are available at substantial discounts. However, your simulation may be interrupted if the cloud provider reclaims the machine.
To adapt the code for this or any other use case, simply replace input_dir with the path to your SWMM input files and
set the commands accordingly. Be sure to specify the SWMM version compatible with your input files.
When the simulation is complete, we terminate the machine, download the results and print a summary of the simulation as shown below.
Task status: Success
Timeline:
Waiting for Input at 18/12, 16:37:03 1.115 s
In Queue at 18/12, 16:37:04 36.949 s
Preparing to Compute at 18/12, 16:37:41 1.514 s
In Progress at 18/12, 16:37:42 1.444 s
โ> 1.183 s runswmm Example8.inp model.rpt
Finalizing at 18/12, 16:37:44 0.934 s
Success at 18/12, 16:37:44
Data:
Size of zipped output: 253.98 KB
Size of unzipped output: 3.37 MB
Number of output files: 3
Total estimated cost (US$): 0.010019 US$
Estimated computation cost (US$): 0.000019 US$
Task orchestration fee (US$): 0.010 US$
Note: A per-run orchestration fee (0.010 US$) applies to tasks run from 01 Dec 2025, in addition to the computation costs.
Learn more about costs at: https://inductiva.ai/guides/how-it-works/basics/how-much-does-it-cost
As you can see in the "In Progress" line, the part of the timeline that represents the actual execution of the simulation, the core computation time of this simulation was 2 seconds.
Test Your Inductiva Setup
Test your Inductiva.AI setup by running a quick SWMM simulation in the cloud before scaling to larger urban drainage studies.
The Inductiva Guide to WAVEWATCH III ๐
Learn to run and scale WAVEWATCH III simulations on the Inductiva.AI Cloud HPC platform. Explore tutorials and benchmarks for ocean wave modeling.