The stats.c module in the SWMM 5 source code is responsible for managing and updating the statistical data collected during a simulation. It tracks various metrics related to the flow, volume, and quality of water as it moves through the drainage system. The module collects and reports data for nodes, links, subcatchments, and other system components.
Key Concepts and Functions in stats.c:
1. Global Variables:
SubcatchStats
,NodeStats
,LinkStats
,StorageStats
,OutfallStats
,PumpStats
: These variables store statistics for subcatchments, nodes, links, storage units, outfalls, and pumps, respectively.MaxStats
Arrays: These arrays (e.g.,MaxMassBalErrs
,MaxCourantCrit
) store the maximum values for various system statistics, such as mass balance errors and Courant stability criteria, during the simulation.SysOutfallFlow
: This variable tracks the total outfall flow for the simulation.
2. Key Functions:
stats_open
: Initializes the statistical system by allocating memory for various statistics structures and setting initial values.stats_close
: Closes the statistics system and frees allocated memory.stats_report
: Reports the collected simulation statistics, including flow routing accuracy, node/link flow statistics, and time step statistics.stats_updateSubcatchStats
: Updates the statistics for a specific subcatchment, including rainfall, runoff, infiltration, and pollutant load.stats_updateNodeStats
: Updates the statistics for a specific node, including water depth, flooding, surcharging, and lateral flow.stats_updateLinkStats
: Updates the statistics for a specific link, including flow, velocity, and surcharge time.stats_findMaxStats
: Finds and updates the maximum values for mass balance errors, Courant stability, and other critical metrics.stats_updateMaxStats
: Updates the maximum value statistics for a specific node or link.stats_updateTimeStepStats
: Updates the time step statistics, including the average, minimum, and maximum time steps.stats_updateCriticalTimeCount
: Updates the count of times a node or link was critical in terms of the time step.stats_updateConvergenceStats
: Updates the statistics related to convergence (non-convergence count) for nodes.
3. Statistical Reporting:
- Flow Statistics: The module tracks various flow statistics, such as inflow, outflow, flooding, surcharging, and overflow, for nodes and links.
- Quality Statistics: For water quality constituents, the module tracks pollutant buildup, washoff, and mass balance for nodes and links.
- Time Step Statistics: Time step statistics, including the minimum, maximum, and average time steps, are reported for the simulation.
- Routing Accuracy: The module tracks routing accuracy, including the flow routing error (mass balance error) and Courant stability criteria.
- Convergence and Non-Convergence: The module tracks the number of non-converging nodes and links during the simulation, which is essential for diagnosing numerical stability issues.
4. Key Statistical Metrics:
- Mass Balance Errors: Tracks the discrepancy between inflow and outflow at nodes and links to ensure conservation of mass.
- Courant Stability: Measures the stability of the simulation based on the Courant criterion, which is important for numerical simulations using dynamic wave routing.
- Flow Turns: Tracks the number of times the flow direction changes at a node or link during the simulation.
- Max Flow and Depth: Tracks the maximum flow and depth at nodes and links, which are critical for system design and analysis.
Summary:
The stats.c module is essential for collecting, updating, and reporting various statistics during a SWMM 5 simulation. It tracks both hydrologic and hydraulic metrics, such as flow rates, water depths, pollutant loads, and convergence criteria. This module provides valuable insights into the system's performance and stability during the simulation and is crucial for understanding the behavior of the drainage system, especially in complex simulations involving multiple time steps and events.
No comments:
Post a Comment