Fluid simulation with particles
Try it on your browser! https://msakuta.github.io/rushydro/
A demonstration of combined simulation of Lagrangean fluid and rigid bodies.
RusHydro.GUI.2023-10-22.00-30-37.mp4
A solid object whose average density is lighter than the liquid will float on it.
RusHydro.GUI.2023-10-22.14-00-02.mp4
Below is a heat convection simulation, where the bottom of the screen has a heat source that increases fluid temperature. Higher tenperature particles exert more pressure. It is notable that convection (hot fluid floats, cool fluid sinks) naturally emerges. Nearby particles can exchange heat, which realizes heat diffusion. Note that the temperature is an attribute of each particle, so they will advect along with the particles.
rushydro-convection2.mp4
This is a sister project of cfd-wasm, a fluid simulator in Rust. While cfd-wasm used Eulerian method to discretize space, this project uses finite Lagrangean method, meaning we track attributes of particles. It has more advantage that it can calculate varying density like gases or liquid surfaces.
This project has been inspired by Sebastian Lague's video, who did fluid simulation in Unity. If you can do it in Unity, why not in Rust?
cargo r
Install trunk by
cargo install --locked trunk
and run
trunk build --release