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] once pypi upload works. For now use the released wheel.
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")
Test examples are from AvaFrame under EUPL-1.2 license
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
Install Rust, follow guide: https://rust-lang.org/tools/install/ Install Python
# 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, follow guide: https://rust-lang.org/tools/install/ (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
- Install module
- See
python avalanchers_example.py
Frontend
- Go to this directory
- Start server with
python .\frontend\dev_server.pyfor disabled cache and a secure connection with self signed certs which are needed to use WebGPU (except for localhost wherepython -m http.server 8000works as well) - Open Browser on https://localhost/index.html or https://localhost/index.html?debug=vscode for debugging mode or replace localhost with IP if accessing from another device.
Code Guidelines
Before pushing use:
Install pip install ruff
cargo fmt
cargo clippy -- -D warnings
cargo test -p compute_core -p data_processor
ruff check ./python
pytest python
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.1.0-cp37-abi3-win_amd64.whl.
File metadata
- Download URL: avalanchers-0.1.0-cp37-abi3-win_amd64.whl
- Upload date:
- Size: 6.3 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 |
69fd3125618d791bf1aad2dac233c00e99d6d178e63fe4745ed1f4b3ac26c93f
|
|
| MD5 |
8007eeb839e81d6ab58dd96c25532e53
|
|
| BLAKE2b-256 |
f949dd759aaa7b149acbf7efacb797da8c3c3888cdc84817d49742f181f0fffd
|
Provenance
The following attestation bundles were made for avalanchers-0.1.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.1.0-cp37-abi3-win_amd64.whl -
Subject digest:
69fd3125618d791bf1aad2dac233c00e99d6d178e63fe4745ed1f4b3ac26c93f - Sigstore transparency entry: 1437543665
- Sigstore integration time:
-
Permalink:
Gro2mi/avalanchers@0ba08968281bd6c2aea3a3e7e8f8b427f56f32bb -
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@0ba08968281bd6c2aea3a3e7e8f8b427f56f32bb -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file avalanchers-0.1.0-cp37-abi3-manylinux_2_38_x86_64.whl.
File metadata
- Download URL: avalanchers-0.1.0-cp37-abi3-manylinux_2_38_x86_64.whl
- Upload date:
- Size: 7.1 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 |
43aa26bf49ff33a7a50c354c1e581a8a32a4bebaaa4e8825357cb6b68a01d6d4
|
|
| MD5 |
b94694801fc3b70a223215d62676313b
|
|
| BLAKE2b-256 |
0d071d5b647c094c8fd4f6a8d78d337808dd3dbfdb7db05163ab30b81d4495b8
|
Provenance
The following attestation bundles were made for avalanchers-0.1.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.1.0-cp37-abi3-manylinux_2_38_x86_64.whl -
Subject digest:
43aa26bf49ff33a7a50c354c1e581a8a32a4bebaaa4e8825357cb6b68a01d6d4 - Sigstore transparency entry: 1437543673
- Sigstore integration time:
-
Permalink:
Gro2mi/avalanchers@0ba08968281bd6c2aea3a3e7e8f8b427f56f32bb -
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@0ba08968281bd6c2aea3a3e7e8f8b427f56f32bb -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file avalanchers-0.1.0-cp37-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: avalanchers-0.1.0-cp37-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 6.0 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 |
5b59e50b23ba6a34bc3a9064a2e7c186a0f64f1b0564fb8aa3868f657a4dca7b
|
|
| MD5 |
422c09144f6678db63915f4d1dd72762
|
|
| BLAKE2b-256 |
b469fa930fbcca411023bea198a0eccf1592f40c9f49e8b413a09f234c49d3fe
|
Provenance
The following attestation bundles were made for avalanchers-0.1.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.1.0-cp37-abi3-macosx_11_0_arm64.whl -
Subject digest:
5b59e50b23ba6a34bc3a9064a2e7c186a0f64f1b0564fb8aa3868f657a4dca7b - Sigstore transparency entry: 1437543679
- Sigstore integration time:
-
Permalink:
Gro2mi/avalanchers@0ba08968281bd6c2aea3a3e7e8f8b427f56f32bb -
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@0ba08968281bd6c2aea3a3e7e8f8b427f56f32bb -
Trigger Event:
workflow_run
-
Statement type: