5.1.007 bug: surcharged weirs compute flow incorrectly |
SWMM 5.1.007 computes flow incorrectly for surcharged weirs (e.g. a sewer system CSO regulator) when Can Surcharge = YES is selected (this is the default). Discharge is incorrectly calculated as zero when a weir is surcharged. The problem can be fixed by restoring a few lines of code from version 5.0.022 to the weir_validate function. The desired behavior is described in Engine Update 5 for version 5.1.007:
“A new Weir parameter was added that specifies if the weir can surcharge using an orifice equation or not. Surcharging was the only option in SWMM 5.0 but was switched to no surcharging in earlier 5.1 releases. This new parameter accommodates both closed top weirs that can surcharge and open channel weirs that cannot.”
My understanding of how the code should look is shown below, along with an example model. I expect this will be fixed in the next EPA release. This also affects PCSWMM, as that program uses the EPA .dll.
Suggested resolution:
void weir_validate(int j, int k) // // Input: j = link index // k = weir index // Output: none // Purpose: validates a weir's properties // { int err = 0; double q, q1, q2, head; …snip… // --- compute an equivalent length Weir[k].length = 2.0 * RouteStep * sqrt(GRAVITY * Link[j].xsect.yFull); Weir[k].length = MAX(200.0, Weir[k].length); Weir[k].surfArea = 0.0; // --- find flow through weir when water level equals weir height head = Link[j].xsect.yFull; weir_getFlow(j, k, head, 1.0, FALSE, &q1, &q2); q = q1 + q2; // --- compute equivalent orifice coeff. (for CFS flow units) head = head / 2.0; // head seen by equivalent orifice Weir[k].cSurcharge = q / sqrt(head); }
Example illustrating the problem:
[TITLE] SWMM 5.1.007 issue When Surcharge = YES for weir, no flow occurs when weir is surcharged In this example, Q=10 cfs with Surcharge = NO, 0 cfs with Surcharge = YES. Version 5.0.022 yields 15 cfs [OPTIONS] FLOW_UNITS CFS FLOW_ROUTING DYNWAVE START_DATE 10/02/2012 START_TIME 00:00:00 END_DATE 10/03/2012 END_TIME 00:00:00 REPORT_STEP 00:15:00 ROUTING_STEP 0:00:30 [JUNCTIONS] ;;Junction Invert MaxDepth InitDepth SurDepth Aponded 1 10 0 0 0 0 2 1 0 0 0 0 [OUTFALLS] ;;Outfall Invert Type Stage Data Gated 3 0 NORMAL NO [CONDUITS] ;;Conduit From Node To Node Length Roughness InOffset OutOffset InitFlow MaxFlow 2 2 3 400 0.013 0 0 0 0 [WEIRS] ;;Weir From Node To Node Type CrestHt Qcoeff Gated EndCon EndCoeff Surcharge 1 1 2 TRANSVERSE 2 3.33 NO 0 0 YES [XSECTIONS] ;;Link Shape Geom1 Geom2 Geom3 Geom4 Barrels 2 CIRCULAR 3 0 0 0 1 1 RECT_OPEN 1 3 0 0 [INFLOWS] ;;Node Inflow Time Series Type Funits Fscale Baseline Pattern 1 FLOW "" FLOW 1.0 1.0 15 [COORDINATES] ;;Node X-Coord Y-Coord 1 1476.938 7497.547 2 2183.513 6133.464 3 2968.597 4661.433