Stormwater Management Model (SWMM)

repository·develop·Indexed 43 days ago

https://github.com/usepa/stormwater-management-model

A professional-grade hydrology-hydraulic simulation solver for modeling runoff quantity and quality in urban areas. Implemented in C, SWMM supports single-event and continuous long-term simulations. Version 5.2 introduces HEC-22 inlet analysis, conical and pyramidal storage units, Type5 variable speed pumps, and advanced control rules with named variables and arithmetic expressions.

Tokens
3K
Snippets
13
Records
17
Agent score
57%

What's inside SWMM

  1. Overview of the Stormwater Management Model (SWMM)

    develop
    The Stormwater Management Model (SWMM) is a dynamic hydrology-hydraulic water quality simulation model. It is designed for both single-event and long-term (continuous) simulations of runoff quantity and quality, primarily in urban environments. The solver is implemented in the C programming language and is released in the Public Domain.
  2. Implement HEC-22 Inlet Analysis

    develop

    SWMM 5.2+ supports HEC-22 methodology to model surface runoff captured by street inlets and sent to a below-ground drainage system. This requires three specific input sections: [STREETS] for cross-section geometry, [INLETS] for inlet designs, and [INLET_USAGE] to link inlets to conduits and sewer nodes.

    Key Implementation Details:

    • Curb & Gutter inlets: Must be used with street conduits.
    • Drop inlets: Must be used with trapezoidal channels.
    • Routing Compatibility: Works with all routing procedures. For Kinematic Wave and Steady Flow, it is recommended to use storage nodes at the end of inlet conduits that converge at sag points to prevent non-captured flow from exiting the system.
    • Flow Dynamics: Captured flow is limited by the capacity of the receiving sewer node to prevent flooding. If the sewer node is at capacity, excess flow is sent back through the inlet onto the street.
    • Reporting: A new 'Street Flow' table in the Status Report provides peak flow, roadway spread/depth, capture efficiency, and backflow frequency.
  3. Build the SWMM 5.2 engine on Linux or MacOS

    develop

    To build the SWMM 5.2 engine shared object library (libswmm5.so) and the command line executable (runswmm) on Linux or MacOS, use CMake to generate and run the build.

    Steps:

    1. Create and enter a build directory:
      mkdir build
      cd build
    2. Generate the build system:
      cmake ..
    3. Compile the project:
      cmake --build .

    Outputs: The files libswmm5.so and runswmm will be located in the build directory.

    mkdir build
    cd build
    cmake ..
    cmake --build .
  4. Build the SWMM 5.2 engine on Windows

    develop

    To build the SWMM 5.2 engine library (swmm5.dll) and the command line executable (runswmm.exe) on Windows, you must use CMake and a Microsoft Visual Studio C compiler.

    Prerequisites:

    • CMake version 3.5 or higher.
    • Microsoft Visual Studio C compiler.

    Steps:

    1. Open a console and navigate to the project root directory.
    2. Create and enter a build directory:
      mkdir build
      cd build
    3. Generate the build system using CMake. Replace <compiler> with your specific Visual Studio version (e.g., "Visual Studio 16 2019") and <platform> with Win32 or x64:
      cmake -G <compiler> .. -A <platform>
    4. Compile the project in Release mode:
      cmake --build . --config Release

    Outputs: The files swmm5.dll and runswmm.exe will be located in the build\Release directory.

    mkdir build
    cd build
    cmake -G "Visual Studio 16 2019" .. -A x64
    cmake --build . --config Release
  5. Use Named Variables and Arithmetic in Control Rules

    develop

    SWMM 5.2 allows for more complex control logic using Named Variables and Arithmetic Expressions.

    Named Variables

    Variables act as aliases for object attributes. They are defined using the format: VARIABLE name = object type name attribute

    Example:

    [RULES]
    VARIABLE Dabc = NODE abc DEPTH
    VARIABLE Defg = NODE efg DEPTH
    VARIABLE P45 = PUMP 45 STATUS
    
    RULE 1
    IF Dabc > Defg
    AND P45 = OFF
    THEN PUMP 45 STATUS = ON

    Arithmetic Expressions

    You can define mathematical expressions using named variables. They are defined using the format: EXPRESSION name = f(variable1, variable2, ...)

    Example:

    [RULES]
    VARIABLE Q1 = LINK 1 FLOW
    VARIABLE Q2 = LINK 2 FLOW
    VARIABLE Q3 = LINK 3 FLOW
    EXPRESSION Net_Inflow = (Q1 + Q2)/2 - Q3
    
    RULE 1
    IF Net_Inflow > 0.1
    THEN ORIFICE 3 SETTING = 1
    ELSE ORIFICE 3 SETTING = 0.5
    [RULES]
    VARIABLE Dabc = NODE abc DEPTH
    VARIABLE Defg = NODE efg DEPTH
    VARIABLE P45 = PUMP 45 STATUS
    
    RULE 1
    IF Dabc > Defg
    AND P45 = OFF
    THEN PUMP 45 STATUS = ON
  6. Configure the [INLET_USAGE] section

    develop

    The [INLET_USAGE] section assigns specific inlet designs to street conduits.

    Format: Link Inlet Node (Number %Clogged Qmax aLocal wLocal Placement)

    ParameterDescription
    Linkname of street conduit containing the inlet
    Inletname of inlet structure to place in street
    Nodename of sewer node receiving flow intercepted by inlet
    Numbernumber of inlets placed on each side of street (default: 1)
    %Cloggeddegree to which inlet capacity is reduced due to clogging (%) (default: 0)
    Qmaxmaximum flow that inlet can intercept (0 = no restriction)
    aLocalheight of local gutter depression (in or mm)
    wLocalwidth of local gutter depression (ft or m)
    PlacementAUTOMATIC, ON_GRADE, or ON_SAG (default: AUTOMATIC)

    Notes:

    • AUTOMATIC placement lets SWMM decide based on topography.
    • Local gutter depression (aLocal, wLocal) applies only over the length of the inlet.
    Link  Inlet  Node  (Number  %Clogged  Qmax  aLocal  wLocal  Placement)
  7. Configure the [STREETS] section

    develop

    The [STREETS] section defines the dimensions of street cross-sections used in the project. Each unique cross-section requires one line.

    Format: Name Tcrown Hcurb Sx nRoad a W Sides Tback Sback nBack

    ParameterDescription
    NameID name assigned to street cross section
    Tcrowndistance from curb to street crown (ft or m)
    Hcurbcurb height (ft or m)
    Sxstreet cross slope (%)
    nRoadManning's n of street surface
    agutter depression height (in or mm)
    Wgutter width (ft or m)
    Sides1 for single sided street or 2 for two-sided street
    Tbackstreet backing width (ft or m)
    Sbackstreet backing slope (%)
    nBackstreet backing Manning's n

    Usage Notes:

    • If a (gutter depression) is 0, the gutter width W is ignored.
    • If there is no backing, the three backing parameters (Tback, Sback, nBack) can be omitted.
    • To apply a street section to a conduit, add a line to the [XSECTIONS] section using the format: ConduitID STREET StreetSectionName.
    Name  Tcrown  Hcurb  Sx  nRoad  a  W  Sides  Tback  Sback  nBack
  8. Define Conical and Pyramidal Storage Units

    develop

    SWMM 5.2 introduces two new functional shapes for surface area vs. depth curves in the [STORAGE] section.

    1. Conical (truncated elliptical cone): Uses the equation: Area = PI * (L*W/4 + W*Z*Depth + (W/L)*(Z*Depth)^2)

    2. Pyramidal (truncated rectangular pyramid): Uses the equation: Area = L*W + (L+W)*Z*Depth + (2*Z*Depth)^2

    Input Format: node elev maxDepth initDepth SHAPE L W Z 0 fEvap (infil)

    ParameterDescription
    nodename of a storage node
    elevelevation of the node's invert
    maxDepthmaximum height of stored water
    initDepthinitial height of stored water
    Llength of the longer side of the base
    Wwidth of the shorter side of the base
    Zside slope (run/rise)
    fEvapfraction of potential evaporation realized
    infiloptional infiltration parameters

    Example:

    [STORAGE]
    node1  10.0  5.0  0.0  CONICAL    10  5  0.5  0  0.1
    node2  12.0  3.0  1.0  PYRAMIDAL  8  4  0.3  0  0.05
    [STORAGE]
    node  elev  maxDepth  initDepth  CONICAL    L  W  Z  0 fEvap (infil)
    node  elev  maxDepth  initDepth  PYRAMIDAL  L  W  Z  0 fEvap (infil)
  9. Configure the [INLETS] section

    develop

    The [INLETS] section defines the design of inlet structures. Different types of inlets use different formats.

    Formats:

    • GRATE: Name GRATE Length Width Type (Aopen Vsplash)
    • CURB: Name CURB Length Height Throat
    • SLOTTED: Name SLOTTED Length Width
    • CUSTOM: Name CUSTOM GradeCurve (SagCurve)

    Grate Types:

    • P_BAR-50, P_BAR-50x100, P_BAR-30, CURVED_VANE, TILT_BAR-45, TILT_BAR-30, RETICULINE, GENERIC.
    • For GENERIC grates, you must provide Aopen (fraction of area open) and Vsplash (splash over velocity).

    Other Parameters:

    • Throat: For CURB inlets (HORIZONTAL, INCLINED, or VERTICAL).
    • GradeCurve: For CUSTOM on-grade inlets (Diversion-type curve).
    • SagCurve: For CUSTOM on-sag inlets (Rating-type curve).

    Examples:

    ; A 2-ft x 2-ft parallel bar grate
      InletType1  GRATE  2  2  P-BAR-30
    
    ; A combination inlet (use same ID for both lines)
      InletType2  GRATE  2  2  CURVED_VANE
      InletType2  CURB   4  0.5  HORIZONTAL
    
    ; A custom inlet using Curve1 as its capture curve
      InletType3  CUSTOM  Curve1
    ; A 2-ft x 2-ft parallel bar grate
      InletType1  GRATE  2  2  P-BAR-30
    
    ; A combination inlet
      InletType2  GRATE  2  2  CURVED_VANE
      InletType2  CURB   4  0.5  HORIZONTAL
    
    ; A custom inlet using Curve1 as its capture curve
      InletType3  CUSTOM  Curve1