Avalanche simulation with Rust and WebGPU
Project description
Avalanche Simulation with Rust and WebGPU
Most modern browsers now support WebGPU (check the current status). The application has been tested on Windows, Linux, and Android, though support on mobile devices may still be limited.
You can explore one of the predefined AvaFrame examples using the dropdown menu, or upload your own Austrian GPX file to run a custom simulation.
This project was initiated to streamline the development of avalanche simulations using WebGPU, building on concepts from weBIGeo. It provides an easy way to visualize results directly in the browser.
The core has since been rewritten in Rust, with Python and WebAssembly (WASM) bindings available. The underlying model is a block-based approach without particle interactions, enabling fast initial estimates of runout distance and flow routing.
Get started with Python
pip install avalanchers[viz]
import avalanchers
sim = avalanchers.PySimulation.new()
sim.create_example("frontend/data/avaframe/avaMal.png")
sim.run()
# needs the viz option
avalanchers.plot2d(sim, "max_velocity")
avalanchers.plot3d(sim, "max_velocity")
Known Issues with Chrome
- Chromium on Windows currently ignores the
high-performanceoption inpowerPreferenceWebGPU flag if you have multiple GPUs [Issue]. Options are:- Run slow on integrated GPU
- Start Chrome with high performance gpu flag
"C:\Program Files\Google\Chrome\Application\chrome.exe" --force_high_performance_gpu - Activate flag in Chrome
chrome://flags/#force-high-performance-gpu. I got slow runs about 50% of the time even though it actually runs on the fast GPU. Might work by now. - Activate the dedicated GPU for Chrome in the system settings.
Development Setup
Windows
# wasm bindings
cargo install wasm-bindgen-cli
cargo install wasm-pack
# coverage
cargo install cargo-tarpaulin
# python bindings
python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install maturin
Linux
Install dependencies
Install Rust (WSL (2026.04.04): curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh)
Install Python
sudo apt update
sudo apt install -y python3-venv python3-dev build-essential clang lld pkg-config libssl-dev
# wasm bindings
cargo install wasm-bindgen-cli
cargo install wasm-pack
# python bindings
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install maturin
Build
# cli tool
cargo build -p cli --release
# python bindings
maturin develop
maturin build --release
# wasm bindings
wasm-pack build crates/wasm_bindings --target web --out-dir ../../frontend/js/pkg --no-opt
wasm-pack build crates/wasm_bindings --target web --out-dir ../../frontend/js/pkg --release
Run
Python
python avalanchers_example.py
Frontend
- Install OpenSSL
- Go to the project directory
- Start the development server:
python .\frontend\dev_server.pyThis launches the app with caching disabled and HTTPS enabled using self-signed certificates, which are required for WebGPU support in most browsers. - Open your browser and go to: https://localhost/ If you are accessing the server from another device on the same network, replace
localhostwith the host machine’s IP address.
Benchmarks
cargo bench -p simulation
Code Guidelines
Before pushing use:
Install pip install ruff
cargo fmt
cargo clippy -- -D warnings
cargo test -p compute_core -p data_processor -p simulation
ruff check ./python_module
pytest python_module
Data Sources
Test examples are from AvaFrame under EUPL-1.2 license
Vals data: D'Amboise Christopher J. L., Neuhauser Michael, Teich Michaela, & Fischer Jan-Thomas. (2021). Maverick-bfw/Flow_py_inputs_results: First releases (Version v1) [Data set]. Zenodo. https://doi.org/10.5281/zenodo.5154787
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file avalanchers-0.2.0-cp37-abi3-win_amd64.whl.
File metadata
- Download URL: avalanchers-0.2.0-cp37-abi3-win_amd64.whl
- Upload date:
- Size: 6.4 MB
- Tags: CPython 3.7+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58aa14814c9629dbfadb3d08893c912d4061c9cfe5dc47d810243264a3b33776
|
|
| MD5 |
cb8e57a2248a9d95b95027c700b57955
|
|
| BLAKE2b-256 |
7f43c37da6494f23fe3d5e20eb73d2cdcf22488179f27158542213873375ada6
|
Provenance
The following attestation bundles were made for avalanchers-0.2.0-cp37-abi3-win_amd64.whl:
Publisher:
release.yaml on Gro2mi/avalanchers
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
avalanchers-0.2.0-cp37-abi3-win_amd64.whl -
Subject digest:
58aa14814c9629dbfadb3d08893c912d4061c9cfe5dc47d810243264a3b33776 - Sigstore transparency entry: 1605451325
- Sigstore integration time:
-
Permalink:
Gro2mi/avalanchers@f2e503c1996a7ca89a0852bac05d3b2cd0de7ed8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Gro2mi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@f2e503c1996a7ca89a0852bac05d3b2cd0de7ed8 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file avalanchers-0.2.0-cp37-abi3-manylinux_2_38_x86_64.whl.
File metadata
- Download URL: avalanchers-0.2.0-cp37-abi3-manylinux_2_38_x86_64.whl
- Upload date:
- Size: 7.3 MB
- Tags: CPython 3.7+, manylinux: glibc 2.38+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2a8e2c17ce8e69bc4e968166b720104b12ca9f226b489d16d68912aa8bb56c3
|
|
| MD5 |
927da241194446493a86dc7c88a83615
|
|
| BLAKE2b-256 |
6f1d17a739cd5596b9ad0ca1b97884dc4b009f87d0ee41c71498955993a25122
|
Provenance
The following attestation bundles were made for avalanchers-0.2.0-cp37-abi3-manylinux_2_38_x86_64.whl:
Publisher:
release.yaml on Gro2mi/avalanchers
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
avalanchers-0.2.0-cp37-abi3-manylinux_2_38_x86_64.whl -
Subject digest:
f2a8e2c17ce8e69bc4e968166b720104b12ca9f226b489d16d68912aa8bb56c3 - Sigstore transparency entry: 1605451435
- Sigstore integration time:
-
Permalink:
Gro2mi/avalanchers@f2e503c1996a7ca89a0852bac05d3b2cd0de7ed8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Gro2mi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@f2e503c1996a7ca89a0852bac05d3b2cd0de7ed8 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file avalanchers-0.2.0-cp37-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: avalanchers-0.2.0-cp37-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 6.1 MB
- Tags: CPython 3.7+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be3c164ab70d1a8e0a538a916e28586a2bb8cb3b312d8c1f7de7d580b28d44bc
|
|
| MD5 |
df50151262d4c1faeff3b5949ed9a2fb
|
|
| BLAKE2b-256 |
3d01e59a06ded36fd813a5b7d3581368e39c7a9aa449558cc8db6df6bc022120
|
Provenance
The following attestation bundles were made for avalanchers-0.2.0-cp37-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yaml on Gro2mi/avalanchers
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
avalanchers-0.2.0-cp37-abi3-macosx_11_0_arm64.whl -
Subject digest:
be3c164ab70d1a8e0a538a916e28586a2bb8cb3b312d8c1f7de7d580b28d44bc - Sigstore transparency entry: 1605451234
- Sigstore integration time:
-
Permalink:
Gro2mi/avalanchers@f2e503c1996a7ca89a0852bac05d3b2cd0de7ed8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Gro2mi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@f2e503c1996a7ca89a0852bac05d3b2cd0de7ed8 -
Trigger Event:
workflow_run
-
Statement type: