periodicity
i=1
ps[i] = max(abs(u[n-1]), abs(u[n]), abs(u[i]), abs(u[i+1]), abs(u[i+2]))
i=2
ps[i] = max(abs(u[n]), abs(u[i-1]), abs(u[i]), abs(u[i+1]), abs(u[i+2]))
i = n-1
ps[i] = max(abs(u[i-2]), abs(u[i-1]), abs(u[i]), abs(u[i+1]), abs(u[1]))
i=n
ps[i] = max(abs(u[i-2]), abs(u[i-1]), abs(u[i]), abs(u[1]), abs(u[2]))
end
```
#### *4.2. Riemann Solver: Rusanov Scheme*

Another approach to computing the nonlinear term in the inviscid Burgers equation is to use Riemann solvers. Riemann solvers are used for accurate and efficient simulations of Euler equations along with higher-order WENO schemes [27,28]. In this method, first, we reconstruct the left and right side fluxes at the interface similar to the inviscid Burgers equation in non-conservative form. Once we have *f <sup>L</sup> <sup>i</sup>*+1/2 and *<sup>f</sup> <sup>R</sup> <sup>i</sup>*+1/2 reconstructed, we use Riemann solvers to compute the fluxes at the interface. We follow the same procedure discussed in Section 3.1 to reconstruct the fluxes at the interface. We can also use CRWENO-5 scheme presented in Section 3.2 to determine the fluxes.

✝ ✆

We use a simple Rusanov scheme as the Riemann solver [29]. The Rusanov scheme uses maximum local wave propagation speed to compute the flux as follows

$$f\_{i+1/2} = \frac{1}{2} (f\_{i+1/2}^L + f\_{i+1/2}^R) - \frac{c\_{i+1/2}}{2} (u\_{i+1/2}^L - u\_{i+1/2}^R),\tag{59}$$

where *f <sup>L</sup>* is the flux component using the right reconstructed state *f <sup>L</sup> <sup>i</sup>*+1/2 = *<sup>f</sup>*(*u<sup>L</sup> <sup>i</sup>*+1/2), and *<sup>f</sup> <sup>R</sup>* is the flux component using the right reconstructed state *f <sup>R</sup> <sup>i</sup>*+1/2 = *<sup>f</sup>*(*u<sup>R</sup> <sup>i</sup>*+1/2). Here, *ci*<sup>+</sup>1/2 is the local wave propagation speed which is obtained by taking the maximum absolute value of the eigenvalues corresponding to the Jacobian, *<sup>∂</sup> <sup>f</sup> <sup>∂</sup><sup>u</sup>* = *u*, between cells *i* and *i* + 1 can be obtained as

$$\mathcal{L}\_{i+1/2} = \max(|u\_i|, |u\_{i-1}|),\tag{60}$$

or in a wider stencil as shown in Equation (55). The implementation of Riemann solver with Rusanov scheme for inviscid Burgers equation is given in Listing 13. The implementation of state reconstruction and weight computation in Julia is similar to Listings 6 and 8. Figure 11 shows the evolution of shock for the sine wave. We use the same parameters for the spatial and temporal discretization of the inviscid Burgers equation as used for the non-conservative form in Section 3.

**Listing 13.** Implementation of Julia function to calculate the right hand side of inviscid Burgers equation using Riemann solver based on Rusanov scheme. ✞ ☎

```