Example application

The workflow will be demonstrated using a simple application written in C++. The program solves the Laplace equation in two dimensions to calculate the heat transfer in a plate using the following finite difference scheme:

Parallelization

The finite difference scheme for two-dimensional heat transfer is parallelized by splitting the grid into smaller subdomains and assigning each subdomain to a different processor or thread. Once the grid is split, each processor can independently compute the temperature values in its assigned subdomain using the finite difference scheme. However, to compute the values at the boundary between subdomains, communication is required between neighboring processors. This is realized using the Message Passing Interface (MPI).

The following code snippet illustrates the general structure of the application. At first, the grid and the boundary conditions are initialized. Then a loop runs until a steady temperature field has reached. Each loop run corresponds to a time step, where the data is exchanged at the edges of the grid using MPI and the actual calculation of the finite difference scheme happens.

initialize_grid()
apply_boundary_conditions()

while(not_steady) { 
    exchange_data_using_mpi() 
    calculate_grid()
}

The computational simulation of heat transfer is a suitable candidate to demonstrate our workflow as it involves solving a simple differential equation that allows us to leverage the capabilities of HPC clusters due to its parallelizable nature.