Skip to main content

HydroAj

HydroAj

High-Performance Water Resources Engineering Computational Framework
Designed and Authored by Ajay Bhattarai (Civil Engineer, B.E. Civil Engineering)

PyPI version Python: 3.10+ Rust: 2021 Edition License: MIT Build Status Documentation

HydroAj is a state-of-the-art computational framework built specifically for civil engineers, hydrologists, and environmental researchers. It solves the performance and scale bottleneck of traditional hydrology/hydraulics software by fusing a memory-safe, SIMD-accelerated Rust core (_hydroaj_core) with an ergonomic, fully-vectorized Python API.


Author & Developer Credentials


Community Contributions & Errata Policy

Important Notice on Corrections & Feedback:
For minor corrections, typographical adjustments, or minor documentation enhancements, users and developers are warmly encouraged to make corrections independently via GitHub pull requests.

For any major corrections, foundational algorithmic inquiries, theoretical discrepancies, or collaborative engineering reviews, please contact the author directly at:
ajaybhattarai986@gmail.com or ajaybhattarai360@gmail.com.

Your feedback is critical to maintaining a rigorous, error-free computational standard for the global civil engineering community.


Key Technical Highlights

  1. Native Rust SIMD Speed: Heavy mathematical calculations execute within a multithreaded, SIMD-parallelized Rust kernel compiled with fat Link-Time Optimization (lto = "fat"), yielding up to 97x speedup over interpreted loops.
  2. Zero-Copy Memory Protocol: Seamlessly processes Python scalars, lists, NumPy ndarray, and Polars/Pandas Series without copying memory buffers.
  3. Strict SI Metric Unit Guarantee: Every routine adheres to standardized SI metric units (meters, seconds, m^3/s, hours for storm duration, mm/hr for rainfall intensity, Pascals for pressure).
  4. Instant IDE Parameter Assistance: Function signatures immediately display expected SI units in your IDE's popup tooltip (VS Code / PyCharm / Jupyter) as you type.
  5. Complete Engineering Coverage: 415 specialized functions across open-channel hydraulics, pressurized pipes, surface hydrology, hydraulic structures, groundwater mechanics, and sediment dynamics.
  6. 100% Mathematically Verified: Validated against 108 unit tests and a 112-problem comprehensive textbook engineering workbook with zero numerical discrepancies.

Installation Guide

Standard Installation via PyPI

pip install hydroaj

Installation in Google Colab (Linux)

Google Colab executes in an Ubuntu Linux container. When installing on Linux before pre-compiled Linux wheels are published, install cargo and compile with:

!apt-get install -y cargo
!pip install maturin
!pip install git+https://github.com/ajaybhattarai-123/hydroaj.git

import hydroaj as hy
print("HydroAj successfully running in Google Colab! Version:", hy.__version__)

Computational Domains & Core Modules

HydroAj covers all major pillars of civil & water resources engineering across 415 verified functions:

Domain Module Description & Formulations
Open Channel Hydraulics hydroaj.hydraulics Manning's equation (all inversions: Q, V, n, Rh, S0, A), Chezy, Strickler, Froude number, Hydraulic jump (sequent depths y2, energy loss), Critical depth & energy, Gradually Varied Flow (GVF) profiles.
Pressurized Pipe Flow hydroaj.hydraulics Darcy-Weisbach head loss, Colebrook-White friction factor, Swamee-Jain, Hazen-Williams, Churchill, minor losses (K), Joukowsky water hammer pressure wave surge.
Surface Water Hydrology hydroaj.hydrology Rational Method (Q = 0.2778 C I A), SCS Runoff Curve Number (S, Qd), Kirpich / California Culverts / FAA / Kerby Time of Concentration (Tc), SCS Time to Peak (Tp), Unit Hydrographs, Horton & Green-Ampt Infiltration, Muskingum Flood Routing.
Hydraulic Structures hydroaj.structures Sharp-crested rectangular weirs (Francis formula with end contractions), V-notch triangular weirs (90, 60, 45, 30 degrees), Broad-crested weirs, Sluice gates (free & submerged discharge), Parshall flumes, Stilling basin sizing (USBR Type II/III/IV).
Groundwater Hydraulics hydroaj.groundwater 1D & 2D Darcy flow, Darcy flux, Seepage velocity, Dupuit-Forchheimer unconfined flow, Theis non-equilibrium well drawdown (W(u)), Cooper-Jacob logarithmic approximation, Thiem steady-state equilibrium.
Sediment Transport hydroaj.sediment Boundary bed shear stress, Shear velocity, Dimensionless Shields parameter, Incipient motion critical shear, Rouse suspended concentration profile, Meyer-Peter Muller bedload transport rate.

Quickstart Examples

import hydroaj as hy
import hydroaj.hydraulics as hyd
import hydroaj.hydrology as hydro
import hydroaj.groundwater as gw
import hydroaj.structures as st
import hydroaj.sediment as sed

# 1. Surface Hydrology: SCS Time to Peak & Rational Method
# Parameter hints in IDE show: Units (Default SI): rainfall_duration [hours], lag_time [hours] -> returns [hours]
t_p = hydro.scs_time_to_peak(rainfall_duration=1.0, lag_time=2.5)
print(f"Time to Peak: {t_p:.2f} hours")

