# This is a time step scaling benchmark for GPU.
# Adjust max_step == number of Ranks to change the scale.

amr.n_cell = 4095 4095 112000

hipace.normalized_units = 1
hipace.verbose = 1

diagnostic.diag_type=xz
diagnostic.field_data = ExmBy Ez rhomjz jz_beam
diagnostic.beam_data = none
diagnostic.coarsening = 1 1 5
diagnostic.output_period = 0

hipace.dt = 50000/8191
hipace.depos_order_xy = 2

boundary.field = Dirichlet
boundary.particle = Periodic
geometry.prob_lo     = -20   -20    "-4*sigma_z*kp"
geometry.prob_hi     =  20    20    "4*sigma_z*kp"

amr.max_level = 0

my_constants.n0 =9.38e20 # 5.82 7.37 9.38
my_constants.wp = sqrt( n0 * q_e^2 / (m_e *epsilon0) )
my_constants.kp = wp/clight
my_constants.nb = 43e-9 /q_e / ( (2*pi)^(3/2) *sigma_x * sigma_y * sigma_z * n0 )
my_constants.sigma_x = 0.45e-3
my_constants.sigma_y = 0.54e-3
my_constants.sigma_z = 0.049  # 255e-12*clight
my_constants.emittance = 2.5e-6

beams.names = beam1
beams.reorder_period = 1

beam1.element = proton
beam1.num_particles = 268e9
beam1.density = nb
beam1.injection_type = fixed_weight_pdf
beam1.pdf = "exp(-0.5*(z/(sigma_z*kp))^2)*(z > -4*sigma_z*kp)*(z < 4*sigma_z*kp)"
beam1.position_mean =  0 0
beam1.position_std = "sigma_x*kp" "sigma_y*kp"
beam1.u_mean = 0. 0. 400/0.938+1
beam1.u_std = "emittance/sigma_x" "emittance/sigma_y" 0.003499
beam1.n_subcycles = 4

plasmas.names = electrons ions
plasmas.reorder_period = 4
plasmas.neutralize_background = 0

electrons.element = electron
electrons.density(x,y,z) = 1
electrons.ppc = 1 1

ions.element = Ar
ions.density(x,y,z) = 1
ions.ppc = 1 1

hipace.do_device_synchronize = 1

# these parameters may have to be adjusted based on the system
comms_buffer.max_leading_slices = 1000
comms_buffer.max_trailing_slices = 1000
comms_buffer.on_gpu = 1
comms_buffer.max_size_GiB = 30

# 0 1 3 7 15 31 63 127 255 511 1023 2047 8191
max_step = 0
