07-Jan-2022 19:53:28
fd1d_advection_lax_test():
MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2
Test fd1d_advection_lax().
FD1D_ADVECTION_LAX:
MATLAB version
Solve the constant-velocity advection equation in 1D,
du/dt = - c du/dx
over the interval:
0.0 <= x <= 1.0
with periodic boundary conditions, and
with a given initial condition
u(0,x) = (10x-4)^2 (6-10x)^2 for 0.4 <= x <= 0.6
= 0 elsewhere.
We modify the FTCS approach using the Lax method:
du/dt = (u(t+dt,x)-0.5*u(t,x-dx)-0.5*u(t,x+dx))/dt
du/dx = (u(t,x+dx)-u(t,x-dx))/2/dx
Number of nodes NX = 101
Number of time steps NT = 1000
Constant velocity C = 1
CFL condition: dt (0.001) <= dx / c (0.01)
FD1D_ADVECTION_LAX():
Normal end of execution.
Saving plot as "fd1d_advection_lax_test.png".
fd1d_advection_lax_test():
Normal end of execution.
07-Jan-2022 19:53:33