# Rational Method Peak Discharge (C = 0.65, I = 45 mm/hr, Area = 250,000 m²)
q_peak = hydro.rational_peak_flow(runoff_coefficient=0.65, intensity=45.0, area=250000.0)
print(f"Rational Peak Runoff: {q_peak:.3f} m³/s")

# 2. Hydraulics: Manning Discharge & Parameter Inversion
Q = hyd.manning_discharge(area=12.5, hydraulic_radius=2.1, slope=0.0015, roughness=0.025)
print(f"Manning Discharge: {Q:.3f} m³/s")

S0_req = hyd.manning_s0(discharge=25.0, roughness=0.025, area=12.5, hydraulic_radius=2.1)
print(f"Required Bed Slope: {S0_req:.6f} m/m")

# 3. Groundwater: Theis Unsteady Well Drawdown
s = gw.theis_drawdown(pumping_rate=0.045, transmissivity=0.0022, storativity=0.0004, radius=50.0, time=86400.0)
print(f"Theis Well Drawdown s: {s:.3f} m")

# 4. Hydraulic Structures: Francis Rectangular Weir
q_weir = st.francis_weir(length=4.5, head=0.60, end_contractions=2)
print(f"Francis Weir Discharge: {q_weir:.3f} m³/s")

# 5. Sediment Dynamics: Shields Parameter
theta = sed.shields_parameter(shear_stress=21.2, grain_diameter=0.003, sediment_density=2650.0, fluid_density=1000.0)
print(f"Shields Parameter theta: {theta:.4f}")

Scalability Benchmarks: 1,000,000 Cross-Sections

A computational stress-test was conducted on an x86_64 system evaluating Manning's open-channel equation across 1,000,000 channel configurations:

Method Execution Time (1M rows) Throughput (rows/sec) Relative Speedup Memory Overhead
Pure Python (for-loop) 1.842 s 542,800 rows/s 1.0x (Baseline) High (Object allocations)
NumPy (Vectorized C) 0.082 s 12,195,000 rows/s 22.5x Moderate (Array buffers)
HydroAj Rust SIMD Engine 0.019 s 52,631,000 rows/s 97.0x Speedup Zero-Copy Native SIMD

Comprehensive Academic Documentation

  1. Interactive Web Manual (HTML):
    Explore all 415 functions with real-time live keyword searching, parameter tables, and SI unit guides in docs/index.html or hostable via GitHub Pages at https://ajaybhattarai-123.github.io/hydroaj/.
  2. Academic Technical Reference Manual (PDF):
    Download HydroAj_Academic_Reference_Manual.pdf (Harvard / MIT technical report format with formal uncolored academic tables, rigorous derivations, and verification proofs).
  3. LaTeX Source Document:
    The complete compilable academic LaTeX source code is available in HydroAj_Academic_Reference_Manual.tex.
  4. Comprehensive Engineering Practice Workbook:
    112 textbook problems fully verified with zero numerical error in HydroCivil_Comprehensive_Practice_Workbook.pdf.

Academic Citation

If you use HydroAj in research papers, master's/doctoral theses, or engineering project briefs, please cite it as follows:

@software{bhattarai2026hydroaj,
  author       = {Bhattarai, Ajay},
  title        = {{HydroAj: High-Performance Water Resources Engineering Computational Framework}},
  year         = {2026},
  publisher    = {GitHub},
  version      = {0.1.0},
  url          = {https://github.com/ajaybhattarai-123/hydroaj},
  note         = {Open-source hybrid Rust-Python library. Available on PyPI: https://pypi.org/project/hydroaj/}
}

License

This software is licensed under the MIT License.
Copyright (c) 2026 Ajay Bhattarai. All rights reserved.

Metadata

Release files for hydroaj 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hydroaj 0.1.0
File Size Uploaded Provenance Actions
hydroaj-0.1.0.tar.gz 886.9 kB Without provenance Details for hydroaj-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hydroaj 0.1.0
File Interpreter ABI Platform Actions
hydroaj-0.1.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for hydroaj-0.1.0-cp311-cp311-win_amd64.whl

Total release size: 1.5 MB

Release files / hydroaj-0.1.0.tar.gz

Download URL hydroaj-0.1.0.tar.gz
Size 886.9 kB
Tags Source
SHA-256 checksum
How to use checksums
52693d9209cb95b50f5037feeced87f40506d8d48ff4bdb8bd6cf7c29fc4456f
BLAKE2b-256 checksum
How to use checksums
e5f9e22dd2876c2b86819089940c8720a66d35fc59bfd268f4ea80c609e0ecce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / hydroaj-0.1.0-cp311-cp311-win_amd64.whl

Download URL hydroaj-0.1.0-cp311-cp311-win_amd64.whl
Size 621.1 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
0e1385fcb980fae9f623375a0e40e475e9d4a62c94c59c2804bf59c713a46682
BLAKE2b-256 checksum
How to use checksums
baf03549fc2d14b70952423f65460fb120a7bf33881d667da3ca601b53505eb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Security for hydroaj 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page