fd1d_advection_diffusion_steady, a MATLAB code which applies the finite difference method to solve the steady advection diffusion equation v*ux-k*uxx=0 in one spatial dimension, with constant velocity v and diffusivity k.

```        v du/dx - k d^2u/dx^2
```
over the interval:
```        0.0 <= x <= 1.0
```
with boundary conditions
```        u(0) = 0, u(1) = 1.
```

We do this by discretizing the interval [0,1] into NX nodes. We write the boundary conditions at the first and last nodes. At the i-th interior node, we replace derivatives by differences:

• du/dx = (u(x+dx)-u(x-dx))/2/dx
• d^2u/dx^2 = (u(x+dx)-2u(x)+u(x-dx))/dx/dx
This becomes a set of NX linear equations in the NX unknown values of U.

The exact solution to this differential equation is known:

```        u = ( 1 - exp ( r * x ) ) / ( 1 - exp ( r ) )
```
where r = v * l / k;

### Languages:

fd1d_advection_diffusion_steady is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version.

### Related Data and Programs:

fd1d_advection_ftcs, a MATLAB code which applies the finite difference method to solve the time-dependent advection equation ut = - c * ux in one spatial dimension, with a constant velocity, using the forward time, centered space (FTCS) difference method.

fd1d_advection_lax, a MATLAB code which applies the finite difference method to solve the time-dependent advection equation ut = - c * ux in one spatial dimension, with a constant velocity, using the Lax method to treat the time derivative.

fd1d_advection_lax_wendroff, a MATLAB code which applies the finite difference method to solve the time-dependent advection equation ut = - c * ux in one spatial dimension, with a constant velocity, using the Lax-Wendroff method to treat the time derivative.

### Reference:

1. Charles Hall, Thomas Porsching,
Numerical Analysis of Partial Differential Equations,
Prentice-Hall, 1990,
ISBN: 013626557X,
LC: QA374.H29.

### Source Code:

Last revised on 12 January 2019.