# Parameters for the plasma wave
my_constants.max_step = 80
my_constants.epsilon = 0.01
my_constants.n0 = 2.e24  # electron density, #/m^3
my_constants.wp = sqrt(n0*q_e**2/(epsilon0*m_e))  # plasma frequency
my_constants.kp = wp/clight  # plasma wavenumber
my_constants.w0 = 5.e-6  # transverse perturbation length
# Note: kp is calculated in SI for a density of 2e24

# Maximum number of time steps
max_step = max_step

# number of grid points
amr.n_cell = 64

# Maximum allowable size of each subdomain in the problem domain;
#    this is used to decompose the domain for parallel calculations.
amr.max_grid_size = 64

# Maximum level in hierarchy (for now must be 0, i.e., one level in total)
amr.max_level = 0

# Geometry
geometry.dims = RCYLINDER
geometry.prob_lo =  0.e-6  # physical domain
geometry.prob_hi = 20.e-6
boundary.field_lo = none
boundary.field_hi = none
boundary.particle_lo = none
boundary.particle_hi = absorbing

warpx.serialize_initial_conditions = 1

# Verbosity
warpx.verbose = 1

# Algorithms
algo.field_gathering = energy-conserving
algo.current_deposition = esirkepov
warpx.use_filter = 0

# Order of particle shape factors
algo.particle_shape = 1

# CFL
warpx.cfl = 1

# Having this turned on makes for a more sensitive test
warpx.do_dive_cleaning = 1

# Particles
particles.species_names = electrons ions

electrons.charge = -q_e
electrons.mass = m_e
electrons.injection_style = "NUniformPerCell"
electrons.num_particles_per_cell_each_dim = 2 2
electrons.xmin =  0.e-6
electrons.xmax = 18.e-6

electrons.profile = constant
electrons.density = n0   # number of electrons per m^3
electrons.momentum_distribution_type = parse_momentum_function
electrons.momentum_function_ux(x,y,z) = "epsilon/kp*2*x/w0**2*exp(-(x**2+y**2)/w0**2)"
electrons.momentum_function_uy(x,y,z) = "epsilon/kp*2*y/w0**2*exp(-(x**2+y**2)/w0**2)"
electrons.momentum_function_uz(x,y,z) = 0.

ions.charge = q_e
ions.mass = m_p
ions.injection_style = "NUniformPerCell"
ions.num_particles_per_cell_each_dim = 2 2
ions.xmin =  0.e-6
ions.xmax = 18.e-6

ions.profile = constant
ions.density = n0   # number of ions per m^3
ions.momentum_distribution_type = at_rest

# Diagnostics
diagnostics.diags_names = diag1
diag1.intervals = 1
diag1.diag_type = Full
diag1.fields_to_plot = jr Er Bt
