Still juggling simulations between two machines and a prayer? Scale up in minutes with Inductiva.
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-4",
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-4) equipped with 4 virtual CPUs.
For larger or more compute-intensive simulations, consider adjusting the machine_type parameter to select
a machine with more virtual CPUs and increased memory capacity. You can 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 02/12, 11:29:08 1.21 s
In Queue at 02/12, 11:29:09 35.567 s
Preparing to Compute at 02/12, 11:29:45 1.342 s
In Progress at 02/12, 11:29:46 2.173 s
└> 1.977 s runswmm Example8.inp model.rpt
Finalizing at 02/12, 11:29:48 0.63 s
Success at 02/12, 11:29:49
Data:
Size of zipped output: 253.95 KB
Size of unzipped output: 3.37 MB
Number of output files: 3
Total estimated cost (US$): 0.010038 US$
Estimated computation cost (US$): 0.000038 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.