This project implements a 2D fluid simulation using two parallel approaches:
- MPI Version: Distributed simulation using MPI and OpenGL for visualization. See the source in openmpi/fluid_box.cpp.
- OpenMP Version: Multi-threaded simulation using OpenMP and OpenGL for visualization. See the source in openmp/fluid_box.cpp.
Before running make all
, ensure you have the following packages installed:
- MPI: Open MPI (e.g.
openmpi-bin
andlibopenmpi-dev
on Ubuntu) - OpenGL: OpenGL development libraries (e.g.
libgl1-mesa-dev
) - GLUT: GLUT development libraries (e.g.
freeglut3-dev
) - C++ Compiler: A C++ compiler with OpenMP support (e.g.
g++
)
Compile project:
make all
Run the simulation:
mpirun -np 4 ./out/fluid_sim_mpi
(The argument 4
specifies the number of threads to use.)
Run the simulation:
./out/fluid_sim_omp 4
(The argument 4
specifies the number of threads to use.)
- Visualization: Both simulation versions use OpenGL/GLUT to display the fluid density field.
- Interaction: Left-mouse clicks or movements add impulses to the simulation. Use mouse interactions to update the fluid dynamics.