Before proceeding further, please, take a look at Solving the 1D Advection Equation — Numerical Discretization — Leapfrog Approach and Solving the 1D Advection Equation — Python Implementation . The simulation parameters are the same as those for the Python version: The space-time discretization is performed on the host…