Terminal-based 2D fluid simulator
- Rust 98%
- Nix 2%
|
yvt
7c39de5abf
fix(app): clamp particle velocity
The wrap-around logic breaks if particles cross the boundary more than once between frames, leaving them outside the viewport. Fixes panics caused by out-of-bounds access (#3). |
||
|---|---|---|
| docs | doc: add a screenshot | |
| src | fix(app): clamp particle velocity | |
| .gitignore | chore(nix): add Nix flake | |
| build.rs | feat(app): increase particle density | |
| Cargo.lock | feat(app): list keyboard commands | |
| Cargo.toml |
chore: exclude flake.{nix,lock}, rust-toolchain.toml, /docs
|
|
| flake.lock |
chore: update flake.lock
|
|
| flake.nix | chore(nix): add Nix flake | |
| LICENSE | doc: license under GPL-3.0-or-later | |
| README.md | doc: warn not to run it remotely | |
| rust-toolchain.toml | init | |
Prerequisites
-
A very fast terminal emulator supporting 24bpp colors (e.g., Alacritty). Normal ones like macOS Terminal and GNOME Terminal will not cut it.
-
A fast, unmetered network connection to the host machine if you want to run it remotely over SSH (not recommended due to excessive network traffic generated).
-
rustup to build the program.
Usage
# Monotone particles (use mouse to disturb)
cfluid
# Monotone particles on very thick fluid
cfluid -v 1e5
# Particles with trails colored by velocity
cfluid --heatmap velocity --trails
# Cool screensaver
cfluid --heatmap velocity --trails -s
Bibliography
[Stam01] Stam, Jos. (2001). "A Simple Fluid Solver based on the FFT." Journal of Graphics Tools. 6. 10.1080/10867651.2001.10487540.
[Green11] Green, D.A. (2011). "A colour scheme for the display of astronomical intensity images." Bulletin of the Astronomical Society of India, vol.39, pp.289--295. 10.48550/arXiv.1108.5083.
License
This program is licensed under GNU General Public License v3.0 or later.