C++ parallel solver for the 2D heat equation, with Dirichlet boundary conditions, using the Finite Differences Method.
The code was validated with test cases, and parallelized using the MPI library.
You can get the sources from github by typing in your terminal :
git clone https://github.com/gabriel-suau/heat-2d-mpi-hpc-project.git mpi_heat_2D
To compile the parallel code in release mode, you can type the following commands :
cd mpi_heat_2D/parallel
make release
This command will produce an executable called main
. To execute the program with the parameters written in parameters.txt
, you can use either mpiexec
or mpirun
. For example, to execute the program with 4 MPI processes (assuming your machine has the required number of cores), you can type :
mpirun -n 4 ./main parameters.txt
or
mpiexec -n 4 ./main parameters.txt
The outputs of the computation are written in the directory resultsDir
specified in parameters.txt
. Each MPI process writes its own results files. These files can directly be plotted using gnuplot
. The results file names are in the form :
solution_scenario_%SCENARIO%_%MPIRANK%_%SAVEITERATION%.dat
For example, let's say you simulated the scenario n°1 with 4 MPI processes. To visualise the whole solution at the time iteration n°10, you can type
gnuplot
splot for [i=0:3] "solution_scenario_1_".i."_10.dat"
Here is a more complex example. Let's say you simulated the scenario n°3 with 4 MPI processes and you have
gnuplot
set palette defined (1 "blue", 2 "white", 3 "red")
do for [i=1:300] {plot for [j=0:3] "solution_scenario_3_".j."_".i.".dat" with image; pause 0.02}
A documentation for the parallel code can be automatically generated with Doxygen. Just type :
doxygen doxygen.cfg
This command will produce a doc/
directory containing an HTML documentation in the html/
directory and a PDF documentation in the latex
directory. To read the HTML documentation using firefox
, just type the following command (assuming you are in the root directory)
firefox doc/html/index.html
All developpers are students at ENSEIRB-MATMECA, a french engineering school located in Talence.
- Geoffrey Lebaud
- Rémi Pégouret
- Gabriel Suau
This project is distributed under the GNU-GPLv3 license. A copy of the whole license is included in the repository.
- Make a working sequential version of the code (time integration : Explicit Euler, Implicit Euler)
- Parallelize the linear solver (Conjugate Gradient)
- Automatize the strong scalability tests with a Bash script