Skip to content

vaishnu7/computational_fluid_dynamics_assignment

Repository files navigation

Computational Fluid Dynamics Assignment

Question:

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

Answers for Initial condition (a):

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; Screenshot (1518) When N = 50; Screenshot (1522)

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; Screenshot (1523) When N = 50; Screenshot (1519)

Comments on obtained results:

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.

Answers for Initial condition (b):

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; Screenshot (1524) When N = 50; Screenshot (1525)

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; Screenshot (1527) When N = 50; Screenshot (1528)

Comments on obtained results:

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.

About

CIR-Scheme and Lax-Wendroff Scheme Applications

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages