Skip to main content

Stateless open-channel and river hydraulics solver

Project description

STREAM-1D

1D open-channel hydraulics solver (Rust). Steady gradually varied flow (Standard Step) and unsteady Saint-Venant routing on single reaches. Optional culverts, bridges, and one steady tributary junction.

Primary interface: Python extension (stream1d). Also compiles to WebAssembly. Stateless API: geometry and boundary inputs in, profile arrays out.

This repository is the solver only. It does not include a GUI, project database, or HEC-RAS file importer. stream1d.com is a separate hosted application built on this engine (see License).

Capabilities

Analysis Structures Limits
Steady GVF (subcritical, supercritical, mixed) Culverts (FHWA inlet/outlet), bridges (HEC-RAS Class A/B/C, pressure, weir) Single reach; one tributary junction (steady, subcritical)
Unsteady routing (single reach) Inline culverts and bridges Upstream Q(t), downstream WSEL(t); no multi-reach networks

Full HEC-RAS comparison: docs/reference/hecras_parity.md.

Python

Install

pip install stream1d

Requires Python ≥ 3.7. Wheels are published for Linux, macOS, and Windows (see PyPI).

Install from source

For unreleased changes, clone the repository and build with Rust + maturin:

python -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install maturin pytest
maturin develop --features python

Rebuild with maturin develop --features python after pulling solver changes. Release process: docs/development/publishing.md.

Steady profile

import stream1d as st

xs_us = st.CrossSection(
    station=1000.0,
    x=[0.0, 0.0, 10.0, 10.0],
    y=[6.0, 1.0, 1.0, 6.0],
    n_stations=[0.0],
    n_values=[0.025],
    unit_system="Metric",
)
xs_ds = st.CrossSection(
    station=0.0,
    x=[0.0, 0.0, 10.0, 10.0],
    y=[5.0, 0.0, 0.0, 5.0],
    n_stations=[0.0],
    n_values=[0.025],
    unit_system="Metric",
)

result = st.solve_steady(st.SteadyInputs(
    cross_sections=[xs_us, xs_ds],
    flow_rate=15.0,
    downstream_wsel=1.5,
    regime=0,
))
print(result["wsel"])
print(result["velocity"])

Unsteady routing

result = st.solve_unsteady(st.UnsteadyInputs(
    cross_sections=[xs_us, xs_ds],
    initial_wsel=[2.0, 1.5],
    initial_q=[14.0, 14.0],
    dt=60.0,
    num_steps=5,
    upstream_q_hydrograph=[14.0] * 5,
    downstream_wsel_hydrograph=[1.0] * 5,
))
print(result["wsel"][-1])

JSON fixtures

Load geometry from JSON with stream1d.import_utils.cross_section_from_dict. Example fixtures: tests/fixtures/wasm_steady_culvert_tier1.json, tests/fixtures/wasm_steady_bridge_bu_bd_v22.json.

Culvert, bridge, junction, and rating-curve examples: docs/python/getting_started.md.

Interactive notebook

Binder

python/stream1d_verification.ipynb — profiles and HEC-RAS comparison plots. First Binder build may take several minutes.

Inputs and outputs

Cross sections — river station; (x, y) cut polyline; Manning n zones (n_stations, n_values); optional is_overbank, blocked_obstructions, ineffective_flow_areas.

Steadyflow_rate, regime (0 subcritical, 1 supercritical, 2 mixed), downstream boundary (downstream_wsel, normal depth, rating curve, etc.). Structure fields: culvert_*, bridge_*.

Unsteadyinitial_wsel, initial_q, dt, num_steps, upstream_q_hydrograph, downstream_wsel_hydrograph. Same structure fields as steady.

Resultswsel, velocity, area, froude_number, critical_wsel, energy_grade_slope. With culverts: control type, inlet/outlet HW, barrel and weir discharge. With bridges: flow regime, head loss. Unsteady structure outputs are [time_step][structure_index].

Field reference: python/stream1d/__init__.py, docs/wasm_api.types.ts. Equations: docs/reference/equations.md.

Verification

Case Reference Tolerance
ConSpan culvert 5/25/50 yr profiles python/verification/hecras_conspan_profiles.json ±0.04 ft WSEL
Bridge abutments (WSPRO) python/verification/bridge_abutment_hecras.json ±2 mm HW
Bridge BU/BD faces python/verification/bridge_bu_bd_hecras.json ±2 mm HW
PYTHONPATH=python python python/test_hecras_culvert_verification.py
cargo test --test bridge_bu_bd_hecras_verification

Test commands: docs/development/testing.md.

