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 (streams1d). 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). The install name is stream1d; import the module as streams1d (see examples below).

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 streams1d 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 streams1d.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/streams1d_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/streams1d/__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/          streams1d 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.0.tar.gz (166.5 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.0-cp37-abi3-win_amd64.whl (550.1 kB view details)

Uploaded CPython 3.7+Windows x86-64

stream1d-0.1.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (677.4 kB view details)

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

stream1d-0.1.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (660.4 kB view details)

Uploaded CPython 3.7+manylinux: glibc 2.17+ ARM64

stream1d-0.1.0-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.0.tar.gz.

File metadata

  • Download URL: stream1d-0.1.0.tar.gz
  • Upload date:
  • Size: 166.5 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.0.tar.gz
Algorithm Hash digest
SHA256 12cf8c311689a76ace36582bd5f8b40dccfae4ef3166e5f9d3a45ff739be42f3
MD5 ba8eeaec8be7ed1736ae32638cca6189
BLAKE2b-256 42f90175e97f80f7888eb7753075bf9752f4151239105658f6d147d533e5b6eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for stream1d-0.1.0.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.0-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: stream1d-0.1.0-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.0-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e2868990974c0df4f076c92249ec3aa588e8117797681e39c296207bae69c152
MD5 c94142a29d6668c6a880d268bf47bbc4
BLAKE2b-256 8b2649c27f2bb43bafaf3cabef0bae29d38a2b202bc568112233f6f3ede5d105

See more details on using hashes here.

Provenance

The following attestation bundles were made for stream1d-0.1.0-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.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for stream1d-0.1.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7c4e4459f945a8708e1d7fca8d8d051bd4707d0daa8d92efade16840034f48c8
MD5 de1d9a85a8a4b37130d645f48f0edcf0
BLAKE2b-256 c7edc844c131ab71b110f65677f6581ba27a61aa2e04ebee0dfbfc097655ed47

See more details on using hashes here.

Provenance

The following attestation bundles were made for stream1d-0.1.0-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.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for stream1d-0.1.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bc725d6ad74cd228a251cd90acae2be800a1b55bf8ce82da0b0f0e51fcd2c8a2
MD5 bd24edf15756de3d388b4573619e8174
BLAKE2b-256 be291d298d67cf8f72e0faf49b40793c7c4fe24472dac02d3840502444671365

See more details on using hashes here.

Provenance

The following attestation bundles were made for stream1d-0.1.0-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.0-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for stream1d-0.1.0-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 859568f249effb68cda3b4bf7dd7a81d38febc44f5e380d215799969bc579717
MD5 302f98dcfe856b7145c541ed16bcdb7a
BLAKE2b-256 08c58d1357409af5a8fc476606ff7c1073c093af8c814e93fecaeb42cea0d8a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for stream1d-0.1.0-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