r: right hand side of inviscid Burgers equation
function rhs(nx,dx,u,r)
uL = Array{Float64}(undef,nx+1)
uR = Array{Float64}(undef,nx+1)
fL = Array{Float64}(undef,nx+1)
fR = Array{Float64}(undef,nx+1)
f = Array{Float64}(undef,nx+1)
uL = wenoL(nx,u) # construct left state
```

```
uR = wenoR(nx,u) # construct right~state
fluxes(nx,uL,fL) # compute flux for left state
fluxes(nx,uR,fR) # compute flux for right~state
rusanov(nx,u,uL,uR,f,fL,fR) # compute Riemann solver (flux at interface)
for i = 1:nx
r[i] = -(f[i+1] - f[i])/dx
end
end
function rusanov(nx,u,uL,uR,f,fL,fR)
ps = Array{Float64}(undef,nx+1) # propagation speed
for i = 2:nx
ps[i] = max(abs(u[i]), abs(u[i-1]))
end
ps[1] = max(abs(u[1]), abs(u[nx])) # left boundary
ps[nx+1] = max(abs(u[1]), abs(u[nx])) # right~boundary