Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need to write matlab or python code to solve this problem Question 1 - Linear Advection (10 Marks) The linear advection equation is at tz
Need to write matlab or python code to solve this problem Question 1 - Linear Advection (10 Marks) The linear advection equation is at tz = 0), ta where a is the advection velocity, u is a scalar, x is the spatial coordinate, and t is time. As derived in class, one suitable scheme is 1=0, 1 where At is the time step size, Ar is the grid spacing, and u is the solution at node i and time level t. Write a computer code using this finite difference scheme to advance the lincar advection cquation to a final time T = 1 on a periodic domain of length L = 1, using advection velocity a = 1, grid spacings Ar = 1/10, 1/20,1/40, 1/80, 1/160, corresponding time steps of size At = 1/20,1/40, 1/80,1/160, 1/320, and the initial condition uo = sin(27c). (a) Create a single plot showing the exact solution (identical to the initial condition in this case) and the final solution for each level of grid refinement. Discuss the behaviour as you refine the grid. (b) Create an error table showing the error norm E1 = , Ui - Weil/N for each value of Ax, where ue is the exact solution (c) Create a Log-Log plot of El vs. Ar. Comment on the slope of this line with respect to the expected order of accuracy. Need to write matlab or python code to solve this problem Question 1 - Linear Advection (10 Marks) The linear advection equation is at tz = 0), ta where a is the advection velocity, u is a scalar, x is the spatial coordinate, and t is time. As derived in class, one suitable scheme is 1=0, 1 where At is the time step size, Ar is the grid spacing, and u is the solution at node i and time level t. Write a computer code using this finite difference scheme to advance the lincar advection cquation to a final time T = 1 on a periodic domain of length L = 1, using advection velocity a = 1, grid spacings Ar = 1/10, 1/20,1/40, 1/80, 1/160, corresponding time steps of size At = 1/20,1/40, 1/80,1/160, 1/320, and the initial condition uo = sin(27c). (a) Create a single plot showing the exact solution (identical to the initial condition in this case) and the final solution for each level of grid refinement. Discuss the behaviour as you refine the grid. (b) Create an error table showing the error norm E1 = , Ui - Weil/N for each value of Ax, where ue is the exact solution (c) Create a Log-Log plot of El vs. Ar. Comment on the slope of this line with respect to the expected order of accuracy
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started