OpenSWMM Engine  6.0.0-alpha.3
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.3)
Loading...
Searching...
No Matches
RunoffInterface.hpp File Reference

Runoff interface file — save/load pre-computed runoff results. More...

#include <string>
#include <vector>
#include <cstdio>
Include dependency graph for RunoffInterface.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  openswmm::runoff_iface::RunoffInterfaceFile
 Runoff interface file manager. More...
 

Namespaces

namespace  openswmm
 
namespace  openswmm::runoff_iface
 

Detailed Description

Runoff interface file — save/load pre-computed runoff results.

Binary file format (matching legacy runoff.c exactly — files inter-operate with the legacy engine in both directions): Header:

  • File stamp: "SWMM5-RUNOFF" (12 bytes)
  • nSubcatch (int32)
  • nPollut (int32)
  • flowUnits (int32)
  • maxSteps (int32, updated at close) Per timestep:
  • tStep (float32, seconds)
  • Per subcatchment (values in USER units, per legacy subcatch_getResults(j, 1.0, x)):
    • rainfall (project rain units), snow_depth (×UCF(RAINDEPTH)), evap (×UCF(EVAPRATE)), infil (×UCF(RAINFALL)), runoff (×UCF(FLOW), zeroed below MIN_RUNOFF·area), gw_flow (total, ×UCF(FLOW)), gw_elev (×UCF(LENGTH)), soil_moist (8 float32)
    • washoff concentration per pollutant (nPollut float32, zeroed when runoff is zero)
Note
Legacy reference: src/legacy/engine/runoff.c, subcatch.c subcatch_getResults().
Fields with no refactored per-subcatchment state are written as 0 and skipped on read: snow_depth, gw_elev, soil_moist. Legacy's LID-drain addition to reported runoff is not replicated either (the refactored LID drain is architected as next-step runon).
The rainfall slot (write-only in both engines — neither read path consumes it) carries the live gage rate here vs legacy's report-period accumulator, which lags one report step; the first record may differ. Verified byte-identical to legacy everywhere else for US and SI models (2026-07-02).
The read path reproduces legacy runoff_readFromFile verbatim — including its evap asymmetry (written ×UCF(EVAPRATE) but read back ÷UCF(RAINFALL), a ×24 inflation) — so USE-mode results match a legacy USE run on the same file bit-for-bit in intent.
Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n MIT License