Hyperbolic equations 1

$$\frac{\partial f}{\partial t} + u\frac{\partial f}{\partial x} = 0.$$ $$f(x,t) = f_0(x-ut),$$

where $f_0(x)$ is the initial $f$ profile. That is, we just shift the domain. This is consistent with this PDE being a wave equation, where the solution advects across the domain without changing shape.

Note

$$\frac{\partial^2f}{\partial^2 t} = u^2\frac{\partial^2f}{\partial^2 x}.$$ $$f_t + ug_x = 0 \xrightarrow{\partial/\partial t} f_{tt} + ug_{xt} = 0$$$$g_t + uf_x = 0 \xrightarrow[*u,\text{ swap xt order}]{\partial/\partial x} ug_{tx} + u^2f_{xx} = 0$$ $$f_{tt} - u^2f_{xx} = 0.$$

Methods

FTCS

$$f_t + uf_x = 0,$$$$\frac{f_i^{n+1}-f_i^n}{\Delta t} + u\frac{f_{i-1}^n-f_{i+1}^n}{2\Delta x} = 0,$$$$f_i^{n+1} = f_i^n - \frac{c}{2}(f_{i+1}^n-f_{i-1}^n).$$
    *     O     *
    
    O     O     O

Lax

$$f_i^{n+1} = \frac{1}{2}(f_{i-1}^n+f_{i+1}^n) - \frac{u}{2}(f_{i+1}^n-f_{i-1}^n).$$
    *     O     *
    
    O     *     O

Lax Wendroff

$$f_t + uf_x = 0.$$ $$\frac{f_i^{n+1}-f_i^n}{\Delta t} + \frac{c}{2\Delta t}(f_{i-1}^n-f_{i+1}^n) = 0.$$ $$ f_i^{n+1} = f_i^n + \Delta t f_t + \frac{1}{2}\Delta t^2f_{tt} + \ldots,$$

$$ f_{i-1}^{n} = f_i^n - \Delta x f_x + \frac{1}{2}\Delta x^2f_{xx} + \ldots,$$

$$ f_{i+1}^{n} = f_i^n + \Delta x f_x + \frac{1}{2}\Delta x^2f_{xx} + \ldots,$$ $$f_t + uf_x = -\frac{1}{2}\Delta tf_{tt} + (\text{higher order terms}).$$ $$\frac{\partial}{\partial t}(f_t = -uf_x)\rightarrow f_{tt},$$$$=-uf_{tx}=-u(f_t)_x,$$$$=u^2f_{xx}$$ $$f_t + uf_x = \underbrace{-\frac{1}{2}\Delta t u^2f_{xx}}_{\text{error term}}.$$ $$\frac{f_i^{n+1}-f_i^n}{\Delta t} + \frac{c}{2\Delta t}(f_{i+1}^n-f_{i-1}^n) = \frac{1}{2}\Delta tu^2f_{xx}.$$ $$f_i^{n+1} = f_i^n - \frac{c}{2}(f_{i+1}^n-f_{i-1}^n) + \frac{1}{2}c^2(f_{i-1}^n - 2f_i^n + f_{i+1}^n).$$
    *     O     *
    
    O     O     O

Note

Question

MacCormack

$$\frac{\partial f}{\partial t} = -u\frac{\partial f}{\partial x} = \text{RHS} = F.$$$$\partial f = F\partial t \xrightarrow{\int} f_i^{n+1}-f_i^n = \int Fdt = \overline{F}dt,$$

where

$$\overline{F} = \frac{1}{\Delta t}\int_t^{t+\Delta t}Fdt.$$
    O     O     *
    
    *     O     O

Upwind method

    *     O     *
    
    O     O     *

Second order upwind

$$f_i^{n+1} = f_i^n - c(f_i^n - f_{i-1}^n) - \frac{c(1-c)}{2}(f_i^n - 2f_{i-1}^n + f_{i-2}^n).$$
    *     *     O     *
    
    O     O     O     *

BTCS

$$\frac{f_i^{n+1}-f_i^n}{\Delta t} + \frac{u}{2\Delta x}(f_{i-1}^{n+1}-f_{i-1}^{n+1}) = 0.$$
    O     O     O
   
    *     O     *

Methods Summary

Method Recommend $\mathcal{O}(\Delta t)$ $\mathcal{O}(\Delta x)$ Approach Stability Comment
FTCS X 1 2 direct, forward in time, central in space NO doesn’t work
Lax X 1 2 average $f_i^n$ $c\le 1$ inconsistent
Lax Wendroff okay 2 2 fix low order error $f_{tt}$ term $c\le 1$ hard for nonlinear, systems, multi-D
MacCormack good 2 2 time adv. with avg. RHS slope: $c\le 1$ good for nonlinear, systems, multi-D
Upwind poor 1 1 very diffusive $c\le 1$ diffusive, low order
2nd Order Upwind okay 2 2 3 point stencil $c\le 2$ oscillatory
BTCS poor 1 2 implicit $c\le 2$ unphysical info. speed