FD1D_BVP
Finite Difference Method, 1D, Boundary Value Problem


FD1D_BVP is a C program which applies the finite difference method to solve a two point boundary value problem in one spatial dimension.

The boundary value problem (BVP) that is to be solved has the form:

        - d/dx ( a(x) * du/dx ) + c(x) * u(x) = f(x)
      
in the interval 0 < x < 1. The functions a(x), c(x), and f(x) are given functions, and a formula for a'(x) is also available.

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

        u(0.0) = 0.0;
        u(1.0) = 0.0.
      

To compute a finite difference approximation, a set of n equally spaced nodes is defined from 0.0 to 1.0, and, at each interior node, a discretized version of the BVP is written, with u''(x) and u'(x) approximated by central differences.

Usage:

        call fd1d_bvp ( n, a, aprime, c, f, x, u )
      
n
the number of equally spaced nodes.
a
the function which evaluates a(x);
aprime
the function which evaluates a'(x);
c
the function which evaluates c(x);
f
the function which evaluates f(x).
x
the output vector of n equally spaced nodes.
u
the output vector of n finite difference values.

Licensing:

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

Related Data and Programs:

FD1D_BVP is available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version and a MATLAB version.

FD1D_HEAT_EXPLICIT is a C program which uses the finite difference method and explicit time stepping to solve the time dependent heat equation in 1D.

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

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

FEM1D_BVP_LINEAR is a C++ program which applies the finite element method, with piecewise linear elements, to a two point boundary value problem in one spatial dimension.

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

Source Code:

Examples and Tests:

List of Routines:

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


Last revised on 30 May 2009.