diff options
author | 2021-12-09 10:17:36 -0800 | |
---|---|---|
committer | 2021-12-09 10:17:36 -0800 | |
commit | f322cfc064e44588dc2548ebe9d9e000cfb34b12 (patch) | |
tree | 3459130d47628b1eedc911725c8a3898bb90a5c3 /Examples/Physics_applications | |
parent | a7ef28c432b9eda09d10c9682b2596e44b193e69 (diff) | |
download | WarpX-f322cfc064e44588dc2548ebe9d9e000cfb34b12.tar.gz WarpX-f322cfc064e44588dc2548ebe9d9e000cfb34b12.tar.zst WarpX-f322cfc064e44588dc2548ebe9d9e000cfb34b12.zip |
1D tests for plasma acceleration (#2593)
* modify requirements.txt and add input file for 1D Python pwfa
* add 1D Python plasma acceleration test to CI
* picmi version
* USE_PSATD=OFF for 1D
* Update Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration_1d.py
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
* Update Regression/WarpX-tests.ini
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
* Cartesian1D class in pywarpx/picmi.py
* requirements.txt: update picmistandard
* update picmi version
* requirements.txt: revert unintended changes
* 1D Laser Acceleration Test
* Update Examples/Physics_applications/laser_acceleration/inputs_1d
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
* Update Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration_1d.py
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
* add data_list to PICMI laser_acceleration test
* increase max steps and fix bug in pywarpx/picmi.py 1DCartesian moving window direction
* add data_lust to Python laser acceleration test
* picmistandard update
Co-authored-by: Prabhat Kumar <prabhatkumar@kraken.dhcp.lbl.gov>
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Diffstat (limited to 'Examples/Physics_applications')
3 files changed, 139 insertions, 1 deletions
diff --git a/Examples/Physics_applications/laser_acceleration/PICMI_inputs_laser_acceleration.py b/Examples/Physics_applications/laser_acceleration/PICMI_inputs_laser_acceleration.py index 87d02472c..7e75e14de 100755 --- a/Examples/Physics_applications/laser_acceleration/PICMI_inputs_laser_acceleration.py +++ b/Examples/Physics_applications/laser_acceleration/PICMI_inputs_laser_acceleration.py @@ -114,7 +114,8 @@ field_diag1 = picmi.FieldDiagnostic(name = 'diag1', part_diag1 = picmi.ParticleDiagnostic(name = 'diag1', period = 10, - species = [electrons]) + species = [electrons], + data_list = ['ux', 'uy', 'uz', 'weighting']) ########################## # simulation setup diff --git a/Examples/Physics_applications/laser_acceleration/inputs_1d b/Examples/Physics_applications/laser_acceleration/inputs_1d new file mode 100644 index 000000000..55a55969a --- /dev/null +++ b/Examples/Physics_applications/laser_acceleration/inputs_1d @@ -0,0 +1,66 @@ +################################# +####### GENERAL PARAMETERS ###### +################################# +max_step = 1000 +amr.n_cell = 512 +amr.max_grid_size = 64 # maximum size of each AMReX box, used to decompose the domain +amr.blocking_factor = 32 # minimum size of each AMReX box, used to decompose the domain +geometry.coord_sys = 0 # 0: Cartesian +geometry.prob_lo = -56.e-6 # physical domain +geometry.prob_hi = 12.e-6 +amr.max_level = 0 # Maximum level in hierarchy (1 might be unstable, >1 is not supported) + +################################# +####### Boundary condition ###### +################################# +boundary.field_lo = pec +boundary.field_hi = pec + +################################# +############ NUMERICS ########### +################################# +warpx.verbose = 1 +warpx.do_dive_cleaning = 0 +warpx.use_filter = 1 +warpx.cfl = 0.9 # if 1., the time step is set to its CFL limit +warpx.do_moving_window = 1 +warpx.moving_window_dir = z # Only z is supported for the moment +warpx.moving_window_v = 1.0 # units of speed of light + +# Order of particle shape factors +algo.particle_shape = 3 + +################################# +############ PLASMA ############# +################################# +particles.species_names = electrons + +electrons.species_type = electron +electrons.injection_style = "NUniformPerCell" +electrons.num_particles_per_cell_each_dim = 10 +electrons.zmin = 10.e-6 +electrons.profile = constant +electrons.density = 2.e23 # number of electrons per m^3 +electrons.momentum_distribution_type = "at_rest" +electrons.do_continuous_injection = 1 + +################################# +############ PLASMA ############# +################################# +lasers.names = laser1 +laser1.profile = Gaussian +laser1.position = 0. 0. 9.e-6 # This point is on the laser plane +laser1.direction = 0. 0. 1. # The plane normal direction +laser1.polarization = 0. 1. 0. # The main polarization vector +laser1.e_max = 16.e12 # Maximum amplitude of the laser field (in V/m) +laser1.profile_waist = 5.e-6 # The waist of the laser (in m) +laser1.profile_duration = 15.e-15 # The duration of the laser (in s) +laser1.profile_t_peak = 30.e-15 # Time at which the laser reaches its peak (in s) +laser1.profile_focal_distance = 100.e-6 # Focal distance from the antenna (in m) +laser1.wavelength = 0.8e-6 # The wavelength of the laser (in m) + +# Diagnostics +diagnostics.diags_names = diag1 +diag1.intervals = 200 +diag1.diag_type = Full +diag1.fields_to_plot = Ex Ey Ez Bx By Bz jx jy jz rho diff --git a/Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration_1d.py b/Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration_1d.py new file mode 100644 index 000000000..a604c0cd4 --- /dev/null +++ b/Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration_1d.py @@ -0,0 +1,71 @@ +from pywarpx import picmi +#from warp import picmi + +constants = picmi.constants + +nz = 64 + +zmin = -200.e-6 +zmax = +200.e-6 + +moving_window_velocity = [0., 0., constants.c] + +number_per_cell_each_dim = [10] + +max_steps = 1000 + +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 = moving_window_velocity, + warpx_max_grid_size=32) + +solver = picmi.ElectromagneticSolver(grid=grid, cfl=0.999) + +beam_distribution = picmi.UniformDistribution(density = 1.e23, + lower_bound = [None, None, -150.e-6], + upper_bound = [None, None, -100.e-6], + directed_velocity = [0., 0., 1.e9]) + +plasma_distribution = picmi.UniformDistribution(density = 1.e22, + lower_bound = [None, None, 0.], + upper_bound = [None, None, None], + fill_in = True) + +beam = picmi.Species(particle_type='electron', name='beam', initial_distribution=beam_distribution) +plasma = picmi.Species(particle_type='electron', name='plasma', initial_distribution=plasma_distribution) + +sim = picmi.Simulation(solver = solver, + max_steps = max_steps, + verbose = 1, + warpx_current_deposition_algo = 'esirkepov', + warpx_use_filter = 0) + +sim.add_species(beam, layout=picmi.GriddedLayout(grid=grid, n_macroparticle_per_cell=number_per_cell_each_dim)) +sim.add_species(plasma, layout=picmi.GriddedLayout(grid=grid, n_macroparticle_per_cell=number_per_cell_each_dim)) + +field_diag = picmi.FieldDiagnostic(name = 'diag1', + grid = grid, + period = max_steps, + data_list = ['Ex', 'Ey', 'Ez', 'Jx', 'Jy', 'Jz', 'part_per_cell'], + write_dir = '.', + warpx_file_prefix = 'Python_PlasmaAcceleration_plt') + +part_diag = picmi.ParticleDiagnostic(name = 'diag1', + period = max_steps, + species = [beam, plasma], + data_list = ['ux', 'uy', 'uz', 'weighting']) + +sim.add_diagnostic(field_diag) +sim.add_diagnostic(part_diag) + +# write_inputs will create an inputs file that can be used to run +# with the compiled version. +#sim.write_input_file(file_name = 'inputs_from_PICMI') + +# Alternatively, sim.step will run WarpX, controlling it from Python +sim.step() |