# FEM1D_HEAT_STEADY Finite Element Method, 1D, Steady State Heat Equation

FEM1D_HEAT_STEADY is a C program which applies the finite element method, with piecewise linear elements, to solve the steady state heat equation in one spatial dimension.

The finite element method is used with piecewise linear elements.

The steady state heat equation that is to be solved has the form:

```        - d/dx ( k(x) * du/dx ) = f(x)
```
in the interval A < x < B. The functions k(x) and f(x) are given.

Boundary conditions are applied at the endpoints, and in this case, these are assumed to have the form:

```        u(A) = UA;
u(B) = UB.
```

To compute a finite element approximation, a set of N equally spaced nodes is defined from A to B, a set of piecewise linear basis functions is set up, with one basis function associated with each node, and then the differential equation is multiplied by each basis function, and integration by parts is used to simplify the integrand.

A simple two point Gauss quadrature formula is used to estimate the resulting integrals over each interval.

### Usage:

call fem1d_heat_steady ( n, a, b, ua, ub, k, f, x, u )
where
• n is the number of equally spaced nodes.
• a, b are the left and right endpoints.
• ua, ub are the prescribed values of U at the endpoints;
• k is the function which evaluates k(x);
• f is the function which evaluates f(x).
• x is the input vector of n nodes, with x(1) = a, x(n) = b.
• u is the output vector containing the estimated solution value at the nodes.

### Licensing:

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

### Languages:

FEM1D_HEAT_STEADY 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 C program which applies the finite difference method to the steady state heat equation in one spatial dimension.

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

FEM1D, a data directory which contains examples of 1D FEM files, three text files that describe a 1D finite element model;

FEM1D, a C program which applies the finite element method to a linear two point boundary value problem in a 1D region.

FEM1D_BVP_LINEAR, a C program which applies the finite element method to a linear two point boundary value problem (BVP) in a 1D region, using piecewise linear elements.

STOCHASTIC_HEAT2D, a C 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. Dianne O'Leary,
Finite Differences and Finite Elements: Getting to Know You,
Computing in Science and Engineering,
Volume 7, Number 3, May/June 2005.
2. Dianne O'Leary,
Scientific Computing with Case Studies,
SIAM, 2008,
ISBN13: 978-0-898716-66-5,
LC: QA401.O44.
3. Hans Rudolf Schwarz,
Finite Element Methods,
Academic Press, 1988,
ISBN: 0126330107,
LC: TA347.F5.S3313..
4. Gilbert Strang, George Fix,
An Analysis of the Finite Element Method,
Cambridge, 1973,
ISBN: 096140888X,
LC: TA335.S77.
5. Olgierd Zienkiewicz,
The Finite Element Method,
Sixth Edition,
Butterworth-Heinemann, 2005,
ISBN: 0750663200,
LC: TA640.2.Z54

### List of Routines:

• FEM1D_HEAT_STEADY solves the steady 1D heat equation with finite elements.
• I4VEC_ZERO_NEW creates and zeroes an I4VEC.
• R8_ABS returns the absolute value of an R8.
• R8MAT_SOLVE2 computes the solution of an N by N linear system.
• R8MAT_ZERO_NEW returns a new zeroed R8MAT.
• R8VEC_EVEN returns an R8VEC of values evenly spaced between ALO and AHI.
• R8VEC_ZERO_NEW creates and zeroes an R8VEC.
• TIMESTAMP prints the current YMDHMS date as a time stamp.

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

Last revised on 09 April 2011.