Project

One Dimensional Linear Convection

Wave Equation

`(deltau)/(deltat) + C (deltau)/(deltax) = 0`

Numerical solution to the wave equation

Assumptions

1. The domain length is L = 1m.

2. The initial velocity profile is a step function. It is equal to 2m/s between x= 0.1 and 0.3 and 1m/s everywhere else.

3. First order forward differencing for the time derivative. First order backwards differencing for the space term.

4. C = 1 and time step =0.01.

For the equation, that the accuracy depends on time step(dt) and spacing(dx), others being constant or defined. For the plots attached below dt is already defined as 0.01. Thus the solution accuracy will only be a function of dx.

Gridpoints n = 21 and dx = 0.05.

Accuracy is lost from the beginning. The final velocity profile is like the bell curve/sin wave with a peak of about 1.6 to 1.7.

Gridpoints n = 41 and dx = 0.025.

Compared to the previous solution, this shows improvement in the velocity profile. The final profile is still a flatter sin wave but with a peak closer to the actual value than before.

Gridpoints n = 81 and dx = 0.0125.

The peak velocity is indeed very close to the actual value, though the shape is lost. It is still a sin wave but with a flatter peak region. As noticed keeping dt and C the same and varying the dx to make it smaller, the accuracy of the solution is increased.

Gridpoints n = 161 and dx = 6.25e-3.

It is noticed that further decrease in dx beyond a particular value causes the solution to blow off. The peaks are not visible and the velocity profile is lost

-------------------------------------------------------------------------------------------------------------------

Study of Effect of time Step on Solution

Assumptions

1. Gridpoints n=81.

2. Time Step used are 1e-1, 1e-2, 1e-3, 1e-4.

3. Velocity Profile is compared at t = 0.4 seconds.

Below is a graph comparing the effect of time steps (seconds) on Solution time (milliseconds)

Solution time is least when C*dt/dx is closest to 1.

The graph below is a comparison between velocity profiles obtained for various time steps.

For time step 1e-1 due to the value of C*dt/dx being greater than 1, the solution blows off.

The time step 1e-2 is the closest in terms of accuracy to the velocity profile. But due to the mathematical error, the shape is lost.

The time step 1e-3 and 1e-4 are very close in accuracy to each other. But 1e-4 takes the longest time to calculate.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.