The CUDA-SPH project aims to provide a set of tools for simulating fluids, as well as for visualizing the generated data. To simulate fluid we used the SPH technique. This approach assumes that a fluid is a set of particles that interact with each other and move around according to Navier-Stokes equations.
We saw an opportunity to parallelize it, so we used GPU programming with CUDA to implement it. To make production relatively faster and easier for us, we used the Python programming language.
Tested with Python 3.9
Install CUDA Toolkit: https://developer.nvidia.com/cuda-toolkit-archive
cd sim
./venv/Scripts/activate
pip install -r ./requirements.txt
Download PyOpenGL manualy from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopengl.
cd vis
./venv/Scripts/activate
pip install ./PyOpenGL-3.1.5-cp39-cp39-win_amd64.whl # cp39 <==> Python 3.9
pip install ./PyOpenGL_accelerate-3.1.5-cp39-cp39-win_amd64.whl # cp39 <==> Python 3.9
pip install -r ./requirements.txt
Software we made is divided into two programs, simulator and visualizer. Simulator is able to produce a simulation (to a chosen directory), and visualizer displays it.
Two types of enclosure are available:
- inside a box
- inside a pipe
The config.py
file is used to set numerous simulation parameters such as the mode (enclosure type), particle count and the initial state of the simulation.
Running the simulator:
python ./sim/src/main.py
Running the visualizer:
python ./vis/src/main.py
W,A,S,D
- Move forward, left, back and right (relative to the camera)Q, E
- Move down and up (relative to the camera)Space
- Increase the speed of moving around twofoldClick and drag
- Rotate the camera
Full documentation of the project is available in Polish: Dokumentacja Projektu