In [ ]:
import yt
import matplotlib.pyplot as plt
#ds = yt.load('/d/d9/ychen/FLASH4/20180311_oblique_shock/bw_2d_mhd_hdf5_chk_0001')
#ds = yt.load('/d/d9/ychen/FLASH4/20180310_BrioWu/bw_2d_mhd_hdf5_chk_0001')
ds = yt.load('/d/d9/ychen/FLASH4/20180321_shock/shock_2d_hdf5_plt_cnt_0002')

In [ ]:
fields = ['density', 'pressure']
plot = yt.SlicePlot(ds, 'z', fields, width=(1,0.2), origin='native')
plot.show()

In [ ]:
plot = yt.SlicePlot(ds, 'z', 'sound_speed', width=(1,0.2), origin='native')
plot.set_log('sound_speed', False)

In [ ]:
plot = yt.SlicePlot(ds, 'z', ['velocity_%s' % ax for ax in ['x', 'y']], width=(1,0.2), origin='native')
plot.set_log('velocity_x', False)

In [ ]:
plot = yt.SlicePlot(ds, 'z', 'mach_number', width=(1,0.2))
plot.set_log('mach_number', False)

In [ ]:
plot = yt.SlicePlot(ds, 'z', 'shok', width=(1,0.2), origin='native')
plot.annotate_grids()
#plot.annotate_cell_edges(alpha=0.1)
plot.set_log('shok', False)

In [ ]:
plot = yt.SlicePlot(ds, 'z', 'shks', width=(1,0.2), origin='native')
plot.annotate_grids()
plot.annotate_cell_edges(alpha=0.1)
plot.set_log('shks', False)

In [ ]:
print(ds)
ds.field_list
ds.dimensionality = 3
xl = 0.4
xr = 0.6
sl = ds.r[xl:xr,0.5,0.5]
sl['shok']

In [ ]:
fig = plt.figure(figsize=(10,4))
fields = ['density', 'pressure', 'velocity_x', 'sound_speed', 'shks', 'shok']
for fi in fields:
    plt.plot(sl['x'], sl[fi], '.-', label=fi)
plt.semilogy()
plt.ylim(1E-1, 2E1)
plt.legend()
plt.twinx()
for fi in ['shok']:
    dx = sl['x'][1:]-sl['x'][:-1]
    left = sl['x'][:-1]
    plt.bar(left, sl[fi][:-1], dx, label=fi, color='y', alpha=0.2)
plt.legend(loc=2)

In [ ]:
import numpy as np
np.sqrt(((sl['shks']+1)*(sl['gamc']+1)+(sl['gamc']-1))/2/sl['gamc'])

In [ ]:
import numpy as np
np.sqrt(sl['shks']*(sl['gamc']+1)/2/sl['gamc']+1)

In [ ]:
g = 5/3
np.sqrt(1/3*(g+1)/2/g+1)

In [ ]:
sl['shks']

In [ ]:
sl['pressure']

In [ ]:
np.sqrt(sl['pressure']/sl['density']*sl['gamc'])

In [ ]:
np.sqrt(30*5/3)

In [ ]:
gamma = 1.6666
((1*(gamma+1)+(gamma-1))/2/gamma)

In [ ]: