HEATED_PLATE
2D Steady State Heat Equation in a Rectangle


HEATED_PLATE is a FORTRAN77 program which solves the steady state heat equation in a 2D rectangular region, and is intended as a starting point for implementing an OpenMP parallel version.

The final estimate of the solution is written to a file in a format suitable for display by GRID_TO_BMP.

The sequential version of this program needs approximately 18/epsilon iterations to complete.

The physical region, and the boundary conditions, are suggested by this diagram:

                   W = 0
             +------------------+
             |                  |
    W = 100  |                  | W = 100
             |                  |
             +------------------+
                   W = 100
      

The region is covered with a grid of M by N nodes, and an N by N array W is used to record the temperature. The correspondence between array indices and locations in the region is suggested by giving the indices of the four corners:

                  I = 0
          [0][0]-------------[0][N-1]
             |                  |
      J = 0  |                  |  J = N-1
             |                  |
        [M-1][0]-----------[M-1][N-1]
                  I = M-1
      

The steady state solution to the discrete heat equation satisfies the following condition at an interior grid point:

W[Central] = (1/4) * ( W[North] + W[South] + W[East] + W[West] )
where "Central" is the index of the grid point, "North" is the index of its immediate neighbor to the "north", and so on.

Given an approximate solution of the steady state heat equation, a "better" solution is given by replacing each interior point by the average of its 4 neighbors - in other words, by using the condition as an ASSIGNMENT statement:

W[Central] <= (1/4) * ( W[North] + W[South] + W[East] + W[West] )

If this process is repeated often enough, the difference between successive estimates of the solution will go to zero.

This program carries out such an iteration, using a tolerance specified by the user, and writes the final estimate of the solution to a file that can be used for graphic processing.

Usage:

heated_plate epsilon output_file
where

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages:

HEATED_PLATE is available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version and a MATLAB version.

Related Data and Programs:

FD1D_HEAT_STEADY, a FORTRAN77 program which uses the finite difference method to solve the 1D Time Dependent Heat Equations.

FD1D_PLOT, a MATLAB program which plots the output from the FD1D program;

FD2D_HEAT_STEADY, a FORTRAN77 program which uses the finite difference method (FDM) to solve the steady (time independent) heat equation in 2D.

FEM1D_HEAT, a MATLAB program which uses the finite element method to solve the 1D Time Dependent Heat Equations.

FEM2D_HEAT, a FORTRAN90 program which solves the 2D time dependent heat equation on the unit square.

GRID_TO_BMP, a C++ program which reads a text file of data on a rectangular grid and creates a BMP file containing a color image of the data.

HEAT_MPI, a FORTRAN77 program which solves the 1D Time Dependent Heat Equation using MPI.

HEATED_PLATE_OPENMP, a FORTRAN77 program which solves the steady (time independent) heat equation in a 2D rectangular region, using OpenMP to run in parallel.

MD, a FORTRAN77 program which carries out a molecular dynamics simulation, and is intended as a starting point for implementing an OpenMP parallel version.

MXM_SERIAL, a FORTRAN77 program which sets up a matrix multiplication problem A=B*C, intended as a starting point for implementing a parallel version.

POISSON_SERIAL, a FORTRAN77 program which computes an approximate solution to the Poisson equation in a rectangle, and is intended as the starting point for the creation of a parallel version.

PRIME_SERIAL, a FORTRAN77 program which counts the number of primes between 1 and N, intended as a starting point for the creation of a parallel version.

QUAD_SERIAL, a FORTRAN77 program which approximates an integral using a quadrature rule, and is intended as a starting point for parallelization exercises.

SEARCH_SERIAL, a FORTRAN77 program which searches the integers from A to B for a value J such that F(J) = C. this version of the program is intended as a starting point for a parallel approach.

STOCHASTIC_HEAT2D, a FORTRAN77 program which implements a finite difference method (FDM) for the steady (time independent) 2D heat equation, with a stochastic heat diffusivity coefficient, using gnuplot to illustrate the results.

Reference:

  1. Michael Quinn,
    Parallel Programming in C with MPI and OpenMP,
    McGraw-Hill, 2004,
    ISBN13: 978-0071232654,
    LC: QA76.73.C15.Q55.

Source Code:

Examples and Tests:

The program has a built in grid of M = 500, N = 500. It is only necessary to alter these definitions and recompile in order to run the problem on a different grid. Here are the output files and solution files from two runs.

List of Routines:

You can go up one level to the FORTRAN77 source codes.


Last revised on 22 July 2008.