-
Notifications
You must be signed in to change notification settings - Fork 200
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
update PWFA example #4535
Open
RTSandberg
wants to merge
15
commits into
BLAST-WarpX:development
Choose a base branch
from
RTSandberg:topic-documentation-pwfa_ex
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
update PWFA example #4535
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ceb38a8
update pwfa example
RTSandberg 01f8fc7
update figure links, fix small things
RTSandberg ca5b702
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 8106955
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 40c75d1
Apply suggestions from code review
RTSandberg 2245f14
clean figures, docs, links
RTSandberg a45d594
start openPMD checksum analysis
RTSandberg 1d19115
reset benchmark for Python_PlasmaAcceleration because example was red…
6022a43
reset benchmark for PlasmaAccelerationBoost2d because moved to openPMD
05532a1
set openPMD benchmark for PlasmaAccelerationBoost2d
2cac4ee
set openPMD benchmark for PlasmaAccelerationBoost3d
3901253
set diagnostic directory so regression script can find
RTSandberg 843b299
reset benchmark for PlasmaAcceleration2d_boost from Azure to ensure t…
50d2c9c
reset benchmark for Python_PlasmaAcceleration because test was redone…
efceb94
Merge branch 'development' into topic-documentation-pwfa_ex
RemiLehe 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
Binary file not shown.
This file contains 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
This file contains 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
This file contains 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
80 changes: 0 additions & 80 deletions
80
Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration.py
This file was deleted.
Oops, something went wrong.
172 changes: 172 additions & 0 deletions
172
Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration_3d.py
This file contains 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,172 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from pywarpx import picmi | ||
|
||
c = picmi.constants.c | ||
q_e = picmi.constants.q_e | ||
m_e = picmi.constants.m_e | ||
m_p = picmi.constants.m_p | ||
ep0 = picmi.constants.ep0 | ||
|
||
nx = 64 | ||
nz = 64 | ||
|
||
xmin = -100.e-6 | ||
xmax = +100.e-6 | ||
zmin = -149.e-6 | ||
zmax = +1.e-6 | ||
|
||
moving_window_velocity = [0., 0., c] | ||
gamma_boost = 10.0 | ||
|
||
npc_x = 1 | ||
npc_z = 1 | ||
|
||
max_steps = 10 | ||
|
||
field_bc_z='open' | ||
field_bc_x='open' | ||
grid = picmi.Cartesian3DGrid( | ||
number_of_cells = [nx, nx, nz], | ||
lower_bound = [xmin, xmin, zmin], | ||
upper_bound = [xmax, xmax, zmax], | ||
lower_boundary_conditions = [field_bc_x, field_bc_x, field_bc_z], | ||
upper_boundary_conditions = [field_bc_x, field_bc_x, field_bc_z], | ||
lower_boundary_conditions_particles = ['absorbing']*3, | ||
upper_boundary_conditions_particles = ['absorbing']*3, | ||
moving_window_velocity = moving_window_velocity, | ||
warpx_blocking_factor = 32, | ||
warpx_max_grid_size=128 | ||
) | ||
|
||
smoother = picmi.BinomialSmoother(n_pass=[1]*3) | ||
solver = picmi.ElectromagneticSolver( | ||
method='CKC', | ||
grid=grid, | ||
cfl=0.99, | ||
source_smoother=smoother, | ||
warpx_pml_ncell=10) | ||
|
||
drive_charge = -10e-11 | ||
driver_gaussian_distribution = picmi.GaussianBunchDistribution( | ||
n_physical_particles= abs(drive_charge) / q_e, | ||
rms_bunch_size=[2e-6, 2e-6, 4.e-6], | ||
rms_velocity=[2.*c, 2.*c, 2.e4*c], | ||
centroid_position=[0., 0., -20.e-6], | ||
centroid_velocity=[0., 0., 2.e5*c], | ||
) | ||
beam_charge = -3.e-13 | ||
beam_z0 = -90e-6 | ||
beam_gaussian_distribution = picmi.GaussianBunchDistribution( | ||
n_physical_particles= abs(beam_charge) / q_e, | ||
rms_bunch_size=[0.5e-6, 0.5e-6, 1.e-6], | ||
rms_velocity=[2.*c, 2.*c, 200.*c], | ||
centroid_position=[0., 0., beam_z0], | ||
centroid_velocity=[0., 0., 4000.*c], | ||
) | ||
|
||
dens = 1.e23 | ||
lramp = 8.e-3 | ||
plasma_distribution = picmi.AnalyticDistribution( | ||
density_expression= | ||
f'(z<lramp)*0.5*(1-cos(pi*z/lramp))*dens+(z>lramp)*dens', | ||
pi=3.141592653589793, | ||
dens=dens, | ||
lramp = lramp, | ||
lower_bound=[-70.e-6, -70.e-6, 0.], | ||
upper_bound=[70.e-6, 70.e-6, 0.2], | ||
fill_in=True) | ||
|
||
beam = picmi.Species( | ||
particle_type='electron', | ||
name='beam', | ||
initial_distribution=beam_gaussian_distribution) | ||
driver = picmi.Species( | ||
particle_type='electron', | ||
name='driver', | ||
initial_distribution=driver_gaussian_distribution) | ||
plasma_e = picmi.Species( | ||
particle_type='electron', | ||
name='plasma_e', | ||
initial_distribution=plasma_distribution) | ||
plasma_i = picmi.Species( | ||
particle_type='proton', | ||
name='plasma_p', | ||
initial_distribution=plasma_distribution) | ||
|
||
sim = picmi.Simulation( | ||
solver = solver, | ||
max_steps = max_steps, | ||
verbose = 1, | ||
warpx_use_filter = 0, | ||
gamma_boost = gamma_boost, | ||
warpx_use_fdtd_nci_corr = True, | ||
particle_shape='cubic' | ||
) | ||
|
||
sim.add_species_through_plane( | ||
beam, | ||
layout=picmi.PseudoRandomLayout( | ||
grid=grid, | ||
n_macroparticles=1000 | ||
), | ||
injection_plane_position=0., | ||
injection_plane_normal_vector=[0.,0.,1.] | ||
) | ||
sim.add_species_through_plane( | ||
driver, | ||
layout=picmi.PseudoRandomLayout( | ||
grid=grid, | ||
n_macroparticles=1000 | ||
), | ||
injection_plane_position=0., | ||
injection_plane_normal_vector=[0.,0.,1.] | ||
) | ||
sim.add_species( | ||
plasma_e, | ||
layout=picmi.GriddedLayout( | ||
grid=grid, | ||
n_macroparticle_per_cell=[npc_x, npc_x, npc_z] | ||
) | ||
) | ||
sim.add_species( | ||
plasma_i, | ||
layout=picmi.GriddedLayout( | ||
grid=grid, | ||
n_macroparticle_per_cell=[npc_x, npc_x, npc_z] | ||
) | ||
) | ||
|
||
field_diag = picmi.FieldDiagnostic( | ||
name = 'Python_PlasmaAcceleration_plt', | ||
grid = grid, | ||
period = max_steps, | ||
data_list = ['Ex', 'Ey', 'Ez', 'Jx', 'Jy', 'Jz', 'part_per_cell'], | ||
# write_dir='Python_PlasmaAcceleration_plt', | ||
warpx_format='openpmd', | ||
) | ||
|
||
part_diag = picmi.ParticleDiagnostic( | ||
name = 'Python_PlasmaAcceleration_plt', | ||
period = max_steps, | ||
species = [driver, beam, plasma_e], | ||
# write_dir='Python_PlasmaAcceleration_plt', | ||
warpx_format='openpmd', | ||
) | ||
|
||
beamrel_red_diag = picmi.ReducedDiagnostic( | ||
diag_type='BeamRelevant', | ||
name='beamrel', | ||
species=beam, | ||
period=10) | ||
|
||
sim.add_diagnostic(field_diag) | ||
sim.add_diagnostic(part_diag) | ||
sim.add_diagnostic(beamrel_red_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() |
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.