-
Notifications
You must be signed in to change notification settings - Fork 232
Add PICMI Scripts for LWFA Tests #2700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
e08767c
Add PICMI Script for 2D Case
EZoni ba41e8d
Add PICMI Script for 3D Case
EZoni 24f486c
Cleaning
EZoni 2e66abb
Add PICMI Script for 1D Case
EZoni 86298a9
Add PICMI Script for RZ Case
EZoni 901f78f
Remove Old PICMI Script
EZoni d02465f
Merge ECP-WarpX:development into EZoni:lwfa_picmi
EZoni 379372c
Remove Old Test Python_LaserAccelerationMR
EZoni 692ef1a
inputs_3d: Move Inputs From runtime_params
EZoni 6db8d63
inputs_2d: Move Inputs From runtime_params
EZoni 0ceab68
Update PICMI Script for 2D Case
EZoni 0dc1d0c
Update PICMI Script for 3D Case
EZoni 04e8362
inputs_1d: Move Inputs From runtime_params
EZoni f413939
inputs_2d_rz: Move Inputs From runtime_params
EZoni cb861a2
Rename inputs_2d_rz as inputs_rz
EZoni 5836534
Update PICMI Script for 1D Case
EZoni f81541f
Update PICMI Script for RZ Case
EZoni 3abaf20
inputs_rz: Fix Diagnostic Interval
EZoni a188bf1
Fix Diagnostic Interval For All Inputs
EZoni af5ce49
Add New Test For Each PICMI Script
EZoni f042610
Remove Old PICMI Script From Workflow yml Files
EZoni d37cfdc
Dump RZ Modes for RZ Case
EZoni c60db2c
Merge remote-tracking branch 'mainline/development' into lwfa_picmi
ax3l 2c3ddab
LWFA PICMI: Add Shellbang
ax3l File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
Examples/Physics_applications/laser_acceleration/PICMI_inputs_1d.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| from pywarpx import picmi | ||
|
|
||
| # Physical constants | ||
| c = picmi.constants.c | ||
| q_e = picmi.constants.q_e | ||
|
|
||
| # Number of time steps | ||
| max_steps = 1000 | ||
|
|
||
| # Number of cells | ||
| nz = 512 | ||
|
|
||
| # Physical domain | ||
| zmin = -56e-06 | ||
| zmax = 12e-06 | ||
|
|
||
| # Domain decomposition | ||
| max_grid_size = 64 | ||
| blocking_factor = 32 | ||
|
|
||
| # Create grid | ||
| 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 = [0., 0., c], | ||
| warpx_max_grid_size = max_grid_size, | ||
| warpx_blocking_factor = blocking_factor) | ||
|
|
||
| # Particles: plasma electrons | ||
| plasma_density = 2e23 | ||
| plasma_xmin = None | ||
| plasma_ymin = None | ||
| plasma_zmin = 10e-06 | ||
| plasma_xmax = None | ||
| plasma_ymax = None | ||
| plasma_zmax = None | ||
| uniform_distribution = picmi.UniformDistribution( | ||
| density = plasma_density, | ||
| lower_bound = [plasma_xmin, plasma_ymin, plasma_zmin], | ||
| upper_bound = [plasma_xmax, plasma_ymax, plasma_zmax], | ||
| fill_in = True) | ||
| electrons = picmi.Species( | ||
| particle_type = 'electron', | ||
| name = 'electrons', | ||
| initial_distribution = uniform_distribution) | ||
|
|
||
| # Laser | ||
| e_max = 16e12 | ||
| position_z = 9e-06 | ||
| profile_t_peak = 30.e-15 | ||
| profile_focal_distance = 100e-06 | ||
| laser = picmi.GaussianLaser( | ||
| wavelength = 0.8e-06, | ||
| waist = 5e-06, | ||
| duration = 15e-15, | ||
| focal_position = [0, 0, profile_focal_distance + position_z], | ||
| centroid_position = [0, 0, position_z - c*profile_t_peak], | ||
| propagation_direction = [0, 0, 1], | ||
| polarization_direction = [0, 1, 0], | ||
| E0 = e_max, | ||
| fill_in = False) | ||
| laser_antenna = picmi.LaserAntenna( | ||
| position = [0., 0., position_z], | ||
| normal_vector = [0, 0, 1]) | ||
|
|
||
| # Electromagnetic solver | ||
| solver = picmi.ElectromagneticSolver( | ||
| grid = grid, | ||
| method = 'Yee', | ||
| cfl = 0.9, | ||
| divE_cleaning = 0) | ||
|
|
||
| # Diagnostics | ||
| diag_field_list = ["B", "E", "J", "rho"] | ||
| field_diag = picmi.FieldDiagnostic( | ||
| name = 'diag1', | ||
| grid = grid, | ||
| period = 1000, | ||
| data_list = diag_field_list) | ||
|
|
||
| # Set up simulation | ||
| sim = picmi.Simulation( | ||
| solver = solver, | ||
| max_steps = max_steps, | ||
| verbose = 1, | ||
| particle_shape = 'cubic', | ||
| warpx_use_filter = 1) | ||
|
|
||
| # Add plasma electrons | ||
| sim.add_species( | ||
| electrons, | ||
| layout = picmi.GriddedLayout(grid = grid, n_macroparticle_per_cell = [10])) | ||
|
|
||
| # Add laser | ||
| sim.add_laser( | ||
| laser, | ||
| injection_method = laser_antenna) | ||
|
|
||
| # Add diagnostics | ||
| sim.add_diagnostic(field_diag) | ||
|
|
||
| # Write input file that can be used to run with the compiled version | ||
| sim.write_input_file(file_name = 'inputs_1d_picmi') | ||
|
|
||
| # Initialize inputs and WarpX instance | ||
| sim.initialize_inputs() | ||
| sim.initialize_warpx() | ||
|
|
||
| # Advance simulation until last time step | ||
| sim.step(max_steps) |
148 changes: 148 additions & 0 deletions
148
Examples/Physics_applications/laser_acceleration/PICMI_inputs_2d.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| from pywarpx import picmi | ||
|
|
||
| # Physical constants | ||
| c = picmi.constants.c | ||
| q_e = picmi.constants.q_e | ||
|
|
||
| # Number of time steps | ||
| max_steps = 1000 | ||
|
|
||
| # Number of cells | ||
| nx = 64 | ||
| nz = 512 | ||
|
|
||
| # Physical domain | ||
| xmin = -30e-06 | ||
| xmax = 30e-06 | ||
| zmin = -56e-06 | ||
| zmax = 12e-06 | ||
|
|
||
| # Domain decomposition | ||
| max_grid_size = 64 | ||
| blocking_factor = 32 | ||
|
|
||
| # Create grid | ||
| grid = picmi.Cartesian2DGrid( | ||
| number_of_cells = [nx, nz], | ||
| lower_bound = [xmin, zmin], | ||
| upper_bound = [xmax, zmax], | ||
| lower_boundary_conditions = ['open', 'open'], | ||
| upper_boundary_conditions = ['open', 'open'], | ||
| lower_boundary_conditions_particles = ['absorbing', 'absorbing'], | ||
| upper_boundary_conditions_particles = ['absorbing', 'absorbing'], | ||
| moving_window_velocity = [0., c], | ||
| warpx_max_grid_size = max_grid_size, | ||
| warpx_blocking_factor = blocking_factor) | ||
|
|
||
| # Particles: plasma electrons | ||
| plasma_density = 2e23 | ||
| plasma_xmin = -20e-06 | ||
| plasma_ymin = None | ||
| plasma_zmin = 10e-06 | ||
| plasma_xmax = 20e-06 | ||
| plasma_ymax = None | ||
| plasma_zmax = None | ||
| uniform_distribution = picmi.UniformDistribution( | ||
| density = plasma_density, | ||
| lower_bound = [plasma_xmin, plasma_ymin, plasma_zmin], | ||
| upper_bound = [plasma_xmax, plasma_ymax, plasma_zmax], | ||
| fill_in = True) | ||
| electrons = picmi.Species( | ||
| particle_type = 'electron', | ||
| name = 'electrons', | ||
| initial_distribution = uniform_distribution) | ||
|
|
||
| # Particles: beam electrons | ||
| q_tot = 1e-12 | ||
| x_m = 0. | ||
| y_m = 0. | ||
| z_m = -28e-06 | ||
| x_rms = 0.5e-06 | ||
| y_rms = 0.5e-06 | ||
| z_rms = 0.5e-06 | ||
| ux_m = 0. | ||
| uy_m = 0. | ||
| uz_m = 500. | ||
| ux_th = 2. | ||
| uy_th = 2. | ||
| uz_th = 50. | ||
| gaussian_bunch_distribution = picmi.GaussianBunchDistribution( | ||
| n_physical_particles = q_tot / q_e, | ||
| rms_bunch_size = [x_rms, y_rms, z_rms], | ||
| rms_velocity = [c*ux_th, c*uy_th, c*uz_th], | ||
| centroid_position = [x_m, y_m, z_m], | ||
| centroid_velocity = [c*ux_m, c*uy_m, c*uz_m]) | ||
| beam = picmi.Species( | ||
| particle_type = 'electron', | ||
| name = 'beam', | ||
| initial_distribution = gaussian_bunch_distribution) | ||
|
|
||
| # Laser | ||
| e_max = 16e12 | ||
| position_z = 9e-06 | ||
| profile_t_peak = 30.e-15 | ||
| profile_focal_distance = 100e-06 | ||
| laser = picmi.GaussianLaser( | ||
| wavelength = 0.8e-06, | ||
| waist = 5e-06, | ||
| duration = 15e-15, | ||
| focal_position = [0, 0, profile_focal_distance + position_z], | ||
| centroid_position = [0, 0, position_z - c*profile_t_peak], | ||
| propagation_direction = [0, 0, 1], | ||
| polarization_direction = [0, 1, 0], | ||
| E0 = e_max, | ||
| fill_in = False) | ||
| laser_antenna = picmi.LaserAntenna( | ||
| position = [0., 0., position_z], | ||
| normal_vector = [0, 0, 1]) | ||
|
|
||
| # Electromagnetic solver | ||
| solver = picmi.ElectromagneticSolver( | ||
| grid = grid, | ||
| method = 'Yee', | ||
| cfl = 1., | ||
| divE_cleaning = 0) | ||
|
|
||
| # Diagnostics | ||
| diag_field_list = ["B", "E", "J", "rho"] | ||
| field_diag = picmi.FieldDiagnostic( | ||
| name = 'diag1', | ||
| grid = grid, | ||
| period = 1000, | ||
| data_list = diag_field_list) | ||
|
|
||
| # Set up simulation | ||
| sim = picmi.Simulation( | ||
| solver = solver, | ||
| max_steps = max_steps, | ||
| verbose = 1, | ||
| particle_shape = 'cubic', | ||
| warpx_use_filter = 1) | ||
|
|
||
| # Add plasma electrons | ||
| sim.add_species( | ||
| electrons, | ||
| layout = picmi.GriddedLayout(grid = grid, n_macroparticle_per_cell = [1, 1, 1])) | ||
|
|
||
| # Add beam electrons | ||
| sim.add_species( | ||
| beam, | ||
| layout = picmi.PseudoRandomLayout(grid = grid, n_macroparticles = 100)) | ||
|
|
||
| # Add laser | ||
| sim.add_laser( | ||
| laser, | ||
| injection_method = laser_antenna) | ||
|
|
||
| # Add diagnostics | ||
| sim.add_diagnostic(field_diag) | ||
|
|
||
| # Write input file that can be used to run with the compiled version | ||
| sim.write_input_file(file_name = 'inputs_2d_picmi') | ||
|
|
||
| # Initialize inputs and WarpX instance | ||
| sim.initialize_inputs() | ||
| sim.initialize_warpx() | ||
|
|
||
| # Advance simulation until last time step | ||
| sim.step(max_steps) |
121 changes: 121 additions & 0 deletions
121
Examples/Physics_applications/laser_acceleration/PICMI_inputs_3d.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| from pywarpx import picmi | ||
|
|
||
| # Physical constants | ||
| c = picmi.constants.c | ||
| q_e = picmi.constants.q_e | ||
|
|
||
| # Number of time steps | ||
| max_steps = 1000 | ||
|
|
||
| # Number of cells | ||
| nx = 64 | ||
| ny = 64 | ||
| nz = 512 | ||
|
|
||
| # Physical domain | ||
| xmin = -30e-06 | ||
| xmax = 30e-06 | ||
| ymin = -30e-06 | ||
| ymax = 30e-06 | ||
| zmin = -56e-06 | ||
| zmax = 12e-06 | ||
|
|
||
| # Domain decomposition | ||
| max_grid_size = 64 | ||
| blocking_factor = 32 | ||
|
|
||
| # Create grid | ||
| grid = picmi.Cartesian3DGrid( | ||
| number_of_cells = [nx, ny, nz], | ||
| lower_bound = [xmin, ymin, zmin], | ||
| upper_bound = [xmax, ymax, zmax], | ||
| lower_boundary_conditions = ['periodic', 'periodic', 'dirichlet'], | ||
| upper_boundary_conditions = ['periodic', 'periodic', 'dirichlet'], | ||
| lower_boundary_conditions_particles = ['periodic', 'periodic', 'absorbing'], | ||
| upper_boundary_conditions_particles = ['periodic', 'periodic', 'absorbing'], | ||
| moving_window_velocity = [0., 0., c], | ||
| warpx_max_grid_size = max_grid_size, | ||
| warpx_blocking_factor = blocking_factor) | ||
|
|
||
| # Particles: plasma electrons | ||
| plasma_density = 2e23 | ||
| plasma_xmin = -20e-06 | ||
| plasma_ymin = -20e-06 | ||
| plasma_zmin = 10e-06 | ||
| plasma_xmax = 20e-06 | ||
| plasma_ymax = 20e-06 | ||
| plasma_zmax = None | ||
| uniform_distribution = picmi.UniformDistribution( | ||
| density = plasma_density, | ||
| lower_bound = [plasma_xmin, plasma_ymin, plasma_zmin], | ||
| upper_bound = [plasma_xmax, plasma_ymax, plasma_zmax], | ||
| fill_in = True) | ||
| electrons = picmi.Species( | ||
| particle_type = 'electron', | ||
| name = 'electrons', | ||
| initial_distribution = uniform_distribution) | ||
|
|
||
| # Laser | ||
| e_max = 16e12 | ||
| position_z = 9e-06 | ||
| profile_t_peak = 30.e-15 | ||
| profile_focal_distance = 100e-06 | ||
| laser = picmi.GaussianLaser( | ||
| wavelength = 0.8e-06, | ||
| waist = 5e-06, | ||
| duration = 15e-15, | ||
| focal_position = [0, 0, profile_focal_distance + position_z], | ||
| centroid_position = [0, 0, position_z - c*profile_t_peak], | ||
| propagation_direction = [0, 0, 1], | ||
| polarization_direction = [0, 1, 0], | ||
| E0 = e_max, | ||
| fill_in = False) | ||
| laser_antenna = picmi.LaserAntenna( | ||
| position = [0., 0., position_z], | ||
| normal_vector = [0, 0, 1]) | ||
|
|
||
| # Electromagnetic solver | ||
| solver = picmi.ElectromagneticSolver( | ||
| grid = grid, | ||
| method = 'Yee', | ||
| cfl = 1., | ||
| divE_cleaning = 0) | ||
|
|
||
| # Diagnostics | ||
| diag_field_list = ["B", "E", "J", "rho"] | ||
| field_diag = picmi.FieldDiagnostic( | ||
| name = 'diag1', | ||
| grid = grid, | ||
| period = 1000, | ||
| data_list = diag_field_list) | ||
|
|
||
| # Set up simulation | ||
| sim = picmi.Simulation( | ||
| solver = solver, | ||
| max_steps = max_steps, | ||
| verbose = 1, | ||
| particle_shape = 'cubic', | ||
| warpx_use_filter = 1) | ||
|
|
||
| # Add plasma electrons | ||
| sim.add_species( | ||
| electrons, | ||
| layout = picmi.GriddedLayout(grid = grid, n_macroparticle_per_cell = [1, 1, 1])) | ||
|
|
||
| # Add laser | ||
| sim.add_laser( | ||
| laser, | ||
| injection_method = laser_antenna) | ||
|
|
||
| # Add diagnostics | ||
| sim.add_diagnostic(field_diag) | ||
|
|
||
| # Write input file that can be used to run with the compiled version | ||
| sim.write_input_file(file_name = 'inputs_3d_picmi') | ||
|
|
||
| # Initialize inputs and WarpX instance | ||
| sim.initialize_inputs() | ||
| sim.initialize_warpx() | ||
|
|
||
| # Advance simulation until last time step | ||
| sim.step(max_steps) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.