# FD1D_BVP Finite Difference Method 1D Boundary Value Problem

FD1D_BVP is a FORTRAN77 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 X(1) < x < X(N) 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(X(1)) = 0.0;
u(X(N)) = 0.0.
```

To compute a finite difference approximation, a set of n nodes is defined over the interval, 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 )
where
• n the number of 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 vector of n nodes, which may be nonuniformly spaced.
• u the output vector of n finite difference values.

### Languages:

FD1D_BVP 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:

BVPSOL, a FORTRAN77 library which solves highly nonlinear two point boundary value problems using a local linear solver (condensing algorithm) or a global sparse linear solver for the solution of the arising linear subproblems, by Deuflhard, Bader, Weimann.

FD1D_BURGERS_LAX, a FORTRAN77 program which applies the finite difference method and the Lax-Wendroff method to solve the non-viscous time-dependent Burgers equation in one spatial dimension.

FD1D_BURGERS_LEAP, a FORTRAN77 program which applies the finite difference method and the leapfrog approach to solve the non-viscous time-dependent Burgers equation in one spatial dimension.

FD1D_DISPLAY, a MATLAB program which reads a pair of files defining a 1D finite difference model, and plots the data.

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

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

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

FD1D_PREDATOR_PREY, a FORTRAN77 program which implements a finite difference algorithm for predator-prey system with spatial variation in 1D.

FD1D_PREDATOR_PREY_PLOT, a FORTRAN90 program which plots the output from the FD1D_PREDATOR_PREY program;

FD1D_WAVE, a FORTRAN77 program which applies the finite difference method to solve the time-dependent wave equation utt = c * uxx in one spatial dimension.

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

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

MUS, a FORTRAN77 library which implements the multiple shooting method for two point boundary value problems, for linear or nonlinear cases, by Robert Mattheij and G Staarink.

### 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,
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:

• FD1D_BVP solves a two point boundary value problem.
• GET_UNIT returns a free FORTRAN unit number.
• R83NP_FS factors and solves an R83NP system.
• R8MAT_WRITE writes an R8MAT file.
• R8VEC_EVEN returns an R8VEC of evenly spaced values.
• TIMESTAMP prints out the current YMDHMS date as a timestamp.

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

Last revised on 15 February 2011.