FD2D_HEAT_STEADY is a FORTRAN90 program which solves the steady state (time independent) heat equation in a 2D rectangular region.
The physical region, and the boundary conditions, are suggested by this diagram:
U = 0, Y = 1.0 +------------------+ | | U = 10 | | U = 100 X = 0.0 | | X = 2.0 +------------------+ U = 0, Y = 0.0
The region is covered with a grid of NX by NY nodes, and an NX by NY array U 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 = NY +------------------+ | | J = 1 | | J = NX | | +------------------+ I = 1
The form of the steady heat equation is
- d/dx K(x,y) du/dx - d/dy K(x,y) du/dy = F(x,y)where K(x,y) is the heat conductivity, and F(x,y) is a heat source term.
By using a simple finite difference approximation, this single equation can be replaced by NX * NY linear equations in NX * NY variables; each equation is associated with one of the nodes in the mesh. Nodes long the boundary generate boundary condition equations, while interior nodes generate equations that approximate the steady heat equation.
The linear system is sparse, and can easily be solved directly in MATLAB.
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
FD2D_HEAT_STEADY is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version.
FD1D_HEAT_STEADY, a FORTRAN90 program which uses the finite difference method to solve the 1D Time Independent Heat Equations.
FEM1D_HEAT_STEADY, a FORTRAN90 program which uses the finite element method to solve the 1D Time Independent Heat Equations.
FEM2D_HEAT, a FORTRAN90 program which solves the 2D time dependent heat equation on the unit square.
HEATED_PLATE, a FORTRAN90 program which solves the steady state heat equation in a 2D rectangular region, and is intended as a starting point for a parallel version.
You can go up one level to the FORTRAN90 source codes.