Subcatchment runoff and flow calculations for Ruby
Developed by Sebastian Madrid Ontiveros
SMOFlow was created by Sebastian Madrid Ontiveros in response to the lack of hydraulic modelling libraries available for Ruby. It provides a developer-friendly way to estimate flow from roads, roofs, permeable areas, foul flow, and trade flow using the Rational Method and timestep-based calculations — helping with transparent calculations, quality checks, and understanding how each component contributes to total subcatchment output flow.
Developer & Author: Sebastian Madrid Ontiveros
Works with storm profiles and rainfall depths across any timestep from 1 second to 86,400 seconds.
The Rational Method was first published by Mulvaney (1850) and later by Lloyd-Davies (1906) for UK practice. SMOFlow implements it with standard SI unit conversions.
All methods are available on a SmoFlow::RationalMethod instance. Create one with a coefficient and area, then call any method.
require "smo_flow" calc = SmoFlow::RationalMethod.new( coefficient: 0.9, area: 2.5 # hectares )
calc.flow_from_intensity(50.0) # => 0.3125 m³/s # Q = 0.9 × 50 × 2.5 / 360
calc.flow_ls_from_intensity(50.0) # => 312.5 L/s # equivalent to 0.3125 × 1000
calc.flow_from_depth( depth: 5.0, timestep: 3600.0 ) # => 0.03125 m³/s # Q = 10 × 0.9 × 2.5 × 5.0 / 3600
calc.depth_to_intensity( depth: 5.0, timestep: 3600.0 ) # => 5.0 mm/hr # 5mm over 1 hour = 5mm/hr
calc.volume(depth: 5.0) # => 112.5 m³ # V = 10 × 0.9 × 2.5 × 5.0
These are ideas for future development — not a fixed plan. Contributions and suggestions are always welcome on GitHub.
SMOFlow is free and open source. If you find it useful and would like to support its continued development, please consider buying me a coffee.
Buy Me a Coffee