-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect Geometry for Custom Elliptical Pipes #144
Comments
The mentioned code from the 2004 version of SWMM4 (OSU version) C======================================================================= |
Always hard to read the SWMM4 code but here ae the vertical ellipse only arfull and rfull CIM VERTICAL ELLIPSE |
I'm now having second thoughts about applying the aforementioned area and hydraulic radius formulas for custom elliptical pipes to any pair of of width (span) and height (rise) values. The formulas were derived from the following table for standard sizes of elliptical pipes (with rise and span in inches, area A in sq. ft, and hydraulic radius Rh in ft.):
Note that the ratios of span to rise are mostly the same, averaging 1.56. Thus the area and hydraulic radius formulas fitted to the product of span and rise from this table only apply to ratios of around 1.56 and not to any arbitrary pair of values. What this implies is that the dimensions that SWMM should accept for a custom elliptical pipe must comply with the 1.56 ratio. The user should only be required to supply a single value for the rise (full depth) with the span being set to 1.56 that value for horizontal elliptical pipes and 1/1.56 for vertical elliptical pipes. |
The formula has been updated. However, longer term, we will update the GUI to either accept only rise or span and do the multiplication with 1.56 in the code. |
The ratio is not always 1.56. I think it is best to leave it up to users to ensure they are using the correct rise and spans. |
@LRossman I presume you reopened this because I reopened the corresponding issue on the GUI side, correct? I will post the message I posted there here as well. I set up a quick experiment using a 100ft pipe with 10ft sub-sections and slopes of 1% and 5% to see the impact of using the constant S/R ratio of 1.56 versus the correct ratio on depth and velocities given the same flows. The results showed some differences. There were larger deviations for the smaller pipes than for the larger pipes as one would expect. Also, the deviations tended to be larger when depths approached the crowns of the pipes, which is also to be expected. Finally, the vertical ellipses showed larger deviations in depth than the horizontal ellipses as changes in flow lead to relatively larger changes in depth. In light of these differences, it makes sense to me to keep the status-quo. Users have the option of selecting one of the standard sizes or they could prescribe their own rise and span values which will lead to more accurate and precise calculations. |
That makes a lot of sense to me now. So, do you have any reservations about me modifying the code (including the GUI) to enforce this ratio? On the GUI end, I could modify it to only accept the rise value and apply the ratio internally to estimate the span. |
There's the issue of backward compatibility to consider. People, especially contractors, get bent out of shape when a new release produces a different set of results than an earlier release did on their project files. So I can see several options to consider:
I'm thinking that maybe option 3 might be best since it can use the correct S/R ratio but also satisfy backward compatibility with a warning that results might be inaccurate. You might want to discuss this issue on the SWMM Users Knowledge Base and ask for suggestions on how to resolve it. Maybe they will feel OK with option 1 and not care about backward compatibility. Also note that depending on which option is selected, the Help file would need to be updated in the short run as well as the User Manual and Hydraulics Manual in the long run. |
Number 3 makes a lot of sense to me as well. As you know, updating the user manual requires an internal review that may prolong the the next release we are planning, but I think it is well worth the effort as this bug is an important one to address in the next release. I appreciate your inputs on this. |
I would vote for option 4 if the user has an option to make a custom shape where the S/R can be different than 1.56. User would then use a custom shape instead of the custom option in the elliptical shape dialog. |
I think I found a better way to handle the custom elliptical cross section. That is to treat it as a true ellipse rather than use the area and hydraulic radius formulas derived from the table of standard elliptical pipes. As noted above, those formulas are only valid for S/R = 1.56 and don't represent a true ellipse (the full area formula derived from the table is If the custom elliptical shape is treated as a true ellipse then the full area (A) and hydraulic radius (Rh) formulas would be:
After replacing the current formulas used in v5.2.4 with these I was able to eliminate the inconsistencies found by Bruno Bermedo as described in his Open SWMM Knowledge Base posting.. You can find the details in the attached zip file. So I'm now thinking that the preferred option for handling a custom elliptical shape is:
This will not necessarily preserve backward compatibility, but since doing so would perpetuate incorrect results I think it is a reasonable course of action to take. P.S. Since the table for standard elliptical pipes applies to shapes with S/R of 1.56 and the areas in the table don't quite conform to a true ellipse the question arises as to what shape was used to derive the geometry tables for A/Afull, Rh/Rhfull, and W/Wmax for equally spaced Y/Yfull values. By looking at the W/Wmax table (where Wmax is S) I've confirmed that it is based on a true ellipse and not whatever shape is implied by the standard pipe table. I did this by using the following formula for the chord length W of a horizontal ellipse:
where x is the distance between the major axis and the chord. Adapting this formula to match the contents of a W/Wmax table we get:
When evaluated at 25 equally spaced Y/Yfull values it produces the same numbers seen in the W_HorizEllipse array appearing in the SWMM's xsect.dat file. We can thus assume that the area and hydraulic radius tables were also derived from a true ellipse shape. |
I hear you @LRossman. Definitely something to consider. However, if we are going to use actual formulas, my thinking is that this will be a good time to use formulas for all the cross-sectional shapes we have formulas for instead of the lookup tables. I can envision some performance gains from direct formulas instead of the lookups. |
Perhaps we can do this in two steps. The first step is to just implement the warning in the next patch and implement the more comprehensive direct formula approaches in a future minor release. |
@cbuahin please note that the formulas we are discussing here only apply to determining the area and hydraulic radius of a pipe flowing full. SWMM already uses analytic formulas for these quantities. For partly full pipes SWMM uses lookup tables only for circular, elliptical and arch pipes as well as the masonry shapes. Analytical formulas don't exist for the masonry shapes. The formulas for circular pipes involve trigonometric functions which are more expensive to compute than using a lookup table. For elliptical and arch shapes there are no simple formulas for partly full area and wetted perimeter. Also please see the updated version of my previous posting where I confirm that the geometry tables in xsect.dat for elliptical pipes are based on a true ellipse rather than whatever kind of modified elliptical shape is implied by the table in the Concrete Pipe Design Manual. As for just issuing a warning for custom elliptical shapes that don't conform to the standard S/R ratio, it would basically have to admit that the results one obtains are incorrect -- that's not a great look. I would rather see the bug corrected. |
@LRossman, I hear what you are saying. Let me confirm that the analytical formula does not render the A/Afull, Rh/Rhfull, and W/Wmax for equally spaced Y/Yfull values in the lookup tables incorrect on my end (not to dispute your findings but for my own sanity ☺ ) and then I will work on addressing the bug shortly. |
For the masonry shapes, I know there are no analytical formulas but I have been experimenting with replacing the tables with with polynomial functions with some degree of success and performance improvements. Would you have any reservations about those? |
If you can show performance improvements with the polynomial functions then I say go for it. Regarding the elliptical lookup tables, I only checked the W/Wmax table using the analytical formula for chord width for a true ellipse and got perfect agreement with it. I don't think there are similarly simple formulas for partly filled area and hydraulic radius. In particular, I think the wetted perimeter (needed for hyd. radius) requires numerical integration (I have no idea how the SWMM hyd. radius table was constructed). If you look at the area table you will see that the increments are the same both below and above the Y/Yfull = 0.5 level which leads me to believe it applies to a true ellipse. |
(I have no idea how the SWMM hyd. radius table was constructed) - ,it was done in the 1990's by CDM or CDM Smith. I cannot find shapes.doc but it was added on 1/96 CIM THESE NEXT ARRAYS CONTAIN DATA FOR STANDARD ELLIPTICAL AND |
The SWMM4 code gives me a headache. Thanks so much for bringing it to C and writing beautiful code. Lew. |
Mitch gave me the shapes file - maybe it will help you |
Thinking on this has evolved over time ... to facilitate closing this issue and for ease of subsequent review, I suggest we consolidate all changes related to this issue into a dedicated PR. PR coming forthwith ... |
…nks" This reverts commit 467e52a.
As noted recently on the Open SWMM Knowledge Base, SWMM produces inconsistent results for custom sized elliptical pipes. The problem stems from it using incorrect equations for the pipe's full flow area and hydraulic radius that came from SWMM 4.4. A corrected set of equations, derived from Table 4 of the Concrete Pipe Design Manual (American Concrete Pipe Association, 2011) are:
with all values in feet.
These equations should replace those used in lines 572-573 and 600-601 in file xsect.c, i.e.,
The text was updated successfully, but these errors were encountered: