partnumstop = 641 stride = 10 mypath = 'particle_txt/sig.3_delgam0005/bguide.1_earlytime/' c_omp = 3 istep = 12 sigma=.3 va = np.sqrt(sigma/(1+sigma)) t_start = 1 t_stop = 25 fld_base = "../../tristan-mp_reconnection/guide_fields/sig.3/delgam0005/bguide.1/output/flds.tot.015" myfld = h5py.File(fld_base,'r') ez = get_val_filename('ez',myfld)[0,:,:] bx = get_val_filename('bx',myfld)[0,:,:] by = get_val_filename('by',myfld)[0,:,:] xhlf = np.shape(ez)[1]/2 ylen = np.shape(ez)[0] ez = ez[:,xhlf] bx = bx[:,xhlf] by = by[:,xhlf] ez_bxy = ez /(va*np.sqrt(bx**2+by**2)) xarr = np.linspace(0,ylen*12, np.size(ez))
#fld_base = "/home/u21/davidrball/david/tristan-mp_reconnection/guide_fields/sig.3/simulation_matrix/delgam05/bguide.7/output/flds.tot." #if len(tstr)==1: # fld_base += "00" + tstr #elif len(tstr)==2: # fld_base += "0"+tstr t0 = 50 tf = 51 for t in range(t0, tf): t_string = str(t) myfld = fld_base + t_string myfld = h5py.File(myfld, 'r') dens = get_val_filename('dens', myfld)[0, :, :] bdens = myfld['bdens'][0, :, :] vecpot = vecpot2(myfld, 12, 3) #fig, (ax1, ax2, ax3) = plt.subplots(3,1,sharex=True) fig, (ax0) = plt.subplots(1, 1, sharex=True) #ax1.imshow(np.rot90(dens)/5,origin='lower',cmap='viridis',vmin=0,vmax=5) #ax2.imshow(np.rot90(vecpot),origin='lower',cmap='jet') #plt.savefig('vecpot_test.png') #identify midplane ax0.imshow(np.rot90(dens) / 4., origin='lower', vmin=0, vmax=5) #ax1.imshow(np.rot90(vecpot),origin='lower') #plt.colorbar(im1) #plt.colorbar(im0) #plt.colorbar(orientation='horizontal',label='$A_{z}$') #plt.savefig('vecpot_fld.png',dpi=300,bbox_inches='tight')
px_std_list = [] py_std_list = [] pz_std_list = [] t_list = [] for t in range(t0, tf): t_str = str(t) if len(t_str) == 1: spec0 = spec_base + "0" + t_str elif len(t_str) == 2: spec0 = spec_base + t_str t_list.append(t) #spec0 = spec_base + str(t) myf = h5py.File(spec0, 'r') px = np.array(get_val_filename('pxelogsp', myf)) #[:,0:10] py = get_val_filename('pyelogsp', myf) #[:,0:10] pz = get_val_filename('pzelogsp', myf) #[:,0:10] pxb = np.array(get_val_filename('pxeblogsp', myf)) print(np.shape(pxb)) px -= pxb pxbin = np.array(get_val_filename('pxbin', myf)) pybin = np.array(get_val_filename('pybin', myf)) pzbin = np.array(get_val_filename('pzbin', myf)) #testbin = get_val_filename('nonsense',myf) #print(pxbin) px_spec = np.zeros(np.size(pxbin)) py_spec = np.zeros(np.size(pybin)) pz_spec = np.zeros(np.size(pzbin))
c_omp = 3 tscan= .5 xpoint_scan = tscan * interval * .45 / istep xpoint_scan = 25 #myprtl = "../../tristan_acc-mec_Ez/8k_untriggered_bguide.3_stride1/output/prtl.tot.051" #myprtl = "../../tristan_acc-mec_Ez/8k_bguide.1_allprts/output/prtl.tot.045" myprtl = "../../tristan_acc-mec_Ez/bguide.1_wpar_zcomp/output/prtl.tot.055" myprtl = h5py.File(myprtl,'r') tcse = np.array(get_val_filename('tcse',myprtl)) ycse = np.array(get_val_filename('ycse',myprtl))/c_omp / 1000 gammae = np.array(get_val_filename('gammae',myprtl)) ez_bxy = -np.array(get_val_filename('ezbxye',myprtl))/va prtnum = np.size(tcse) t0 = 11 tf = 12 xpoint_prtl_ycs = [] xpoint_prtl_gam = []
import matplotlib.patches as patches plt.rcParams['mathtext.fontset'] = 'stix' plt.rcParams['font.family'] = 'STIXGeneral' plt.rcParams.update({'font.size': 15}) myfld_base = "../../accmec_withy/bguide.3_triggered/output/flds.tot." prtl_final = "../../accmec_withy/bguide.3_triggered/output/prtl.tot.060" prtl_base = "../../accmec_withy/bguide.3_triggered/output/prtl.tot." f_prtl_final = h5py.File(prtl_final, 'r') tcse = np.array(get_val_filename('tcse',f_prtl_final)) ycse = np.array(get_val_filename('ycse',f_prtl_final)) xcse = np.array(get_val_filename('xcse',f_prtl_final)) gammae = np.array(get_val_filename('gammae',f_prtl_final)) ez_bxy = -np.array(get_val_filename('ezbxye',f_prtl_final)) c=.45 rstep_first = 12000 rstep_jump = 2000 rstep_interval = 2000 u_sh = .1 btheta=0.3 sigma=0.3 tcse_jump = (tcse-rstep_first)//rstep_interval+1 tcse_jump[tcse-rstep_first==0]=1
#axlist = [ax0, ax1, ax2, ax3, ax4, ax5, ax6 ,ax7, ax8, ax9, ax10, ax11, ax12, ax13, ax14, ax15] betaeff_list = [ .0003, .003, .03, .3, .01, .013, .043, .34, .09, .093, .12, .42, .49, .493, .52, .82 ] #mylen = len(axlist) for i in range(len(matrix_namelist)): for j in range(len( matrix_namelist[0])): #assuming that the matrix is square if matrix_namelist[i][j] == "pass": pass else: myfile = h5py.File(matrix_namelist[i][j], 'r') mydens = np.rot90(get_val_filename('dens', myfile)[0]) myax_ind = 4 * i + j myax = plt.subplot(gs1[myax_ind]) #myax = axlist[myax_ind] #title = str(betaeff_list[myax_ind]) myax.imshow(mydens / 4, vmin=0, vmax=5, origin='lower') #myax.set_adjustable('box-forced') #myax.set_title(title) myax.set_yticks([]) myax.set_xticks([]) myax.minorticks_off() myfile.close() ''' ax0.set_ylabel('$B_{g}/B_{0}=0$') ax4.set_ylabel('$B_{g}/B_{0}=0.1$')
fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True) lap0 = t0 * interval for t in range(t0, tf + 1): lap = t * interval #lap_index = lap-lap0 #print(lap_index) print(lap) t_str = str(t) print(t_str) if len(t_str) == 1: myfld = myfld_base + "00" + t_str elif len(t_str) == 2: myfld = myfld_base + "0" + t_str myfld = h5py.File(myfld, 'r') ez = get_val_filename('ez', myfld)[0, :, :] bx = get_val_filename('bx', myfld)[0, :, :] by = get_val_filename('by', myfld)[0, :, :] #in the first loop, identify size of array in y-direction if t == t0: mysizey = np.shape(ez)[0] yarr = np.linspace(0, mysizey * istep / c_omp, mysizey) mysizex = np.shape(ez)[1] xhlf = int(mysizex / 2) ez = ez[:, xhlf] bx = bx[:, xhlf] by = by[:, xhlf] ez_over_vabxy = ez / (va * np.sqrt(bx**2 + by**2)) ez_bxy_list.append(ez_over_vabxy)
by = d['by'][i] bz = d['bz'][i] ex = d['ex'][i] ey = d['ey'][i] ez = d['ez'][i] gamma = d['gamma'][i] gamcol = np.log10(gamma / maxgam) / np.log10(mingam / maxgam) print(gamcol) intx = int(x) inty = int(y) intx /= istep inty /= istep dens = np.array(get_val_filename("dens", f_fld))[0] fig = plt.figure() ax1 = plt.subplot2grid((1, 2), (0, 0), rowspan=1, colspan=1) ax2 = plt.subplot2grid((1, 2), (0, 1), colspan=1) xhlf = np.shape(dens)[1] / 2 xscan = 100 xlow = int(xhlf - xscan) xup = int(xhlf + xscan) xext = istep * 2 * xscan / c_omp # in electron skin depths yext = istep * np.shape(dens)[0] / c_omp ax1.imshow(dens[:, xlow:xup], origin='lower', vmax=20, extent=[0, xext, 0, yext]) ax1.set_xlabel('$c/\omega_{p}$', size=14)
scan = 10 interval = 2000. istep = 12 c_omp = 3 tscan = .5 xpoint_scan = tscan * interval * .45 / istep xpoint_scan = 25 myprtl = "../../tristan_acc-mec_Ez/highbeta/triggered_guide/output/prtl.tot.065" #myprtl = "../../tristan_acc-mec_Ez/8k_bguide.1_allprts/output/prtl.tot.045" myprtl = h5py.File(myprtl, 'r') tcse = np.array(get_val_filename('tcse', myprtl)) / interval ycse = np.array(get_val_filename('ycse', myprtl)) / istep gammae = np.array(get_val_filename('gammae', myprtl)) ez_bxy = -np.array(get_val_filename('ezbxye', myprtl)) / va prtnum = np.size(tcse) t0 = 5 tf = 50 xpoint_prtl_ycs = [] xpoint_prtl_gam = [] else_prtl_ycs = [] else_prtl_gam = []
plt.rcParams.update({'font.size': 10}) #myprtl = "../../tristan-mp_reconnection/16k_triggered_finals/sig.3/deglam005/output/prtl.tot.030" myprtl = "/home/u21/davidrball/david/tristan-mp_reconnection/16k_triggered_finals/sig.3/delgam005/output/prtl.tot.030" #myprtl = "../../tristan_acc-mec/correct_gam/output/prtl.tot.001" #myprtl = "../../tristan_acc-mec/comm_test/output/prtl.tot.001" myprtl = h5py.File(myprtl, 'r') #myfld = "../../tristan_acc-mec/test/output/flds.tot.009" #myfld = h5py.File(myfld,'r') #list_types(myprtl) inde = np.array(get_val_filename('inde', myprtl)) indi = np.array(get_val_filename('indi', myprtl)) gammae = np.array(get_val_filename('gammae', myprtl)) gammai = np.array(get_val_filename('gammai', myprtl)) xe = np.array(get_val_filename('xe', myprtl)) ue = np.array(get_val_filename('ue', myprtl)) exe = np.array(get_val_filename('exe', myprtl)) we = np.array(get_val_filename('we', myprtl)) #tcsi = np.array(get_val_filename('tcsi',myprtl)) #ycsi = np.array(get_val_filename('ycsi',myprtl)) bsynce = np.array(get_val_filename('bsynce', myprtl)) bsynci = np.array(get_val_filename('bsynci', myprtl))
t = 30 tstr = str(t) fld_base = "../../tristan-mp_reconnection/guide_fields/sig.3/delgam0005/bguide2/output/flds.tot.0" if len(tstr)==1: fld_base += "0" + tstr elif len(tstr)==2: fld_base += tstr myf = h5py.File(fld_base,'r') dens = get_val_filename('dens',myf)[0,:,:] ez = get_val_filename('ez',myf)[0,:,:] bx = get_val_filename('bx',myf)[0,:,:] by = get_val_filename('by',myf)[0,:,:] bz = get_val_filename('bz',myf)[0,:,:] ey = get_val_filename('ey',myf)[0,:,:] ex = get_val_filename('ex',myf)[0,:,:] #we want to make a small square around the center of the box xhlf = np.shape(dens)[1]/2 yhlf = np.shape(dens)[0]/2
from tristan_funcs import get_val_filename, list_types import h5py import numpy as np myprtl = "../../tristan-mp_reconnection/16k_triggered_finals/sig.3/deglam005/output/prtl.tot.030" #myprtl = "../../tristan_acc-mec/test/output/prtl.tot.003" myprtl = h5py.File(myprtl) #list_types(myprtl) tcs = np.array(get_val_filename('tcs', myprtl)) ycs = np.array(get_val_filename('ycs', myprtl)) boolarray = ycs == 0 print(tcs, ycs) print(False in boolarray) myprtl.close()
plt.rcParams['font.family'] = 'STIXGeneral' plt.rcParams.update({'font.size': 15}) #myprtl = "../../tristan_acc-mec_Ez/8k_bguide.3_triggered_stride1_thresh2/output/prtl.tot.036" myprtl = "../../accmec_withy/bguide.3_triggered_highthresh/output/prtl.tot.045" myprtl = h5py.File(myprtl,'r') xcse = np.array(myprtl['xcse']) #print('min max xcse') #print(np.min(np.nonzero(xcse)),np.max(xcse)) #print(np.max(xcse)) gammae = np.array(get_val_filename('gammae',myprtl)) tcse = np.array(get_val_filename('tcse',myprtl)) ycse = np.array(get_val_filename('ycse',myprtl)) ez_bxye = np.array(get_val_filename('ezbxye',myprtl)) xe = np.array(myprtl['xe']) print('minmax of xe : ', np.min(xe), np.max(xe)) c = .45 rstep_first = 12000 rstep_interval = 2000 rstep_jump = 2000 u_sh = .1 btheta = 0.3 sigma=0.3 tcse_jump = (tcse - rstep_first)//rstep_interval+1 #how many jumps there are at this tcs
import numpy as np plt.rcParams['mathtext.fontset']='stix' plt.rcParams['font.family']='STIXGeneral' plt.rcParams.update({'font.size':15}) prtl_final = "../../tristan_acc-mec_Ez/8k_run2/output/prtl.tot.035" f_fld = "../../tristan_acc-mec_Ez/8k_run2/output/flds.tot.035" spec_final = "../../tristan_acc-mec_Ez/8k_run2/output/spect.020" f_prtl = h5py.File(prtl_final,'r') f_fld = h5py.File(f_fld,'r') f_spect = h5py.File(spec_final,'r') specgam, specion, speclec = return_rspec([f_spect]) dens = np.rot90(get_val_filename('dens',f_fld)[0,:,:]) c_omp = 3 ycs_conv = c_omp * 1000 #just to convert ycse from cells to the units we show in the fld plots for easier comparison istep = 12 xext = np.shape(dens)[1]*istep / ycs_conv ycse = np.array(get_val_filename('ycse',f_prtl)) gammae = np.array(get_val_filename('gammae',f_prtl)) tcse = np.array(get_val_filename('tcse',f_prtl)) prtnum = np.size(gammae) #make a list of gammas from the central region and from elsewhere
fig, ((ax0, ax1, ax2), (ax3, ax4, ax5), (ax6, ax7, ax8)) = plt.subplots(3, 3, sharex=True, sharey=True) axlist = [ax0, ax1, ax2, ax3, ax4, ax5, ax6, ax7, ax8] betaeff_list = [.0003, .003, .03, .01, .013, .043, .09, .093, .12] mylen = len(axlist) for i in range(len(matrix_namelist)): for j in range(len( matrix_namelist[0])): #assuming that the matrix is square myfile = h5py.File(matrix_namelist[i][j], 'r') gam = np.array(get_val_filename('gamma', myfile)) myspec = np.array(get_val_filename('rspece', myfile))[:, 0, :] summed_spec = np.zeros(np.size(gam)) for k in range(np.size(summed_spec)): for l in range(np.shape(myspec)[1]): summed_spec[k] += myspec[k][l] myax_ind = 3 * i + j myax = axlist[myax_ind] title = str(betaeff_list[myax_ind]) myax.plot(gam, gam * summed_spec) myax.set_adjustable('box-forced') myax.set_title(title, size=10) myax.set_xscale('log') myax.set_yscale('log') myax.set_ylim(1e2, 1e7)