# Two-stream instability warm-up: a 1D electrostatic PIC problem, used here # as a quick, cheap first run before the heavier LWFA and beamline stages of # this tutorial. Two cold-ish electron populations drift through each other # at +/-beta0*c; the counter-streaming free energy grows an electrostatic # wave until the beams trap each other and saturate. # # All parameters below are fixed (unlike the companion "A Two-stream # Instability" episode, where you choose them yourself) so this runs in a # few seconds and gets everyone to a working WarpX + Python + Jupyter # pipeline before the LWFA stage. #################### ### MY CONSTANTS ### #################### # PLASMA my_constants.n0 = 1.e17 # electron density of each beam [m^-3] my_constants.T0 = 5.*q_e # thermal energy of each beam [J], from 5 eV my_constants.v_te = sqrt(T0 / m_e) my_constants.beta0 = 0.1 # drift velocity of each beam, in units of c my_constants.omega_pe = sqrt(n0*q_e**2/(m_e*epsilon0)) # BOX: sized to fit ~16 wavelengths of the fastest-growing mode, # lambda ~ 2*pi*beta0*(c/omega_pe) my_constants.Lx = 10.*clight/omega_pe my_constants.nx = 256 my_constants.dx = Lx/nx # TIME: long enough for the instability to grow and saturate my_constants.cfl = 0.9 my_constants.T = 100./omega_pe my_constants.dt = cfl * dx / clight my_constants.nt = floor(T/dt) ########################## ### GENERAL PARAMETERS ### ########################## stop_time = T amr.n_cell = nx nx nx amr.max_level = 0 geometry.dims = 1 geometry.prob_lo = -0.5*Lx -0.5*Lx -0.5*Lx geometry.prob_hi = 0.5*Lx 0.5*Lx 0.5*Lx ########################## ### BOUNDARY CONDITION ### ########################## boundary.field_lo = periodic periodic periodic boundary.field_hi = periodic periodic periodic boundary.particle_lo = periodic periodic periodic boundary.particle_hi = periodic periodic periodic ################ ### NUMERICS ### ################ warpx.cfl = cfl algo.maxwell_solver = yee algo.particle_shape = 3 algo.particle_pusher = boris warpx.use_filter = 1 ################# ### PARTICLES ### ################# particles.species_names = ele1 ele2 ele1.species_type = electron ele1.injection_style = NRandomPerCell ele1.num_particles_per_cell = 200 ele1.profile = constant ele1.density = n0 ele1.momentum_distribution_type = maxwell_boltzmann ele1.theta_distribution_type = constant ele1.theta = T0 / (m_e * clight**2) ele1.beta_distribution_type = parser ele1.beta_function(x,y,z) = beta0 ele1.bulk_vel_dir = +z ele2.species_type = electron ele2.injection_style = NRandomPerCell ele2.num_particles_per_cell = 200 ele2.profile = constant ele2.density = n0 ele2.momentum_distribution_type = maxwell_boltzmann ele2.theta_distribution_type = constant ele2.theta = T0 / (m_e * clight**2) ele2.beta_distribution_type = constant ele2.beta = beta0 ele2.bulk_vel_dir = -z ################### ### DIAGNOSTICS ### ################### # FULL diagnostics.diags_names = particles particles.intervals = floor(nt/200) particles.diag_type = Full particles.species = ele1 ele2 particles.fields_to_plot = none particles.format = openpmd particles.openpmd_backend = bp particles.dump_last_timestep = 1 particles.ele1.variables = w z uz particles.ele2.variables = w z uz # REDUCED warpx.reduced_diags_names = FieldEnergy FieldMaximum FieldEnergy.type = FieldEnergy FieldEnergy.intervals = 1 FieldMaximum.type = FieldMaximum FieldMaximum.intervals = 1