Linear 1-D Advection
1-D advection equation, where \(a\) represents the state of advection and \(u\) is the velocity of advection.
With initial condition, \(a(x,t = 0)\) and boundary condition, The solution to the equation has form:
FTCS Method
Consider first order approximation on the left but second order approximation on the right:
Rewriting it:
where C is the Courant Number.
Tip
For FTCS method, smaller C gives better answer. FTCS method is also unstable.
Stability Check
Stability check through Fourier Mode Discretization:
We substitute, use \(I\) for imaginary number.
Method is stable if:
For FTCS:
The magnitude is therefore:
Since its always \(\geq 1\), there is no way to make it stable.
Upwinding Method
Consider first order expansion on both sides instead of second order expansion on the rhs for FTCS method.
Or
If \(u > 0\), suggesting traveling from left to right, we choose upwinding, i.e. :
Rewriting:
Tip
Upwinidng method gives exact solution if \(C = 1\). Upwinding is also stable if \(C \leq 1\).
Ghost Cells/Ghost Points
Imagine have N points to describe a fluid from 0, 1, 2, … N. When we do the update for \(a[0]\), but we need information from \(a[-1]\), which is outside of the domain. We need to extend the domain past the boundary, by creating ghost points:
Boundary conditon describes what happens to the domain when you go outside of the scope.
Ghost points are used to implement boundary conditions, if periodic:
if outflow: