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$") ax.set_ylabel(r"$B_y$")
m_p = 1. m_e = 1. gamma = 4.0 / 3.0 model_mf = sr_mf.sr_mf_gamma_law(initial_data=sr_mf.initial_alfven( gamma=gamma, Kappa_f=1e80), gamma=gamma, kappa_m=0.05066059182116889, kappa_f=1.0e80, kappa_q=1.0) fast_source_mf = model_mf.relaxation_source() #timestepper = rk_backward_euler_split(rk3, fast_source_mf) #timestepper = rk_euler_split(rk3, fast_source_mf) #timestepper = rk3 timestepper = imex222(fast_source_mf) #timestepper = imex433(fast_source_mf) sim_mf = simulation(model_mf, interval, fvs_method(2), timestepper, periodic, cfl=0.25) sim_mf.evolve(0.0025) import numpy De = numpy.loadtxt('test100/dens_e.x.asc') Se_x = numpy.loadtxt('test100/scon_e[0].x.asc') Se_y = numpy.loadtxt('test100/scon_e[1].x.asc') Se_z = numpy.loadtxt('test100/scon_e[2].x.asc')
from models import relaxation_burgers from bcs import outflow from simulation import simulation from methods import weno3_upwind, vanleer_upwind from rk import imex222 from grid import grid from matplotlib import pyplot Ngz = 4 Npoints = 100 tau = 1.0 tau2 = 0.001 L = 1 interval = grid([-L, L], Npoints, Ngz) qL = numpy.array([1.0, 0.5]) qR = numpy.array([0.0, 0.0]) model = relaxation_burgers.relaxation_burgers( initial_data=relaxation_burgers.initial_riemann(qL, qR), a=0.9) source = relaxation_burgers.relaxation_source(tau) source2 = relaxation_burgers.relaxation_source(tau2) sim = simulation(model, interval, vanleer_upwind, imex222(source), outflow) sim.evolve(0.5) sim.plot_system() pyplot.show() sim2 = simulation(model, interval, vanleer_upwind, imex222(source2), outflow) sim2.evolve(0.5) sim2.plot_system() pyplot.show()
]) qR = numpy.array([ rhoR_e, 0, 0, 0, epsR, rhoR_p, 0, 0, 0, epsR, Bx, ByR, BzR, 0, 0, 0, 0, 0 ]) model_mf = sr_mf.sr_mf_gamma_law(initial_data=sr_mf.initial_riemann(qL, qR), gamma=gamma, kappa_m=kappa_m, kappa_f=kappa_f, kappa_q=kappa_q) fast_source_mf = model_mf.relaxation_source() sim_mf = simulation(model_mf, interval, fvs_method(2), imex222(fast_source_mf), outflow, cfl=0.25) qL = numpy.array([rhoL, 0, 0, 0, epsL, Bx, ByL, BzL, 0, 0, 0, 0, 0]) qR = numpy.array([rhoR, 0, 0, 0, epsR, Bx, ByR, BzR, 0, 0, 0, 0, 0]) #model_rmhd = sr_rmhd.sr_rmhd_gamma_law(initial_data = sr_rmhd.initial_riemann(qL, qR), # gamma=gamma) #fast_source_rmhd = model_rmhd.relaxation_source() # #sim_rmhd = simulation(model_rmhd, interval, fvs_method(2), imex222(fast_source_rmhd), # outflow, cfl=0.25) sim_mf.evolve(0.4) #