Sunday, December 29, 2024

SWMM5 routing.c Summary

The routing.c module in the EPA SWMM5 code handles the core process of routing runoff and external inflows through the drainage system network of nodes and links. This module integrates various routing functions and control mechanisms for simulating the movement and transformation of water (and pollutants) through the system.

Key Functions in the routing.c Module:

  1. routing_open:

    • Initializes the routing system by opening necessary files, initializing the flow and quality routing systems, and sorting the drainage network links. It also sets up control rule evaluations and initializes the routing events.
  2. routing_getRoutingStep:

    • Calculates and returns the time step to be used for flow routing. This function considers whether events are active, routing models, and the control rule evaluation times.
  3. routing_execute:

    • The main function that executes the routing process during each time step. It manages flow routing, control actions, and updates mass balance totals for inflows and outflows. It also handles water quality routing if applicable.
  4. evaluateControlRules:

    • This function checks if any control rules (such as pump or regulator control) are triggered during the current time step. It evaluates the control rules based on the current time and adjusts settings for links if necessary.
  5. addSystemInflows:

    • Adds the various inflows (including external, dry weather, wet weather, groundwater, RDII, LID drainage, etc.) to the system, updating the lateral flows at nodes.
  6. removeSystemOutflows:

    • Removes outflows from the system, including those from storage nodes, conduits, and any other outgoing flows from the system.
  7. addWetWeatherInflows, addGroundwaterInflows, addRdiiInflows, etc.:

    • Functions responsible for adding specific types of inflows to the system, including wet weather runoff, groundwater contributions, RDII flows, and more. These functions update the inflows at the nodes based on the current time step.
  8. routeFlow:

    • This function performs the actual flow routing through the drainage system. It computes the flow through each link and updates the flow conditions for nodes accordingly.
  9. sortEvents:

    • Sorts the events in chronological order, ensuring that the simulation respects the sequence of user-defined events. This is crucial for simulations that involve dynamic events or control rules that depend on timing.

Core Concepts and Workflow:

  • Flow Routing: The process of computing the flow of water through the drainage system based on the hydraulic properties of links (pipes, conduits, etc.) and the water levels at the nodes (junctions, outfalls, etc.). This process uses either a kinematic wave (KW) model or a dynamic wave (DW) model.

  • Control Rules: SWMM includes the ability to model control structures (like pumps or regulators) which can change the flow in the system based on predefined rules. The evaluateControlRules function manages these controls during the simulation.

  • Water Quality Routing: The module also supports the transport of pollutants along with the flow, updating the quality at each node and link as the water moves through the system. This is handled by the qualrout_execute function.

  • Event Handling: The simulation may involve different events (e.g., control actions, or specific inflow changes) that are triggered at specific times. The event handling system, including the sortEvents function, ensures that these events are processed in the correct order.

Summary:

The routing.c module in SWMM5 is a central component for simulating the movement of water and pollutants through the drainage system. It performs complex hydraulic and hydrologic calculations, including routing flow, evaluating control actions, and updating water quality conditions across nodes and links in the system. The module integrates various data sources like inflows (wet, dry, groundwater), external data, and control rules to simulate realistic behavior of stormwater and wastewater systems.

No comments:

A comprehensive explanation of how minimum travel distance relates to link length in InfoSewer

In hydraulic modeling of sewer networks, the minimum travel distance is a fundamental parameter that affects how accurately the model can si...