Build targets

Target Command Notes
Python maturin develop --features python Default for research and scripting
WebAssembly bash build_wasm.sh Browser (pkg/) and Node (pkg-node/)

WASM API: docs/web/wasm_integration.md.

Documentation

Document Contents
docs/python/getting_started.md Culvert, bridge, unsteady Python examples
docs/reference/equations.md GVF, Saint-Venant, culvert and bridge theory
docs/reference/hecras_parity.md Scope vs HEC-RAS
docs/reference/api_changelog.md Input schema versions
docs/BRIDGE_INTERIOR_SECTIONS_API.md BU/BD interior sections
docs/web/wasm_integration.md WASM build and JavaScript usage
docs/development/testing.md Test suites and CI
docs/development/publishing.md PyPI trusted publishing and releases
tech_spec.md Host-application architecture

Repository layout

src/solvers/     steady, unsteady, culvert, bridge, junction
python/          stream1d bindings, verification data, notebook
docs/            reference manuals and WASM types
tests/           Rust integration tests and JSON fixtures
examples/wasm/   Node smoke tests and sample payloads

License

Engine (this repository): MIT License.

stream1d.com web application: separate proprietary product (Lillywhite Water Solutions LLC), not covered by this license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stream1d-0.1.1.tar.gz (166.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

stream1d-0.1.1-cp37-abi3-win_amd64.whl (550.1 kB view details)

Uploaded CPython 3.7+Windows x86-64

stream1d-0.1.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (677.5 kB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ x86-64

stream1d-0.1.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (660.6 kB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ARM64

stream1d-0.1.1-cp37-abi3-macosx_11_0_arm64.whl (619.0 kB view details)

Uploaded CPython 3.7+macOS 11.0+ ARM64

File details

Details for the file stream1d-0.1.1.tar.gz.

File metadata

  • Download URL: stream1d-0.1.1.tar.gz
  • Upload date:
  • Size: 166.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for stream1d-0.1.1.tar.gz
Algorithm Hash digest
SHA256 df5d8b0ad87a8e3a4e3bc4602d7e5f2dcb10b81b93752d7174bd2679dbd9b46d
MD5 94b6952dedffa5f2691eabd4ec494448
BLAKE2b-256 f88b49de160233d9099a66ec1ceb4d2df77207103877f8315741b529866fec2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for stream1d-0.1.1.tar.gz:

Publisher: publish.yml on jlillywh/STREAM-1D

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stream1d-0.1.1-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: stream1d-0.1.1-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 550.1 kB
  • Tags: CPython 3.7+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for stream1d-0.1.1-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 41f199342336c4f41271d40eba70824dcdfc0019046291be095cc90ce60e3252
MD5 dc2c149012605ef838dcb9a131aaf8ed
BLAKE2b-256 cbdec312a4e886343f5e7a5181f15f67805ebb373c102f573f8c2a04c6a0feb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for stream1d-0.1.1-cp37-abi3-win_amd64.whl:

Publisher: publish.yml on jlillywh/STREAM-1D

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stream1d-0.1.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for stream1d-0.1.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9645f1d2072f8a046e33f0c15aad33a3f05b313088c20b41ee92ba8b69fb0ea7
MD5 0766b6c7f74b35564fd4deb02b09b9ec
BLAKE2b-256 1b5e6c623e766442e841a3fb8271dd34dd955a5e70447a6a4dbebf2d5034a0e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for stream1d-0.1.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on jlillywh/STREAM-1D

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stream1d-0.1.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for stream1d-0.1.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2d07affe140e4902e763b6698756843f4af61af968c8b24d0aa9cd30c3bb5eba
MD5 e4b66d72471816f7fbbc9802fb7cb18d
BLAKE2b-256 84d2d945e2f2248d121ea66ccb349a68c2cf42e26f836bbbef67a03f0dd6993f

See more details on using hashes here.

Provenance

The following attestation bundles were made for stream1d-0.1.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on jlillywh/STREAM-1D

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stream1d-0.1.1-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for stream1d-0.1.1-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 efd4daba0436ee4fc392a0e0d1d928043dd1d9f87ed6d68a9c3906c60400ef12
MD5 d55325068adf0a697eeb1e0a2f1e3fb5
BLAKE2b-256 a02d8aa0ab79594b1ef92d71abb4847263fe7ceaf09bc39442983fae28698738

See more details on using hashes here.

Provenance

The following attestation bundles were made for stream1d-0.1.1-cp37-abi3-macosx_11_0_arm64.whl:

Publisher: publish.yml on jlillywh/STREAM-1D

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page