def heat_flux_film(run, should_normalize): """ Make film of local heat flux as a function of x and y. """ run.calculate_q() if should_normalize: field.normalize(run.q) contours = field.calculate_contours(run.q) plot_options = {'levels':contours, 'cmap':'seismic'} options = {'file_name':'q_i', 'film_dir':run.run_dir + 'analysis/moments', 'frame_dir':run.run_dir + 'analysis/moments/film_frames', 'aspect':'equal', 'xlabel':r'$R (m)$', 'ylabel':r'$Z (m)$', 'cbar_ticks':5, 'cbar_label':r'$Q_{i}(x, y) / Q_{gB}$', 'bbox_inches':'tight', 'fps':30} options['title'] = [] for it in range(run.nt): options['title'].append(r'Time = {0:04d} $\mu s$'.format( int(np.round((run.t[it]-run.t[0])*1e6)))) pf.make_film_2d(run.r, run.z, run.q, plot_options=plot_options, options=options) run.q = None gc.collect()
def tperp_film(run, should_normalize): """ Make film of perpendicular temperature. """ run.read_tperp() if should_normalize: field.normalize(run.tperp_i) field.normalize(run.tperp_e) contours = field.calculate_contours(run.tperp_i) plot_options = {'levels':contours, 'cmap':'seismic'} options = {'file_name':'tperp_i', 'film_dir':run.run_dir + 'analysis/moments', 'frame_dir':run.run_dir + 'analysis/moments/film_frames', 'aspect':'equal', 'xlabel':r'$R (m)$', 'ylabel':r'$Z (m)$', 'cbar_ticks':5, 'cbar_label':r'$\delta T_{i, \perp} / T_r$', 'bbox_inches':'tight', 'fps':30} options['title'] = [] for it in range(run.nt): options['title'].append(r'Time = {0:04d} $\mu s$'.format( int(np.round((run.t[it]-run.t[0])*1e6)))) pf.make_film_2d(run.r, run.z, run.tperp_i, plot_options=plot_options, options=options) run.tperp_i = None gc.collect() contours = field.calculate_contours(run.tperp_e) plot_options = {'levels':contours, 'cmap':'seismic'} options = {'file_name':'tperp_e', 'film_dir':run.run_dir + 'analysis/moments', 'frame_dir':run.run_dir + 'analysis/moments/film_frames', 'aspect':'equal', 'xlabel':r'$R (m)$', 'ylabel':r'$Z (m)$', 'cbar_ticks':5, 'cbar_label':r'$\delta T_{e, \perp} / T_r$', 'bbox_inches':'tight', 'fps':30} options['title'] = [] for it in range(run.nt): options['title'].append(r'Time = {0:04d} $\mu s$'.format( int(np.round((run.t[it]-run.t[0])*1e6)))) pf.make_film_2d(run.r, run.z, run.tperp_e, plot_options=plot_options, options=options) run.tperp_e = None gc.collect()
def v_exb_film(run, should_normalize): """ Make film of parallel velocity. """ run.calculate_v_exb() if should_normalize: field.normalize(run.v_exb) # Ion upar film contours = field.calculate_contours(run.v_exb) plot_options = {'levels':contours, 'cmap':'seismic'} options = {'file_name':'v_exb', 'film_dir':run.run_dir + 'analysis/moments', 'frame_dir':run.run_dir + 'analysis/moments/film_frames', 'aspect':'equal', 'xlabel':r'$R (m)$', 'ylabel':r'$Z (m)$', 'cbar_ticks':5, 'cbar_label':r'$v_{E \times B}$ (m/s)', 'bbox_inches':'tight', 'fps':30} options['title'] = [] for it in range(run.nt): options['title'].append(r'Time = {0:04d} $\mu s$'.format( int(np.round((run.t[it]-run.t[0])*1e6)))) pf.make_film_2d(run.r, run.z, run.v_exb, plot_options=plot_options, options=options) run.v_exb = None gc.collect()
def make_film(run, no_structures, labelled_image, perc_thresh): titles = [] for it in range(run.nt): titles.append('No. of structures = {}'.format(no_structures[it])) plot_options = {'cmap':'gist_rainbow', 'levels':np.arange(-1,np.max(labelled_image)) } options = {'file_name':'structures', 'film_dir':run.run_dir + 'analysis/structures_' + str(perc_thresh) , 'frame_dir':run.run_dir + 'analysis/structures_' + str(perc_thresh) + '/film_frames', 'nprocs':None, 'aspect':'equal', 'xlabel':r'$x$ (m)', 'ylabel':r'$y$ (m)', 'cbar_ticks':np.arange(-1,np.max(labelled_image),2), 'cbar_label':r'Label', 'fps':10, 'bbox_inches':'tight', 'title':titles } pf.make_film_2d(run.r, run.z, labelled_image, plot_options=plot_options, options=options)
def phi_film(run, should_normalize): """ Create film of electrostatic potential. Parameters ---------- run : object Instance of the Run class describing a given simulation """ run.read_phi() if should_normalize: field.normalize(run.phi) contours = field.calculate_contours(run.phi) plot_options = {'levels':contours, 'cmap':'seismic'} options = {'file_name':'phi', 'film_dir':run.run_dir + 'analysis/moments', 'frame_dir':run.run_dir + 'analysis/moments/film_frames', 'aspect':'equal', 'xlabel':r'$R (m)$', 'ylabel':r'$Z (m)$', 'cbar_ticks':5, 'cbar_label':r'$\varphi$', 'bbox_inches':'tight', 'fps':30} options['title'] = [] for it in range(run.nt): options['title'].append(r'Time = {0:04d} $\mu s$'.format( int(np.round((run.t[it]-run.t[0])*1e6)))) pf.make_film_2d(run.r, run.z, run.phi, plot_options=plot_options, options=options) run.phi = None gc.collect()
def ntot_film(run, should_normalize): """ Create film of density fluctuations. """ run.read_ntot() if should_normalize: field.normalize(run.ntot_i) field.normalize(run.ntot_e) # Ion density film contours = field.calculate_contours(run.ntot_i) plot_options = {'levels':contours, 'cmap':'seismic'} options = {'file_name':'ntot_i', 'film_dir':run.run_dir + 'analysis/moments', 'frame_dir':run.run_dir + 'analysis/moments/film_frames', 'aspect':'equal', 'xlabel':r'$R (m)$', 'ylabel':r'$Z (m)$', 'cbar_ticks':5, 'cbar_label':r'$\delta n_i / n_r$', 'bbox_inches':'tight', 'fps':30} options['title'] = [] for it in range(run.nt): options['title'].append(r'Time = {0:04d} $\mu s$'.format( int(np.round((run.t[it]-run.t[0])*1e6)))) pf.make_film_2d(run.r, run.z, run.ntot_i, plot_options=plot_options, options=options) run.ntot_i = None gc.collect() # Electron density film contours = field.calculate_contours(run.ntot_e) plot_options = {'levels':contours, 'cmap':'seismic'} options = {'file_name':'ntot_e', 'film_dir':run.run_dir + 'analysis/moments', 'frame_dir':run.run_dir + 'analysis/moments/film_frames', 'aspect':'equal', 'xlabel':r'$R (m)$', 'ylabel':r'$Z (m)$', 'cbar_ticks':5, 'cbar_label':r'$\delta n_e / n_r$', 'bbox_inches':'tight', 'fps':30} options['title'] = [] for it in range(run.nt): options['title'].append(r'Time = {0:04d} $\mu s$'.format( int(np.round((run.t[it]-run.t[0])*1e6)))) pf.make_film_2d(run.r, run.z, run.ntot_e, plot_options=plot_options, options=options) run.ntot_e = None gc.collect()