N-body simulator using bruteforce method using docker for calculations
MIT License
This is a simple n-body simulator made with OpenGL for the graphics part and C++ for the logic part. The project is running on a complete docker environment.
Note The project is a test of paralleling the calculation of the particles on different docker containers and store them in a redis database. A docker is also used to generate the video from the redis database.
Longer video 🚀🚀 here 🚀🚀
To use the project, you need to have docker installed on your computer. You can download it here: https://www.docker.com/
You also need to install the following linux lib:
sudo apt-get install xvfb
You also need python3 installed on your computer. You can download it here: https://www.python.org/downloads/
Once you have installed the requirements, you can install the python libs with the following command:
pip install -r requirements.txt
This will install the required libs to generate the docker-compose.yml
using the docker-compose-generator.py
python
script.
python3 docker-compose-generator.py <total_particles> <number_of_calculators> <simulation_recording_time>
exemple:
python3 docker-compose-generator.py 1000 4 10
This will generate a docker-compose.yml
file with 4 calculators and 1000 particles and a simulation recording time of
10 seconds.
Once created you can run the docker-compose.yml
with the following command:
./test.sh
An output video will be genereated in the ./src/NBodyGraphics/output_dir
folder.
flowchart LR
subgraph Host
subgraph Docker-Calculators
docker1 & docker2 & docker...
end
docker1 & docker2 & docker... <--> |GET/POST| api-redis
subgraph Redis
api-redis
end
api-redis --> |Send particles| NBodyGraphics
NBodyGraphics --> |Request update| api-redis
subgraph Video-Generator
end
subgraph Video-Generator
NBodyGraphics
end
NBodyGraphics --> |Save video | Volume
end
graph TB
A((Start))
B[NBodyGraphics]
C[API-Redis]
D[NBodycalculator1]
E[NBodycalculator2]
F[NBodycalculator3]
G[NBodycalculator...]
H[API-Redis]
I[NBodyGraphics]
J[Volume]
A --> B
B --> | Physic update | C
C --> | Particle request update | D & E & F & G
D & E & F & G --> | Send updated particles | H
H --> | Send updated particles | I
I --> | Do another cycle | B
I --> | Save video | J
docker: https://www.docker.com/
cmake: https://cmake.org/
glfw: https://www.glfw.org/docs/latest/
glm: https://glm.g-truc.net/0.9.9/index.html
glad: https://glad.dav1d.de/
OpenGL: https://www.opengl.org/
Json: https://github.com/nlohmann/json
libcurl: https://curl.se/libcurl/
Axel COURMONT:
Quentin MOREL:
Alexis ROVILLE: