Advection¶
The one-dimensional equation describing the advection of field \(f\) is
where \(v_x\) is the velocity. The field \(f\) can be many different things, for example: topography, chemical concentration, temperature, etc. Despite its very simple appearance, its numerical solutions often cause some (or a lot of) trouble.
Exercise
Discretize equation (1) with forward difference in time, and
- forward,
- central,
- backward difference in space.
Terminology
- Upwind advection scheme approximates the change in the function value by using the function gradient windward, on the side of the “incoming” flux.
- Downwind advection scheme does the exact opposite and uses the gradient leeward, on the opposite side from the incoming flux.
The amount of diffusion is proportional to the amount of time steps taken.
Black line: Original field; dashed black line: advected field at next time step (exact solution); dashed red line: advected field at next time step (numerical solution).
Exercise
- What will happen if \(\frac{v_x\Delta t}{\Delta x} > 1\)?
- Replace the upwind approximation used in Fig Fig. 10 with downwind approximation. How does the simplified expression for \(f_n^{i+1}\) change? How would this change the final advected field?
Exercise
Let’s solve the 1D advection equation with finite differences. For testing purposes we will advect a simple step function \(f\):
The advection velocity \(v_x=1\) will be positive, i.e. in direction of the \(x\) axis. We will run the model for 8 (seconds, in model time).
Use the following upwind discretization of the advection equation:
- Rearrange the discretized equation so that you get an expression for the function value of the next time step
- How many boundary conditions do you need? What are those?
- Create your python script: Either start one from scratch using a provided template (advection_upwind_template.py) or use advection_upwind.py where you need to write the missing line within the for loops.
- Once your code is working, experiment with different combinations of \(\Delta x\), \(\Delta t\) and \(v_x\) to see how they affect the solution.