fd2d_heat_steady


fd2d_heat_steady, a MATLAB code 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 MIT 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 MATLAB code which uses the finite difference method to solve the 1D Time Independent Heat Equations.

fd2d_heat_steady_test

fem1d_heat_steady, a MATLAB code which uses the finite element method to solve the 1D Time Independent Heat Equations.

fem2d_heat, a MATLAB code which solves the 2D time dependent heat equation on the unit square.

heated_plate, a MATLAB code which solves the steady state heat equation in a 2D rectangular region, and is intended as a starting point for a parallel version.

Source Code:


Last revised on 15 January 2019.