def plots_crab(self, l_force=0): #fontsz = 16 #plt.rcParams['axes.labelsize'] = fontsz #plt.rcParams['axes.titlesize'] = fontsz #plt.rcParams['xtick.labelsize'] = fontsz #plt.rcParams['ytick.labelsize'] = fontsz #plt.rcParams['legend.fontsize'] = fontsz #plt.rcParams['legend.title_fontsize'] = fontsz chamber = self.chamber if self.laser_source_z is None: here_laser_source_z = chamber.zmin + 0.5 * (-chamber.l_main_z / 2 - chamber.zmin) else: here_laser_source_z = self.laser_source_z em = self.solver.solver k_antenna = int((here_laser_source_z - chamber.zmin) / em.dz) j_mid_waveguide = int((chamber.ycen6 - chamber.ymin) / em.dy) flist = ['elecs'] pw = picmi.warp if pw.top.it % 10 == 0 or l_force: #fig = plt.figure( figsize=(7,7)) for ffstr in flist: if ffstr == 'Ex': ff = em.gatherex() if ffstr == 'Ey': ff = em.gatherey() maxe = 35e6 * self.em_scale_fac #np.max(ey[:,:,:]) mine = -35e6 * self.em_scale_fac #np.min(ey[:,:,:]) if ffstr == 'Ez': ff = em.gatherez() if ffstr == 'Bx': ff = em.gatherbx() if ffstr == 'By': ff = em.gatherby() if ffstr == 'Bz': ff = em.gatherbz() if ffstr == 'elecs': ff = self.ecloud.wspecies.get_density( ) + self.beam.wspecies.get_density() maxe = 5e9 #np.max(ey[:,:,:]) mine = 0 #np.min(ey[:,:,:]) self.proj_elecs_yz[:, :, self.iproj] = np.sum(ff, axis=0) self.proj_elecs_xz[:, :, self.iproj] = np.sum(ff, axis=1) self.proj_elecs_xy[:, :, self.iproj] = np.sum(ff, axis=2) if picmi.warp.top.it % sim.proj_stride == 0: dict_out = {} dict_out['elecs_yz'] = self.proj_elecs_yz dict_out['elecs_xz'] = self.proj_elecs_xz dict_out['elecs_xy'] = self.proj_elecs_xy self.iproj += 1 filename = sim.proj_filename dict_to_h5(dict_out, filename) if ffstr == 'Jy': ff = em.gatherjy() maxe = np.max(ff[:, :, :]) mine = np.min(ff[:, :, :]) if me == 0: plot_field_crab(ff, ffstr, mine, maxe, k_antenna, j_mid_waveguide, chamber)
def plots_crab(self, l_force=0): #fontsz = 16 #plt.rcParams['axes.labelsize'] = fontsz #plt.rcParams['axes.titlesize'] = fontsz #plt.rcParams['xtick.labelsize'] = fontsz #plt.rcParams['ytick.labelsize'] = fontsz #plt.rcParams['legend.fontsize'] = fontsz #plt.rcParams['legend.title_fontsize'] = fontsz chamber = self.chamber if self.laser_source_z is None: here_source_z = chamber.zmin + 0.5 * (-chamber.l_main_z / 2 - chamber.zmin) else: here_source_z = self.laser_source_z em = self.solver.solver k_antenna = int((here_source_z - chamber.zmin) / em.dz) j_mid_waveguide = int((chamber.ycen6 - chamber.ymin) / em.dy) flist = ['Ex', 'Ey', 'Ez', 'Bx', 'By', 'Bz'] flist = ['Jy'] pw = picmi.warp if pw.top.it % 10 == 0 or l_force: for ffstr in flist: if ffstr == 'Ex': ff = em.gatherex() if ffstr == 'Ey': ff = em.gatherey() maxe = 35e6 * self.em_scale_fac #np.max(ey[:,:,:]) mine = -35e6 * self.em_scale_fac #np.min(ey[:,:,:]) if ffstr == 'Ez': ff = em.gatherez() if ffstr == 'Bx': ff = em.gatherbx() if ffstr == 'By': ff = em.gatherby() if ffstr == 'Bz': ff = em.gatherbz() if ffstr == 'elecs': ff = self.ecloud.wspecies.get_density() maxe = 5e9 #np.max(ey[:,:,:]) mine = 0 #np.min(ey[:,:,:]) if ffstr == 'Jy': ff = em.gatherjy() maxe = np.max(ff[:, :, :]) mine = np.min(ff[:, :, :]) if me == 0: plot_field_crab(ff, ffstr, mine, maxe, k_antenna, j_mid_waveguide, chamber)
def plot_fields(self, l_force=0): chamber = self.chamber em = self.solver.solver pw = picmi.warp if self.laser_source_z is None: here_laser_source_z = chamber.zmin + 0.5 * (-chamber.l_main_z / 2 - chamber.zmin) else: here_laser_source_z = self.laser_source_z k_antenna = int((here_laser_source_z - chamber.zmin) / em.dz) j_mid_waveguide = int((chamber.ycen6 - chamber.ymin) / em.dy) if pw.top.it % self.stride_imgs == 0 or l_force: #fig = plt.figure( figsize=(7,7)) Ex = sim.ES_solver.solver.getex() Ey = sim.ES_solver.solver.getey() Ez = sim.ES_solver.solver.getez() elecs = self.ecloud.wspecies.get_density() if picmi.warp.me > 0: mpisend(Ex, tag=8) mpisend(Ey, tag=9) mpisend(Ez, tag=10) if picmi.warp.me == 0: #nx_loc, ny_loc, nz_loc = np.shape(Ex) #Ex_g = np.zeros((nx_loc, ny_loc, npes*nz_loc)) Ex_g = Ex #Ey_g = np.zeros((nx_loc, ny_loc, npes*nz_loc)) Ey_g = Ey #Ez_g = np.zeros((nx_loc, ny_loc, npes*nz_loc)) Ez_g = Ez #count = nz_loc for nproc in range(1, npes): Ex_l = mpirecv(source=nproc, tag=8) #nx_loc, ny_loc, nz_loc = np.shape(Ex_l) Ex_g = np.concatenate((Ex_g, Ex_l), axis=2) Ey_l = mpirecv(source=nproc, tag=9) #nx_loc, ny_loc, nz_loc = np.shape(Ey_l) Ey_g = np.concatenate((Ey_g, Ey_l), axis=2) Ez_l = mpirecv(source=nproc, tag=10) #nx_loc, ny_loc, nz_loc = np.shape(Ez_l) Ez_g = np.concatenate((Ez_g, Ez_l), axis=2) #count+=nz_loc plot_field_crab(Ex_g, 'Ex', np.min(Ex_g), np.max(Ex_g), k_antenna, j_mid_waveguide, chamber, self.images_dir) plot_field_crab(Ey_g, 'Ey', np.min(Ey_g), np.max(Ey_g), k_antenna, j_mid_waveguide, chamber, self.images_dir) plot_field_crab(Ez_g, 'Ez', np.min(Ez_g), np.max(Ez_g), k_antenna, j_mid_waveguide, chamber, self.images_dir) plot_field_crab(elecs, 'elecs', np.min(elecs), np.max(elecs), k_antenna, j_mid_waveguide, chamber, self.images_dir)