This is a CUDA + OpenGL fluid/particle simulation experiment, created as a project for the Parallel Algorithms university class. I attempted to follow the tutorial Physics-Based Simulation & Animation of Fluids by Chand T. John, Ph.D. Overall, it turned out reasonably well, though the simulation does not seem stable over longer time scales.
fuild-simulation-example.mp4
- CMake (>= 3.18)
- A C++17 compiler
- CUDA Toolkit (NVCC)
- OpenGL + GLEW + GLUT (on Linux, usually freeglut)
On Arch Linux this is typically covered by packages like cmake, cuda, glew, freeglut, and a Mesa/OpenGL driver stack.
This repo uses CMake. If cmake in your PATH is a broken shim, you can call the system binary directly as /usr/bin/cmake.
mkdir -p build
/usr/bin/cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
/usr/bin/cmake --build build -jThe executable is written to build/bin/fluid_simulator. Shaders are copied to build/bin/shaders/ during the CMake configure step.
./build/bin/fluid_simulatorIf you see missing-shader errors, run from build/bin/ so relative shader paths resolve:
cd build/bin
./fluid_simulator