# HEAT_ONED Finite Element Solution of the Time Dependent 1D Heat Equation using Implicit Time Stepping

HEAT_ONED is a MATLAB program which solves the time-dependent 1D heat equation, using the finite element method in space, and the backward Euler method in time, by Jeff Borggaard.

The procedure discretizes space using the finite element method, and solves the time dependence with the method of lines, using the backward Euler method to approximate the time derivative.

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)
```

The spatial derivatives are approximated using the finite element method, with piecewise linear or quadratic elements.

The solver applies an implicit backward Euler approximation to the first derivative in time.

### Languages:

HEAT_ONED is available in a MATLAB version.

### Related Data and Programs:

FD1D_HEAT_IMPLICIT, a MATLAB library which uses the finite difference method and implicit time stepping to solve the time dependent heat equation in 1D.

FD1D_HEAT_STEADY, a MATLAB program which uses the finite difference method to solve the steady (time independent) heat equation in 1D.

FEM1D_HEAT_STEADY, a MATLAB program which uses the finite element method to solve the steady (time independent) heat equation in 1D.

Jeff Borggaard

### Source Code:

• compute_matricesb.m, computes finite element matrices for the heat equation.
• heat_oned.m, controls the solution of the time-dependent 1D heat equation.
• heat_oned_setup.m, sets up the time-dependent 1D heat equation.
• oned_bilinear.m integrates kernel(x) * basis function(x) * test function(x).
• oned_f_int.m computes the integral of f(x) times a test function.
• oned_gauss.m sets Gauss integration points on (-1,1).
• oned_mesh.m generates a mesh with a prescribed density. This routine returns elements of the same type as xb, e_connb (linear or quadratic).
• oned_shape.m computes test functions and derivatives for a Lagrange C0 element given element coordinates and Gauss points. (assumes all nodes are uniformly distributed in the element.)
• timestamp.m, prints the YMDHMS date as a timestamp;
• u_function.m, evaluates the time dependent boundary conditions.

### Examples and Tests:

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

Last revised on 21 December 2012.