Skip to content

Sebasmadridmx/SMO-Flow

Repository files navigation

SMO Flow

Gem Version

SMO Flow is a Ruby library created by Sebastian Madrid Ontiveros to help support hydraulic modelling in the UK and around the world.

It was developed in response to the lack of hydraulic modelling libraries available for Ruby, with the aim of making subcatchment runoff and flow calculations simpler, clearer, and more accessible.

If you find this project useful and would like to support its development, please consider donating:

Buy Me a Coffee

Overview

The library 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.

Installation

Add this line to your application's Gemfile:

````gem 'smo_flow'```

Or install it directly:

gem install smo_flow

Usage

Rational Method — Flow from Rainfall Intensity

require "smo_flow"

calc = SmoFlow::RationalMethod.new(coefficient: 0.9, area: 2.5)

# Flow in m³/s
calc.flow_from_intensity(50.0)   # => 0.3125

# Flow in L/s
calc.flow_ls_from_intensity(50.0)  # => 312.5

Flow from Rainfall Depth and Timestep

calc = SmoFlow::RationalMethod.new(coefficient: 0.9, area: 2.5)

# Flow in m³/s from 5mm of rain over 1 hour
calc.flow_from_depth(depth: 5.0, timestep: 3600.0)  # => 0.03125

Multiple Subcatchments

road  = SmoFlow::RationalMethod.new(coefficient: 0.9, area: 1.5)
roof  = SmoFlow::RationalMethod.new(coefficient: 0.95, area: 0.8)
grass = SmoFlow::RationalMethod.new(coefficient: 0.3, area: 2.0)

intensity = 50.0  # mm/hr

total = road.flow_from_intensity(intensity) +
        roof.flow_from_intensity(intensity) +
        grass.flow_from_intensity(intensity)

Convert Depth to Intensity

calc.depth_to_intensity(depth: 5.0, timestep: 3600.0)  # => 5.0 mm/hr

Runoff Volume

calc.volume(depth: 5.0)  # => 112.5 m³

Formulas

Flow from Intensity

Q = C × i × A / 360

About

A lightweight Ruby library for calculating subcatchment output flow from rainfall runoff, surface areas, foul flow, and trade flow components.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors