π A 2D, semi-Lagrangian fluid solver.
A semi-Lagrangian fluid solver based on Robert Bridson's book, Fluid Simulation for Computer Graphics (2nd Edition). This implementation uses a staggered marker-and-cell (MAC) grid with second-order Runge Kutta interpolation during the backwards particle trace. Currently, the pressure solve is accomplished using the Gauss-Seidel method.
- Windows 8.1, Windows 10, Ubuntu 18.04
- NVIDIA GeForce GTX 970M, NVIDIA GeForce GTX 980
- Rust compiler version
1.37.0-nightly
(nightly may not be required)
- Clone this repo.
- Make sure π¦ Rust installed and
cargo
is in yourPATH
. - Inside the repo, run:
cargo build --release
.
There are several optional command-line arguments that can be used to configure the simulation:
USAGE:
ponyo.exe [OPTIONS]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-f, --frame_count <COUNT> Sets the number of frames that will be rendered
-o, --output_directory <DIRECTORY> Sets the directory where images will be rendered to
-r, --resolution <WIDTHxHEIGHT> Sets the resolution of the simulation, in pixels
Note that if you are running the executable via cargo
, you must place an additional set of hyphens before any command-line arguments. For example: cargo run -- -o /renders
.
Throughout the creation of this project, several papers and tutorials were particularly helpful:
- Fluid Flow for the Rest of Us [link]
- Fluid Simulation for Computer Graphics: A Tutorial in Grid Based and Particle Based Methods [link]
- Gauss-Seidel Method for Solving Simultaneous Linear Equations [link]
A few existing repositories were helpful as well, most notably Incremental Fluids, a series of tutorials written by Benedikt Bitterli, whose projection
method was key to my understanding of the pressure solve.