# FD2D_HEAT_STEADY 2D Steady State Heat Equation in a Rectangle

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.

### Licensing:

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

### Languages:

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.

### Related Data and Programs:

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.

### List of Routines:

• FD2D_HEAT_STEADY solves the steady 2D heat equation.
• GET_UNIT returns a free FORTRAN unit number.
• INTERIOR sets up the matrix and right hand side at interior nodes.
• R8MAT_FS factors and solves a system with one right hand side.
• R8VEC_LINSPACE creates a vector of linearly spaced values.
• R8VEC_MESH_2D creates a 2D mesh from X and Y vectors.
• R8VEC_PRINT prints an R8VEC.
• TIMESTAMP prints the current YMDHMS date as a time stamp.

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

Last revised on 26 July 2013.