= Solution
Use the <forward Euler method> in time and evaluate both spatial <finite difference operators> at the old time level:
$$
\boxed{\frac{U_j^{m+1}-U_j^m}{\Delta t}+\frac{U_{j+1}^{m}-U_{j-1}^{m}}{2\Delta x}
=a\frac{U_{j+1}^{m}-2U_j^{m}+U_{j-1}^{m}}{(\Delta x)^2},\qquad U_j^0=u_0(j\Delta x).}
$$
With $\nu=\Delta t/\Delta x$ and $\mu=\Delta t/(\Delta x)^2$, the explicit update is
$$
\boxed{U_j^{m+1}=(a\mu+\nu/2)U_{j-1}^m+(1-2a\mu)U_j^m+(a\mu-\nu/2)U_{j+1}^m.}
$$
Every value on the new time level is computed directly from three old values. The sum of the stencil weights is one, as required to preserve constant solutions of the <advection-diffusion equation>.
Back to article page