u_t + u_x = 0

Write a code based on upwinding:

u_{i,j+1} = u_{i,j} - dt/dx (u_{i,j}-u_{i-1,j})

and a code based on downwinding:

u_{i,j+1} = u_{i,j} - dt/dx (u_{i+1,j}-u_{i,j})

You know that the upwinding code is stable if dt/dx <= 1. And that the downwinding code is unstable no matter what.

Choose smooth initial data and check that your upwinding code is O(dt) in time and O(dx) in space. (Remember that you know the exact solution for this problem.)

Choose step-function initial data and find the order of convergence in time and space. (Is it still O(dt) and O(dx)? If not, why not? And what is it?)

For the upwinding code, demonstrate that if you violate the CFL condition the computation becomes unstable.

Demonstrate that the downwinding code is unstable by checking compuations that were stable for the upwinding code. Demonstrate this in two ways. First of all, plot solutions and show that they're oscillating and looking bad. Secondly, modify your code so that it also gives the power spectrum of your solution and show what's happening to your power spectrum as time passes.

Demonstrate that the upwinding code preserves the monotonicity of the solution.

u_t + u_x = 0

Write a code based on the Lax-Wendroff method:

u_{i,j+1} = u_{i,j} - dt/(2*dx) (u_{i+1,j}-u_{i-1,j}) + dt^2/(2*dx^2) (u_{i+1,j}-2 u_{i,j} + u_{i-1,j})

Choose smooth initial data and check that your Lax-Wendroff code is O(dt^2) in time and O(dx^2) in space. (Remember that you know the exact solution for this problem.)

Choose step-function initial data and find the order of convergence in time and space. (Is it still O(dt^2) and O(dx^2)? If not, why not? And what is it?)

Demonstrate that if you violate the CFL condition the computation becomes unstable. Demonstrate this in two ways. First of all, plot solutions and show that they're oscillating and looking bad. Secondly, modify your code so that it also gives the power spectrum of your solution and show what's happening to your power spectrum as time passes.

Demonstrate that the Lax-Wendroff code breaks the monotonicity of the solution.

u_{i,j+1} = u_{i,j} - c dt/(2*dx) (u_{i+1,j} - u_{i-1,j})

What does the modified equation tell you about this method?

u_{i,j+1} = u_{i,j} - dt/dx (u_{i,j}-u_{i-1,j})

then u is a good approximation of the solution v to the PDE

v_t + c v_x = c dx/2 (1 - dt/dx c) v_xx

Write a code that find a numerical approximation of the modified equation. (Take one of the heat equation codes and add an advective term.)

Now choose dt and dx and find the approximate solution to u_t + c u_x = 0 using your upwinding code. Use your values of dt and dx to find the diffusion for the modified equation and compute the solution to the modified eqation using the code you just wrote.

Fix a time and plot the exact solution to u_t + c u_x = 0, the approximate solution u, and the approximate solution v. What do you see?