Saturday, December 28, 2024

SWMM5 inputrpt.c Summary

 Below is a step-by-step outline summarizing how inputrpt.c writes out a summary of the SWMM input data. This file handles the input data reporting after SWMM has read and processed the input.


1. Purpose of inputrpt.c

The inputrpt.c module generates a summary report of the project’s input data in SWMM’s output report file. For example, it displays counts of different objects, plus tables for pollutants, land uses, raingages, subcatchments, nodes, links, cross sections, shapes, transects, etc. The routine is typically called after the model has read in all input data successfully.


2. Function Overview

inputrpt_writeInput()

  • This is the main function in inputrpt.c. It is typically called once after the input has been parsed successfully.
  • It orchestrates writing several summary tables to the SWMM report file Frpt.file:
    1. Element Count
      • Summarizes how many of each major object type exist (raingages, subcatchments, nodes, links, pollutants, land uses).
    2. Pollutant Summary (if any pollutants exist)
    3. Landuse Summary (if any land uses exist)
    4. Raingage Summary (if any raingages exist)
    5. Subcatchment Summary (if any subcatchments exist)
      • Also checks if any LIDs (Low Impact Developments) exist and calls lid_writeSummary().
    6. Node Summary (if any nodes exist)
    7. Link Summary (if any links exist)
    8. Cross Section Summary (for conduits/links)
    9. Shape Summary (if any custom shapes exist)
    10. Transect Summary (if any irregular channel cross sections exist)
    11. Street Summary (if any street-type cross sections exist)

Within each section:

  • The code prints column headers using report_writeLine() or fprintf(Frpt.file, ...).
  • Iterates over each object in the relevant data array(s) (Pollut, Landuse, Subcatch, Node, Link, Transect, Street, etc.).
  • Prints lines listing properties of these objects. For example, for subcatchments: area, width, % impervious, slope, associated raingage, and outlet node.

3. Notable Shared Objects and Variables

  • Frpt.file: The file pointer to the text-based SWMM report file.
  • Title[]: Project title lines (not actually reported here, but part of the general reporting).
  • Pollut[]: Array of pollutant objects (ID, units, concentrations, etc.).
  • Landuse[]: Array of land uses, which includes sweeping intervals and removal info.
  • Gage[]: Array of rain gages.
  • Subcatch[]: Array of subcatchments (area, imperv fraction, etc.).
  • Node[]: Array of nodes (invert, max depth, ponded area).
  • Link[]: Array of links (type, length, slope, roughness).
  • Conduit[]: Sub-array used by certain link types to store specific hydraulic info (e.g., slope, length, barrels).
  • xsect or Link[i].xsect**: Cross-section geometry details.
  • Transect[]: Irregular channel cross sections.
  • Street[]: Street cross sections used for “Street Summary” (introduced in SWMM 5.2).
  • Shape[]: Array of custom cross-section shapes.
  • lid_writeSummary(): Sub-function that writes a summary of any LID usage found in subcatchments.

4. Major Reporting Sections

4.1 Element Count

  • Prints total counts for raingages, subcatchments, nodes, links, pollutants, land uses.

4.2 Pollutant Summary

  • Prints a table with columns for:
    1. Pollutant Name
    2. Units (e.g., mg/L, ug/L, etc.)
    3. Rainfall concentration
    4. Groundwater concentration
    5. Decay coefficient
    6. Co-Pollutant (if any) and fraction

4.3 Landuse Summary

  • Prints columns for:
    1. Landuse Name
    2. Sweeping Interval
    3. Maximum Removal
    4. Days since last swept

4.4 Raingage Summary

  • Prints columns for:
    1. Gage Name
    2. Data Source (time series or file)
    3. Data Type
    4. Recording Interval

4.5 Subcatchment Summary

  • Prints columns for:
    1. Subcatchment Name
    2. Area
    3. Width
    4. % Impervious
    5. % Slope
    6. Assigned rain gage
    7. Outlet
  • Also checks if any subcatchment has an LID area, then calls lid_writeSummary().

4.6 Node Summary

  • Prints columns for:
    1. Node Name
    2. Node Type (junction, outfall, storage, divider)
    3. Invert Elevation
    4. Max Depth
    5. Ponded Area
    6. If there is external inflow

4.7 Link Summary

  • Prints columns for:
    1. Link Name
    2. From Node
    3. To Node
    4. Link Type (conduit, pump, weir, orifice, outlet)
    5. Length, % Slope, Roughness (for conduit types)

4.8 Cross Section Summary

  • For each conduit link:
    1. Conduit Name
    2. Cross-section type (irregular, custom, street, or standard shape)
    3. Full depth
    4. Full area
    5. Hydraulic radius
    6. Max width
    7. of barrels

    8. Full flow

4.9 Shape Summary

  • For each custom shape in Shape[]:
    • Prints the ID of the underlying shape curve
    • Prints the shape’s stored arrays of area, hydraulic radius, and top width, at fractional depths (the shape curves are tabulated in increments of depth).

4.10 Transect Summary

  • For each irregular channel transect in Transect[]:
    • Prints ID
    • Prints tabular arrays for area, hydraulic radius, and top width across fractional depth increments.

4.11 Street Summary

  • Similar to Transect Summary, for each Street in Street[]:
    • Prints ID
    • Prints arrays of area, hydraulic radius, and width for the street cross-section geometry.

5. Helper Functions and Printing Details

  • report_writeLine(text): Writes a line of text to the report file.

  • fprintf(Frpt.file, ..., ): Prints formatted data.

  • The code often uses:

    fprintf(Frpt.file,"\n  %-20s %10.2f%10.2f ...", SomeString, Value1, Value2);
    

    to format the columns neatly.

  • Many checks like if (Nobjects[POLLUT] > 0) are used to conditionally write a section only if that object type is present.


6. LID Summary

If lidCount (the total number of subcatchments that have LIDs) is nonzero, a separate function lid_writeSummary() is called. This typically writes details like LID control names, subcatchment area covered, number of units, etc.


7. Streets and Inlets

  • The code for street cross-section printing occurs near the bottom of the function, within:

    if (Nobjects[STREET] > 0) {...}
    

    It iterates over each Street object, printing out arrays of cross-sectional area, hydraulic radius, and width at incremental depths.

  • For inlets (another SWMM5.2 feature), any relevant summary would be handled by the main inlet.c file or the final routing summary, rather than inputrpt.c. Hence, inputrpt.c typically doesn't print a separate "Inlet Summary" table unless specifically coded.


8. Conclusion

The inputrpt_writeInput() function is a comprehensive reporter that prints out a textual summary of almost all data read by SWMM. Once the user runs a SWMM project, the output file will contain these sections if Report Input Summary options are enabled in the SWMM project’s REPORT section or in the UI.

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...