10. Numerical Schemes

We will consider some finite difference numerical schemes for the solution of the advection-diffusion equation with source term $S(C,t)$:

\begin{displaymath}
{\partial C\over \partial t}+{\partial\over \partial x}(uC)+...
...lon _z{\partial C\over \partial z}\right )
+S(C,t).\eqno{(62)}
\end{displaymath}

10.1 Source Terms

The equation

\begin{displaymath}
{\partial C\over \partial t}=S(C,t)\eqno{(63)}
\end{displaymath}

can be approximated by

\begin{displaymath}
C^{n+1}=C^n+\Delta tS(C^n,t^n)\eqno{(64)}
\end{displaymath}

where $C^n$ denotes $C$ evaluated at time $t^n=n\Delta t$. Eq. (64) is not usually practical because stability is only achieved with severe restrictions on the time step. Eq. (64) is an explicit scheme. The corresponding implicit scheme is

\begin{displaymath}
C^{n+1}=C^n+\Delta tS(C^{n+1},t^{n+1}).\eqno{(65)}
\end{displaymath}

This is unconditionally stable but if $S$ is a nonlinear function, Eq. (65) requires solution of a system of nonlinear equations. Semi-implicit schemes are possible, such as

\begin{displaymath}
C^{n+1}=C^n+\Delta t [\xi S(C^{n+1},t^{n+1})+(1-\xi
)S(C^n,t^n)].\eqno{(66)}
\end{displaymath}

If $S$ is a linear function, then the scheme (66) with $\xi =0.5$ is unconditionally stable and is furthermore second order accurate in time, unlike (64) and (65) which are only first order accurate.

10.2 Advection Terms

Consider the simplified advection equation

\begin{displaymath}
{\partial C\over \partial t}+u{\partial C\over \partial
x}=0\eqno{(67)}
\end{displaymath}

where $u$ is assumed to be constant. The simplest scheme is

\begin{displaymath}
{C^{n+1}_i-C^n_i\over \Delta t}=-u{C^n_{i+1}-C^n_{i-1}\over 2\Delta
x}\eqno{(68)}
\end{displaymath}

where $C^n_i$ denotes $C$ evaluated at $x_i$ and where $x_{i+1}-x_i=\Delta x$. Eq. (68) is unconditionally unstable and therefore useless. The Lax scheme is a modification of (68) in which $C^n_i$ is replaced by ${1\over 2}(C^n_{i+1}+C^n_{i-1})$:

\begin{displaymath}
{C^{n+1}_i-{1\over 2}(C^n_{i+1}+C^n_{i-1})\over \Delta t}=
-u{C^n_{i+1}-C^n_{i-1}\over 2\Delta x}.\eqno{(69)}
\end{displaymath}

This scheme is stable if the Courant-Friedrichs-Lewy (CFL) condition

\begin{displaymath}
{\vert u\vert\Delta t\over \Delta x}\le 1\eqno{(70)}
\end{displaymath}

is satisfied. However, it is only first order accurate in time. Another problem is that it is possible for $C$ to become negative. This problem is overcome in so-called upwind schemes:

\begin{displaymath}
{C^{n+1}_i-C^n_i\over \Delta t}=\left .\eqalign{
&-u{C^n_i-C...
...er \Delta x} \quad \hbox{for $u<0$}.\cr
}
\right\}
\eqno{(71)}
\end{displaymath}

This is stable if the CFL condition is satisfied but is only first order accurate in space. Use of the upwind scheme is equivalent to the introduction of a large artificial diffusion. A scheme which is explicit, second order accurate in space and time and is stable if the CFL condition is satisfied is the two-step Lax-Wendroff scheme:

\begin{displaymath}
\left .\eqalign{
C^{n+1}_i&=C^n_i-{u\Delta t\over \Delta x}\...
...r \Delta x}\left (C^n_{i+1}-C^n_i\right
).}\right\}\eqno{(72)}
\end{displaymath}

This scheme does however still allow negative values of $C$.

10.3 Diffusion Terms

Consider the simple, one-dimensional diffusion equation

\begin{displaymath}
{\partial C\over \partial t}={\partial\over \partial x}\left (\varepsilon
{\partial C\over \partial x}\right ).\eqno{(73)}
\end{displaymath}

For simplicity we will assume that the diffusivity $\varepsilon $ is constant. An explicit scheme which is first order accurate in time and second order accurate in space is

\begin{displaymath}
{C^{n+1}_i-C^n_i\over \Delta t}={\varepsilon \over (\Delta x)^2}
[C^n_{i+1}-2C^n_i+C^n_{i-1}].\eqno{(74)}
\end{displaymath}

This is stable if

\begin{displaymath}
{2\varepsilon \Delta t\over (\Delta x)^2}\le 1.\eqno{(75)}
\end{displaymath}

This usually requires a vast number of time steps for the effects of diffusion to become noticeable. The fully implicit scheme

\begin{displaymath}
{C^{n+1}_i-C^n_i\over \Delta t}={\varepsilon \over (\Delta x)^2}
[C^{n+1}_{i+1}-2C^{n+1}_i+C^{n+1}_{i-1}].\eqno{(76)}
\end{displaymath}

is unconditionally stable but it is necessary to solve a tridiagonal system of equations at each time step. If the average of Eq. (74) and (76) is taken we get the Crank-Nicholson scheme which is unconditionally stable and second order accurate in space and time.

If $\varepsilon $ is not constant, the above schemes can easily be generalised. For example, we can write

\begin{displaymath}
\eqalignno{
{\partial\over \partial x}\left (\varepsilon {\p...
...\varepsilon _{i-1/2}
(C_i-C_{i-1})\right ]&\cr
&=D_x.&(77)\cr}
\end{displaymath}

10.4 Operator Splitting

For multi-dimensional problems or problems in which there is advection and diffusion, many of the above methods can still be used if an operator splitting approach is used. For example, consider the one-dimensional advection-diffusion equation:

\begin{displaymath}
{\partial C\over \partial t}+u{\partial C\over \partial x}=
...
...(\varepsilon {\partial C\over \partial x}
\right ).\eqno{(78)}
\end{displaymath}

Now consider

\begin{displaymath}
\left .\eqalign{
{\partial C_1\over \partial t}&=-u{\partial...
...\over \partial x}
\right ),\cr
C&=C_1+C_2.}\right\}\eqno{(79)}
\end{displaymath}

By adding the first two equations in (79) we get Eq. (78) but we can step forward these two equations separately, thus using the techniques available for the solution of simpler equations.

As another example, consider the three-dimensional diffusion equation:

\begin{displaymath}
{\partial C\over \partial t}=
{\partial\over \partial x}\lef...
...arepsilon _z {\partial C\over \partial z}
\right ).\eqno{(80)}
\end{displaymath}

Using the notation in Eq. (77), we can solve

\begin{displaymath}
\left .\eqalign{
{C^{n+1/3}_i-C^n_i\over {1\over 3}\Delta
t}...
...
t}&=D^{n+2/3}_x+D^{n+2/3}_y+D^{n+1}_z.\cr}\right\}\eqno{(81)}
\end{displaymath}

Adding these equations gives a consistent representation of Eq. (80) which is second order accurate in space and time. This is an alternating-direction implicit (ADI) method.

back to syllabus