diff options
author | 2019-10-25 13:32:32 -0700 | |
---|---|---|
committer | 2019-10-25 13:32:32 -0700 | |
commit | c30cda342d7b4521b35706040e7159411168caed (patch) | |
tree | 2a7f2b4e26783359ab965c6aa84efbe1c2e04529 /Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration.py | |
parent | 398166af23cfadfbf989f73c9e973518ed7aca3c (diff) | |
parent | 7a2fe4f3c115eeb9bfb8d48268be53111ffd40e3 (diff) | |
download | WarpX-c30cda342d7b4521b35706040e7159411168caed.tar.gz WarpX-c30cda342d7b4521b35706040e7159411168caed.tar.zst WarpX-c30cda342d7b4521b35706040e7159411168caed.zip |
Merge pull request #477 from MaxThevenet/test_examples
Clean Examples and make sure all are tested
Diffstat (limited to 'Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration.py')
-rw-r--r-- | Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration.py | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration.py b/Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration.py new file mode 100644 index 000000000..7b1f9ea5d --- /dev/null +++ b/Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration.py @@ -0,0 +1,60 @@ +import numpy as np +from pywarpx import picmi +#from warp import picmi + +constants = picmi.constants + +nx = 64 +ny = 64 +nz = 64 + +xmin = -200.e-6 +xmax = +200.e-6 +ymin = -200.e-6 +ymax = +200.e-6 +zmin = -200.e-6 +zmax = +200.e-6 + +moving_window_velocity = [0., 0., constants.c] + +number_per_cell_each_dim = [2, 2, 1] + +grid = picmi.Cartesian3DGrid(number_of_cells = [nx, ny, nz], + lower_bound = [xmin, ymin, zmin], + upper_bound = [xmax, ymax, zmax], + lower_boundary_conditions = ['periodic', 'periodic', 'open'], + upper_boundary_conditions = ['periodic', 'periodic', 'open'], + moving_window_velocity = moving_window_velocity, + warpx_max_grid_size=32) + +solver = picmi.ElectromagneticSolver(grid=grid, cfl=1) + +beam_distribution = picmi.UniformDistribution(density = 1.e23, + lower_bound = [-20.e-6, -20.e-6, -150.e-6], + upper_bound = [+20.e-6, +20.e-6, -100.e-6], + directed_velocity = [0., 0., 1.e9]) + +plasma_distribution = picmi.UniformDistribution(density = 1.e22, + lower_bound = [-200.e-6, -200.e-6, 0.], + upper_bound = [+200.e-6, +200.e-6, 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 = 10, + verbose = 1, + warpx_plot_int = 2, + warpx_current_deposition_algo = 'esirkepov') + +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)) + +# 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() + |