Consider 1-D Hyperbolic equation U_t + cU_x = 0 where U is scalar and 𝑐 is a constant wave speed (c > 0). Taking the computational domain 0 ≤ x ≤ 1, start with the following initial condition,
a) U (x,0) = sin(2πx)
b) U (x,0) = {(1 when x≤0.25 and 0 when x>0.25)}
Use Courant-Isaacson-Rees (CIR) method and Lax-Wendroff Scheme, advance the solutions by a distance equal to the half of the length of the computational domain with courant number λ=0.25,0.5,0.75,1.0 . Make plots of exact and computed solution for a given λ. Comment on the results based on the theoretical analysis
The code " CIR-scheme-initial1.m " is for CIR scheme when initial condition is U (x, 0) = sin(2πx), periodic boundary condition and when N = 100.
Graphs obtained for CIR-Scheme: When N = 100; When N = 50;
The code "LW-SCHEME-func1.m " is for Lax-Wendroff scheme when initial condition is U (x,0) = sin(2πx), periodic boundary condition and when N = 100.
Graphs obtained for Lax-Wendroff Scheme: When N = 100; When N = 50;
When the step size is lower, that is when N = 50, we see the graph deviates more than the exact solution. But when we increased N to 100, we are getting more accurate results. Similarly, for different lambda value or the Courant number we are getting solutions which are deviated from the exact solution. So, it is important to select the correct ratio value for dt/dx as well as more step size gives more accurate results. Now, coming to the type or error we can clearly see that while using CIR scheme we are getting smears in our graph which is the effect of numerical dissipation. In case of Lax-Wendroff scheme we are getting wiggle which is the effect of numerical dispersion.
The code " CIR-scheme-initial2.m " is for CIR scheme when initial condition is U(x,0) = (1 when x≤0.25 and 0 when x>0.25) when N = 100.
Graphs obtained for CIR-Scheme: When N = 100; When N = 50;
The code "LW-SCHEME-func2.m " is for Lax-Wendroff scheme for the second initial condition.
Graphs obtained for Lax-Wendroff scheme: When N = 100; When N = 50;
Coming to the type or error in linear initial condition, we can clearly see that while using CIR scheme we are getting smears in our graph. This is the effect of numerical dissipation which we have already seen when our initial condition was a function of sine. Dissipative errors depend on the sizes of the steps and therefore affect the accuracy of solution. In case of Lax-Wendroff scheme we are getting wiggles in our line graphs which is the effect of numerical dispersion. The Lax-Wendroff algorithm is second-order accurate, which is why some dispersion error is expected. The oscillatory behaviour of the solution for the smaller Courant number clearly indicates the errors developed in the solution. The amplitude of the solution remains the same (within small errors) unlike the amplitude in CIR Scheme.