from hllrk import hllrk from hlleuler import hlleuler import cPickle import numpy as np import pylab as py u = cPickle.load(file("1dshock.dat","r")) urkfl = u.copy() urk = u.copy() ueuler = u.copy() gamma = 1.4 hllrkfluxlimit.init(gamma, 0.01, 0.8,1.5) hllrk.init(gamma, 0.01, 0.8) hlleuler.init(gamma, 0.01, 0.8) py.ion() def make_plot_array(u): plots = [] plots.append(py.plot(u[:,0],label="density")[0]) plots.append(py.plot(u[:,1]/u[:,0],label="velocity")[0]) plots.append(py.plot(u[:,2],label="energy")[0]) return plots def update_plot(plots,u): plots[0].set_ydata(u[:,0].copy()) plots[1].set_ydata(u[:,1]/u[:,0]) plots[2].set_ydata(u[:,2].copy()) return plots
from hlleuler import hlleuler as hll import cPickle import numpy as np import pylab as py u = cPickle.load(file("1dshock.dat", "r")) uc = u.copy() gamma = 1.4 hll.init(gamma, 0.1, 0.8) for i in range(100): uc = hll.step(uc) py.clf() py.title("i=%d" % i) py.plot(uc[:, 0], label="density") py.plot(uc[:, 1] / uc[:, 0], label="velocity") py.plot(uc[:, 2], label="energy") py.legend() py.savefig("images-euler/plot-%0.8d.png" % i)