https://github.com/medakk/spherro
Smooth particle hydrodynamics fluid simulator
https://github.com/medakk/spherro
rust smooth-particle-hydrodynamics wasm webgl
Last synced: about 1 year ago
JSON representation
Smooth particle hydrodynamics fluid simulator
- Host: GitHub
- URL: https://github.com/medakk/spherro
- Owner: medakk
- License: mit
- Created: 2019-06-25T14:50:07.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-03T01:30:14.000Z (over 3 years ago)
- Last Synced: 2025-04-05T02:03:26.554Z (about 1 year ago)
- Topics: rust, smooth-particle-hydrodynamics, wasm, webgl
- Language: Rust
- Homepage: https://apps.karthikkaranth.me/spherro/
- Size: 1.27 MB
- Stars: 48
- Watchers: 1
- Forks: 4
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# spherro
[](https://crates.io/crates/spherro)
A smoothed particle hydrodynamics fluid simulator. Built with rust, and compiled to wasm. Check out the demo [here](https://apps.karthikkaranth.me/spherro/).
## Building
### Dependencies
All instructions have been tested on Ubuntu 18.04, with the versions:
* rust 1.63.0
* wasm-pack 0.8.1
* npm 6.9.0
* node v10.16.0
### Steps to build
* Install:
* [The standard rust toolchain](https://www.rust-lang.org/tools/install)
* [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/)
* [npm](https://www.npmjs.com/get-npm)
* Clone this repo: `git clone https://github.com/medakk/spherro`
* In the root folder of the repo, run `wasm-pack build`
* In the `www` folder, run:
```
npm install
npm run start
```
This will start a server(defaults to http://localhost:8080) serving spherro.
## Debugging
Running `cargo run --bin spherro-bin --release` starts a [kiss3d](https://docs.rs/kiss3d/0.20.1/kiss3d/)-based viewer that can be used to debug the simulator without going through the browser.
Running `cargo bench` starts a headless dambreak simulation with a fixed time step. This can be used to test performance changes.
## References
* [SPH Fluids in Computer Graphics](https://cg.informatik.uni-freiburg.de/publications/2014_EG_SPH_STAR.pdf), _EUROGRAPHICS 2014_
## License
[MIT License](LICENSE)