nz = 256 # Physical domain zmin = -56e-06 zmax = 12e-06 # Domain decomposition max_grid_size = 64 blocking_factor = 32 # Create grid grid = picmi.Cartesian1DGrid(number_of_cells=[nz], lower_bound=[zmin], upper_bound=[zmax], lower_boundary_conditions=['dirichlet'], upper_boundary_conditions=['dirichlet'], lower_boundary_conditions_particles=['absorbing'], upper_boundary_conditions_particles=['absorbing'], moving_window_velocity=[c], warpx_max_grid_size=max_grid_size, warpx_blocking_factor=blocking_factor) # Particles: plasma electrons plasma_density = 2e23 plasma_xmin = None plasma_ymin = None plasma_zmin = 10e-06 plasma_xmax = None plasma_ymax = None plasma_zmax = None uniform_distribution = picmi.UniformDistribution( density=plasma_density,
def setup_run(self): """Setup simulation components.""" ####################################################################### # Set geometry and boundary conditions # ####################################################################### self.grid = picmi.Cartesian1DGrid( number_of_cells=[self.nz], warpx_max_grid_size=128, lower_bound=[0], upper_bound=[self.gap], lower_boundary_conditions=['dirichlet'], upper_boundary_conditions=['dirichlet'], lower_boundary_conditions_particles=['absorbing'], upper_boundary_conditions_particles=['absorbing'], warpx_potential_hi_z=self.voltage, ) ####################################################################### # Field solver # ####################################################################### self.solver = picmi.ElectrostaticSolver(grid=self.grid, method='Multigrid', required_precision=1e-12, warpx_self_fields_verbosity=0) ####################################################################### # Particle types setup # ####################################################################### self.electrons = picmi.Species( particle_type='electron', name='electrons', initial_distribution=picmi.UniformDistribution( density=self.plasma_density, rms_velocity=[ np.sqrt(constants.kb * self.elec_temp / constants.m_e) ] * 3, )) self.ions = picmi.Species( particle_type='He', name='he_ions', charge='q_e', mass=self.m_ion, initial_distribution=picmi.UniformDistribution( density=self.plasma_density, rms_velocity=[ np.sqrt(constants.kb * self.gas_temp / self.m_ion) ] * 3, )) ####################################################################### # Collision initialization # ####################################################################### cross_sec_direc = '../../../../warpx-data/MCC_cross_sections/He/' mcc_electrons = picmi.MCCCollisions( name='coll_elec', species=self.electrons, background_density=self.gas_density, background_temperature=self.gas_temp, background_mass=self.ions.mass, scattering_processes={ 'elastic': { 'cross_section': cross_sec_direc + 'electron_scattering.dat' }, 'excitation1': { 'cross_section': cross_sec_direc + 'excitation_1.dat', 'energy': 19.82 }, 'excitation2': { 'cross_section': cross_sec_direc + 'excitation_2.dat', 'energy': 20.61 }, 'ionization': { 'cross_section': cross_sec_direc + 'ionization.dat', 'energy': 24.55, 'species': self.ions }, }) mcc_ions = picmi.MCCCollisions( name='coll_ion', species=self.ions, background_density=self.gas_density, background_temperature=self.gas_temp, scattering_processes={ 'elastic': { 'cross_section': cross_sec_direc + 'ion_scattering.dat' }, 'back': { 'cross_section': cross_sec_direc + 'ion_back_scatter.dat' }, # 'charge_exchange' : { # 'cross_section' : cross_sec_direc+'charge_exchange.dat' # } }) ####################################################################### # Initialize simulation # ####################################################################### self.sim = picmi.Simulation( solver=self.solver, time_step_size=self.dt, max_steps=self.max_steps, warpx_collisions=[mcc_electrons, mcc_ions], warpx_load_balance_intervals=self.max_steps // 5000, verbose=self.test) self.sim.add_species(self.electrons, layout=picmi.GriddedLayout( n_macroparticle_per_cell=[self.seed_nppc], grid=self.grid)) self.sim.add_species(self.ions, layout=picmi.GriddedLayout( n_macroparticle_per_cell=[self.seed_nppc], grid=self.grid)) ####################################################################### # Add diagnostics for the CI test to be happy # ####################################################################### field_diag = picmi.FieldDiagnostic( name='diag1', grid=self.grid, period=0, data_list=['rho_electrons', 'rho_he_ions'], write_dir='.', warpx_file_prefix='Python_background_mcc_1d_plt') self.sim.add_diagnostic(field_diag)