epsR = pR / rhoR / (gamma - 1)
qL = numpy.array([rhoL, 0, vyL, vzL, epsL, Bx, ByL, BzL, 0, 0, 0, 0, 0])
qR = numpy.array([rhoR, 0, vyR, vzR, epsR, Bx, ByR, BzR, 0, 0, 0, 0, 0])

sigma_s = [0, 10, 10**2, 10**3, 10**6]  # Can even do 10^9 now
Bys = []
for sigma in sigma_s:
    model = sr_rmhd.sr_rmhd_gamma_law(initial_data=sr_rmhd.initial_riemann(
        qL, qR),
                                      gamma=gamma,
                                      sigma=sigma)
    fast_source = model.relaxation_source()

    sim = simulation(model,
                     interval,
                     fvs_method(2),
                     imex222(fast_source),
                     outflow,
                     cfl=0.25)
    sim.evolve(0.4)
    print("sigma={}".format(sigma))
    sim.plot_system()
    pyplot.show()
    Bys.append(sim.cons[6, :].copy())
fig = pyplot.figure()
ax = fig.add_subplot(111)
ax.set_prop_cycle=cycler('color', ['red','green','blue','yellow','cyan']) + \
                  cycler('linestyle', ['-', '--', '-.', ':', '--'])
for sigma, By in zip(sigma_s, Bys):
    ax.plot(sim.coordinates, By, label=r"$\sigma={}$".format(sigma))
ax.set_xlabel(r"$x$")
Ngz = 3
Npoints = 800
L = 0.5
interval = grid([-L, L], Npoints, Ngz)

rhoL = 1
pL = 5
rhoR = 0.9
pR = 5.3
vyL = 0.3
vyR = 0
vzL = 0.4
vzR = 0
Bx = 1
ByL = 6
ByR = 5
BzL = 2
BzR = 2
gamma = 5/3
epsL = pL / rhoL / (gamma - 1)
epsR = pR / rhoR / (gamma - 1)
qL = numpy.array([rhoL, 0, vyL, vzL, epsL, Bx , ByL , BzL ])
qR = numpy.array([rhoR, 0, vyR, vzR, epsR, Bx , ByR , BzR ])
model = sr_mhd.sr_mhd_gamma_law(initial_data = sr_mhd.initial_riemann(qL, qR), gamma=gamma)

sim = simulation(model, interval, fvs_method(2), rk3, outflow, cfl=0.5)
sim.evolve(0.4)
sim.plot_system()
pyplot.show()
Ngz = 4
Npoints = 100
tau = 1
L = 10
interval = grid([0, L], Npoints, Ngz)

# Initial data. (Mis)use RP for trivial constant data
rho_init = 34.37746770
v_init = 18
p_init = 1589.2685472  # Not actually used, but in the paper
T_init = 43.0351225511  # Hand calculation, works only for default values
eps_init = T_init / (5 / 3 - 1)
E_init = rho_init * (v_init**2 / 2 + eps_init)
qL = numpy.array([rho_init, v_init, eps_init])
qR = numpy.array([rho_init, v_init, eps_init])
model = euler_relaxation.euler_relaxation(
    initial_data=euler_relaxation.initial_riemann(qL, qR))
slow_source = model.source()
fast_source = model.relaxation_source(tau)

sim = simulation(model,
                 interval,
                 fvs_method(2, slow_source),
                 imex222(fast_source),
                 outflow_reflect_right,
                 cfl=0.25)
sim.evolve(0.035)
sim.plot_system()
pyplot.show()