Wednesday, December 25, 2024

Stopping Tolerance in InfoSWMM, ICM SWMM and SWMM5 Internal Units

 Stopping Tolerance in InfoSWMM, ICM SWMM and SWMM5 Internal Units

InfoSWMM, ICM SWMM, and SWMM 5 all operate on the same core dynamic wave engine for hydraulic simulations. However, there's one nuanced difference:

  • Node Stopping Tolerance Adjustment:
    • SWMM 5: Uses a fixed default stopping tolerance of 0.0005 feet for all simulations.
    • InfoSWMM and ICM SWMM: Allow users to customize this tolerance, providing more control over simulation accuracy and performance.


Unit Conversion and Impact:


  • Units in SWMM 5 and InfoSWMM:
    • Both use feet internally for calculations but can display results in meters if SI units are selected. This consistency means that the stopping tolerance is always considered in feet for computation but can be interpreted in other units for user convenience.


Understanding Stopping Tolerance:


  • The following table shows how the stopping tolerance translates between different units:

    Tolerance (feet)
    Tolerance (inches)
    Tolerance (millimeters)
    0.0005
    0.006
    0.1524
    0.001
    0.012
    0.3048
    0.002
    0.024
    0.6096
    0.003
    0.036
    0.9144
  • Impact on Simulation:
    • Smaller Tolerance: Leads to more iterations, potentially increasing simulation accuracy but also computational time.
    • Larger Tolerance: Might reduce accuracy but speeds up the simulation.


Best Practices for Tolerance Setting:


  • General Rule:
    • A smaller tolerance isn't always better; it depends on the context of the simulation.
    • For simulations involving pumps, where precision in flow control is critical, a strategy might involve:
      • Using a small time step to capture rapid changes.
      • Employing a medium level tolerance like 1 millimeter (0.00328 feet) as a starting point.
  • Adjusting for Continuity Errors:
    • If continuity errors occur at pump nodes, slightly increasing the tolerance to 2 or 3 millimeters might resolve issues without overly compromising simulation fidelity.


Stopping ToleranceInchesMillimeters
0.10000001.200000030.4800000
0.05000000.600000015.2400000
0.01000000.12000003.0480000
0.00500000.06000001.5240000
0.00010000.00120000.0304800
0.00050000.00600000.1524000
0.00001000.00012000.0030480
0.00005000.00060000.0152400
0.00000100.00001200.0003048
0.00000500.00006000.0015240
0.00000010.00000120.0000305

Understanding Reverse Flow in Outlets in SWMM 5

Understanding Reverse Flow in Outlets in SWMM 5


In SWMM 5, outlets are designed to manage the flow of water out of the system but can also allow for unique flow dynamics under certain conditions:
  • Reverse Flow Capability:
    • Outlets can experience reverse flow (1) if there's a situation where the downstream head exceeds the upstream head (2). This means if the water level or pressure downstream is higher than upstream, water can flow back through the outlet in the opposite direction.
  • Flap Gate Functionality:
    • To control or prevent this reverse flow, SWMM 5 includes the option for a flap gate (3). When a flap gate is installed on an outlet, it will prevent flow reversal (4) by only allowing water to flow in one direction - out of the system.

  • Flow Dynamics:
    • Without a flap gate, an outlet can handle both positive (outflow) and negative (inflow) flow. This bidirectional capability is useful for scenarios where water levels might fluctuate,

How to Add a Volume Variable to SWMM 5

How to Add a Volume Variable to SWMM 5

This guide explains how to add a volume variable to the DOS version of SWMM 5, enabling it to save volume data in the text output file (after recompiling the modified C code). These modifications only affect the SWMM 5 engine; they do not impact the SWMM 5 GUI or DLL.

Adding a new report variable involves a straightforward five-step process:


Step 1: Add the LINK_VOLUME Variable in enums.h

  1. Navigate to the enums.h file.
  2. Add a new variable, LINK_VOLUME, to the LinkResultType enum. Ensure this variable is added before the water quality variables.
#define MAX_LINK_RESULTS 7  // Increment this value by 1
enum LinkResultType {
    LINK_FLOW,          // Flow rate
    LINK_DEPTH,         // Flow depth
    LINK_VELOCITY,      // Flow velocity
    LINK_FROUDE,        // Froude number
    LINK_CAPACITY,      // Depth to full-depth ratio
    LINK_VOLUME,        // Current volume of the conduit (e.g., added August 2007)
    LINK_QUAL           // Concentration of each pollutant
};

Step 2: Update output_open in output.c

  1. Add the report index for LINK_VOLUME to the output_open procedure in output.c.
  2. Write the index for LINK_VOLUME to the binary output file.
k = LINK_VOLUME; 
fwrite(&k, sizeof(int), 1, Fout.file);
for (j = 0; j < nPolluts; j++) {
    // Existing pollutant index writing logic remains here
}

Step 3: Save LINK_VOLUME to the Binary Output File

  1. Open the link.c file.
  2. Locate the procedure link_get_results. Save the newVolume value from the Link structure into the binary output array.
x[LINK_CAPACITY] = (float)c;
x[LINK_VOLUME]   = (float)Link[j].newVolume;  // Save the current volume of the link

Step 4: Update report_links in report.c

  1. Modify the report_links procedure to include LINK_VOLUME in the report output.
  2. Append the new variable to the formatted output string.
fprintf(Frpt.file, "\n  %11s %8s  %9.3f %9.3f %9.3f %9.1f %9.1f",
    theDate, theTime, 
    LinkResults[LINK_FLOW], 
    LinkResults[LINK_VELOCITY], 
    LinkResults[LINK_DEPTH], 
    LinkResults[LINK_CAPACITY] * 100.0,
    LinkResults[LINK_VOLUME]  // Include volume in the output
);

Step 5: Update the Link Header in report_LinkHeader

  1. Modify the report_LinkHeader procedure in report.c to reflect the new volume variable.
  2. Add a column header for Volume to the output.
fprintf(Frpt.file,
"\n                             Flow  Velocity     Depth   Percent      Volume");

Final Steps:

  1. Recompile the SWMM 5 engine to apply these changes.
  2. Run a simulation and verify that the LINK_VOLUME data is correctly output to the text file.

Summary

By following these steps, you can seamlessly add a new volume variable to SWMM 5. This allows the model to store and report conduit volumes in the binary and text outputs, enhancing its analytical capabilities without affecting the GUI or DLL functionality. Let me know if further clarification is needed!

InfoSWMM: A 2030 AI-Assisted Study Guide

  InfoSWMM: A 2030 AI-Assisted Study Guide delete   InfoSWMM: A 2030 AI-Assisted Study Guide A comprehensive study guide for someone in 2030...