Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jwwtc/mpiheatequation
A Parallelized Solution of the 2D Heat Conduction Equation on a Square Plate Using MPI.
https://github.com/jwwtc/mpiheatequation
heat-transfer mpi-parallelization numerical-methods
Last synced: about 2 months ago
JSON representation
A Parallelized Solution of the 2D Heat Conduction Equation on a Square Plate Using MPI.
- Host: GitHub
- URL: https://github.com/jwwtc/mpiheatequation
- Owner: jwwtc
- License: mit
- Created: 2022-12-27T23:28:31.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-01-11T02:20:32.000Z (almost 2 years ago)
- Last Synced: 2024-01-27T18:42:06.574Z (11 months ago)
- Topics: heat-transfer, mpi-parallelization, numerical-methods
- Language: C
- Homepage:
- Size: 23.3 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mpiHeatEquation
## Abstract
Overall, MPI parallelization is a powerful tool for improving the efficiency and accuracy of heat conduction simulations, and it has numerous applications in various fields of engineering and science. Here, we are presenting the parallelized solution of the two-dimensional heat conduction equation on a square plate. We leverage collective communications and certain MPI functions to achieve convergence to the analytical solution. Metrics of scalability are widely used to illustrate the ability of both hardware and software to deliver greater compute with more hardware. Thus, we will also perform a weak and a strong scaling analysis of our program.### Theory
For the numerical solution, we time-match:$\frac{\partial \theta}{\partial t}=\kappa\left(\frac{\partial^2 \theta}{\partial x^2}+\frac{\partial^2 \theta}{\partial y^2}\right)$
to a steady-state solution on a uniform mesh, with the following finite difference approximation:
$\frac{\theta_{i, j}^{t+1}-\theta_{i, j}^t}{\delta \mathrm{t}}=\left(\frac{\theta_{i+1, j}^t-2 \theta_{i, j}^t+\theta_{i-1, j}^t}{\delta x^2}+\frac{\theta_{i, j+1}^t-2 \theta_{i, j}^t+\theta_{i, j-1}^t}{\delta \mathrm{y}^2}\right)$
As for the analytical solution, this is given by the Fourier series:
$\theta(x, y)=\sum_{n=1,3,5, \ldots}^{\infty} \frac{4 \theta_N}{n \pi} \sin \left(\frac{n \pi x}{L}\right) \sinh \left(\frac{n \pi y}{L}\right) / \sinh (n \pi)$,
which is asymptotically correct. $L$ is the length of the plate’s edge and $\theta_{N}$ is the constant temperature on the plate’s top side. Regarding time-stepping and numerical stability, we made sure that $\mathrm{dt}<0.25 \mathrm{dx}^2 / \kappa$.
## Sample Results
### Numerical and Analytical Solutions Comparison
Surface Plot | Contour Plot
:-------------------------:|:-------------------------:
|### Strong Scaling
Speedup | Time
:-------------------------:|:-------------------------:
|#### To compile.
mpicc -O2 -std=c99 -o main.exe main.c functions.c -lm#### To run.
mpiexec -n main.exe