This numerics lab is designed for the user to obtain a visual feeling for how certain algorithms operate in practice. The focus is on studying numerical approximations to the linear advection problem (df/dt + v df/dx = 0).
The Top Level control panel (Windows -> Open Control Panel by Name -> Top Level) gives you the following options: * number of cells to use (up to 100) * number of time steps to calculate * initial profile to be advected * width of the profile to be advected * non-linear switch * time marching algorithm * spatial differencing algorithm
There are five choices for time marching algorithms: Forward Euler computes the new function f_(n+1) = f_n + delta_t * F_n with F_n being the derivative operator evaluated at time n. This method is only accurate to first order in time. It is usually unstable unless it is coupled with an operator that contains diffusion explicitely. All the others are second order in time. The Adams-Bashforth and Predictor Corrector methods are unstable, but can be brought under control by use of a non-linear switch. The Leapfrog method is weakly unstable but has a unit amplitude of all modes. A version of it, Leapfrog-Trapezoidal, fixes the instability at the cost of a very slight amount of diffusion.
There are three choices of spatial differencing algorithms: Donor cell is first order in space, centered differences are of order 2,4,6,8, or 10, and the user can also define a differencing scheme by setting a vector. Your task is to design a scheme for the first derivative that can be used for pushing the profile around. The Vector box gives the option of picking coefficients to approximate df/dx = V_top f_(i-1) + V_middle f_i + V_bottom f_(i+1). Given three points there are three different ways: centered (f_(i+1)-f_(i-1))/2, left f_i-f_(i-1), or right f_(i+1)-f_i. Set the time marching to Forward Euler and try them out! Which one works, which ones are unstable?
General exploration: You will see the effects of various options on the numerical solution. First try the Donor cell and use Forward Euler time stepping or other methods. Do you like the results? Next go to centered difference and set the spatial order to 2. What happens for Forward Euler? Try the second order time scheme with the Square Wave and Gaussian profiles. Notch up the spatial order and see how it affects the solution. It is particularly interesting to observe how narrow a Gaussian can be advected without noticable error! Finally turn on the non-linear switch. The Square Wave probably works best with this. The parameter for the switch adjusts the amount of added diffusion. There is a minimum monotonic value called the Courant number, any value larger than it introduces more diffusion.