HEAT_MPI is a FORTRAN77 program which solves the 1D Time Dependent Heat Equation using MPI.
This program solves
dUdT - k * d2UdX2 = F(X,T)
over the interval [A,B] with boundary conditions
U(A,T) = UA(T),
U(B,T) = UB(T),
over the time interval [T0,T1] with initial conditions
U(X,T0) = U0(X)
To apply the finite difference method, we define a grid of points X(1) through X(N), and a grid of times T(1) through T(M). In the simplest case, both grids are evenly spaced. We denote by U(I,J) the approximate solution at spatial point X(I) and time T(J).
A second order finite difference can be used to approximate the second derivative in space, using the solution at three points equally separated in space.
A forward Euler approximation to the first derivative in time is used, which relates the value of the solution to its value at a short interval in the future.
Thus, at the spatial point X(I) and time T(J), the discretized differential equation defines a relationship between U(I-1,J), U(I,J), U(I+1,J) and the "future" value U(I,J+1). This relationship can be drawn symbolically as a four node stencil:
U(I,J+1)
|
|
U(I-1,J)-----U(I,J)--------U(I+1,J)
Since we are given the value of the solution at the initial time, we can use the stencil, plus the boundary condition information, to advance the solution to the next time step. Repeating this operation gives us an approximation to the solution at every point in the space-time grid.
To solve the 1D heat equation using MPI, we use a form of domain decomposition. Given P processors, we divided the interval [A,B] into P equal subintervals. Each processor can set up the stencil equations that define the solution almost independently. The exception is that every processor needs to receive a copy of the solution values determined for the nodes on its immediately left and right sides.
Thus, each processor uses MPI to send its leftmost solution value to its left neighbor, and its rightmost solution value to its rightmost neighbor. Of course, each processor must then also receive the corresponding information that its neighbors send to it. (However, the first and last processor only have one neighbor, and use boundary condition information to determine the behavior of the solution at the node which is not next to another processor's node.)
The naive way of setting up the information exchange works, but can be inefficient, since each processor sends a message and then waits for confirmation of receipt, which can't happen until some processor has moved to the "receive" stage, which only happens because the first or last processor doesn't have to receive information on a given step.
It is worth investigating how to improve the information exchange (an exercise for the reader!). The odd processors could SEND while the even processors RECEIVE for instance, guaranteeing that messages would not have to wait in a buffer.
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
FD1D_HEAT is a MATLAB program which uses the finite difference method to solve the 1D Time Dependent Heat Equations.
FEM1D_HEAT is a MATLAB program which uses the finite element method to solve the 1D Time Dependent Heat Equations.
HEAT_MPI is available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version.
MPI is a directory of FORTRAN77 examples which illustrate the use of the MPI application program interface for carrying out parallel computations in a distributed memory environment.
MPI_CONDOR is a directory of CONDOR scripts for running FORTRAN77 programs using MPI on the FSU cluster system.
MPI_ECLIPSE is a directory of LoadLeveler scripts for running FORTRAN77 programs using MPI on the Eclipse IBM SP at FSU.
MPI_INTRODUCTION is a one page introduction to MPI.
MPI_MORE_INFO contains a list of references, web sites, examples and tutorials on MPI.
MPI_STUBS is a FORTRAN77 library which supplies "stub" versions of MPI routines, allowing a user to compile, load, and possibly run an MPI program on a serial machine.
MPI_SYSX is a directory of PBS scripts which run FORTRAN77 programs using MPI on System X.
OPEN_MP is a directory of FORTRAN77 examples which illustrate the use of the OpenMP application program interface for carrying out parallel computations in a shared memory environment.
PETSC is a directory of FORTRAN77 programs which illustrate the use of PETSC, a scientific programming library for parallel programming, which requires MPI in order to run.
PLTMG_SINGLE is a FORTRAN77 program which implements the finite element method for solving partial differential equations; it can be compiled and run with the MPI library.
PTHREADS is a set of C examples which illustrate the use of the POSIX thread library to carry out parallel program execution.
QUAD_MPI is a FORTRAN77 program which approximates an integral using a quadrature rule, and carries out the computation in parallel using MPI.
SATISFIABILITY_MPI is a FORTRAN77 program which demonstrates, for a particular circuit, an exhaustive search for solutions of the circuit satisfiability problem, using MPI to carry out the calculation in parallel.
HEAT_MPI runs the program using MPI.
HEAT_MPI_STUBS runs the program on a single processor, using the MPI_STUBS library.
You can go up one level to the FORTRAN77 source codes.