PyOpenChannel¶
Open channel flow analysis and design in Python: normal and critical depth, water surface profiles, weirs, gates and hydraulic jumps, in SI or US customary units.
import pyopenchannel as poc
channel = poc.TrapezoidalChannel(bottom_width=3.0, side_slope=1.5)
normal_depth = poc.NormalDepth.calculate(channel, discharge=12.0, slope=0.0008, manning_n=0.025)
critical_depth = poc.CriticalDepth.calculate(channel, discharge=12.0)
print(f"Normal depth: {normal_depth:.3f} m") # 1.783 m
print(f"Critical depth: {critical_depth:.3f} m") # 0.990 m
What it covers¶
Channels and uniform flowRectangular, trapezoidal, triangular, circular and parabolic sections. Manning's equation, normal and critical depth, specific energy, channel design.
Water surface profilesGradually varied flow: M, S, C, H and A profiles, dam backwater, bridges by the energy method, chutes and transitions.
Weirs, gates and jumpsSharp-crested, broad-crested and ogee weirs, sluice and radial gates in free or submerged flow, and hydraulic jumps.
Plots and profiles with a jumpProfiles, cross-sections, specific energy and rating curves as SVG, with no plotting library. Full reaches with the hydraulic jump in place.
ExamplesAbout forty ready-to-run scripts, from first calculations to spillway profiles.
Checked against the textbook¶
Results are tested against independent calculations, not just run:
- Water surface profiles against an independent Runge-Kutta integration (within 0.3 mm).
- Bridge backwater against the energy balance, with choking at critical depth.
- Weirs against the Rehbock, V-notch, USBR ogee and Villemonte equations.
- Sluice gates against the energy and momentum equations (Henderson) and Henry's discharge coefficients.
- Hydraulic jumps against the Belanger equation.
PyOpenChannel is open source under the MIT License. Source, issues and releases are on GitHub; the package is on PyPI.