Skip to content
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

[WIP] Add 3D FEL example #5429

Open
wants to merge 62 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
a2df74a
General moving-window transformations in boosted-frame simulations
bnara Sep 8, 2024
5ea727d
Default speed of moving window to speed of boosted frame
bnara Sep 9, 2024
09d4ed7
Extend simulation volume enough so that particles don't exit
bnara Sep 9, 2024
3df0002
Add inputs script for FEL
RemiLehe Sep 26, 2024
868d1e4
Add positrons
RemiLehe Sep 26, 2024
0dcd093
Add absorbing boundary conditions
RemiLehe Sep 26, 2024
0fa13a0
Use correct gamm_f
RemiLehe Sep 26, 2024
580e236
Correct box size
RemiLehe Sep 26, 2024
0f1da2c
Prepare moving window and BTD
RemiLehe Sep 26, 2024
d7297c7
Add CMake file for free-electron laser test
RemiLehe Sep 26, 2024
2af7c20
Add automated test
RemiLehe Sep 26, 2024
031decd
Add check for the wavelength
RemiLehe Sep 26, 2024
201472c
Add backtransformed diagnostics
RemiLehe Sep 26, 2024
6fb9bac
Check lab-frame files
RemiLehe Sep 26, 2024
da3bb83
Add 3D script
RemiLehe Sep 26, 2024
d19e4a7
Add ramps and compensating kicks
RemiLehe Sep 26, 2024
bd6abc5
Correct the density in order to take into account the two beams
RemiLehe Sep 26, 2024
3abd31b
Remove kicks in 1D ; higher tolerances
RemiLehe Sep 26, 2024
6c699d3
Remove 3D example for now
RemiLehe Sep 27, 2024
32e5e84
Add new example
RemiLehe Sep 27, 2024
a6f9ab7
Add example for free-electron laser
RemiLehe Sep 27, 2024
e037329
Add checksum
RemiLehe Sep 27, 2024
9e8f9f7
Include moving window speed in diag_lo and diag_hi transformations
bnara Sep 27, 2024
388c93e
More specific citation
RemiLehe Sep 27, 2024
9c85737
Update Examples/Physics_applications/free_electron_laser/README.rst
RemiLehe Sep 27, 2024
e49dfa4
Add benchmark file
RemiLehe Sep 27, 2024
8cf934e
Merge branch 'fel' of github.com:RemiLehe/WarpX into fel
RemiLehe Sep 27, 2024
478f3cf
Modify bounds so as to produce the same results as in previous versions
RemiLehe Sep 27, 2024
7af8f79
Update checksums
RemiLehe Sep 28, 2024
b4b9e0b
Merge branch 'boosted_mw' into fel
RemiLehe Sep 28, 2024
71c616c
Update simulation bounds
RemiLehe Sep 28, 2024
9264525
Update simulation script
RemiLehe Sep 28, 2024
947f223
Update checksums
RemiLehe Sep 28, 2024
c815eeb
Merge branch 'development' into fel
RemiLehe Sep 28, 2024
216a7e3
Update size of the moving window
RemiLehe Sep 28, 2024
3d4c608
Update boosted-frame for arbitrary mobing window
RemiLehe Sep 28, 2024
5a2b025
Update beam position
RemiLehe Sep 28, 2024
bf534c6
Correct boosted-frame for arbitrary moving window
RemiLehe Sep 28, 2024
6da3106
Update time to final timestep
RemiLehe Sep 28, 2024
828e3e4
Let simulation determine how many steps to take
RemiLehe Sep 28, 2024
02c1dee
Reach staturation
RemiLehe Sep 29, 2024
dcc0dc2
Avoid interpolating from guard cells in BTD
RemiLehe Sep 29, 2024
15208c6
Avoid interpolating from guard cells in BTD
RemiLehe Sep 29, 2024
2e3bcfa
Change max_grid_size
RemiLehe Sep 29, 2024
4ced35f
Evaluate checksum from BTD
RemiLehe Sep 29, 2024
6aa1382
Update scripts
RemiLehe Sep 29, 2024
c935ae3
Add plot script
RemiLehe Sep 29, 2024
3e905d2
Update documentation page
RemiLehe Sep 29, 2024
97447e6
Update checksum
RemiLehe Sep 29, 2024
dfc77ad
Merge branch 'avoid_btd_guard_cells' into fel
RemiLehe Sep 29, 2024
d532b02
Reactivate checksum
RemiLehe Sep 30, 2024
703fa33
Update checksum
RemiLehe Sep 30, 2024
b79a8ad
Add 3D example script
RemiLehe Sep 30, 2024
44aa5d8
Rely on rigid injection for injection into the undulator
RemiLehe Oct 1, 2024
5421ff4
Use rigid advance
RemiLehe Oct 1, 2024
2274673
Center field scaling around v push
RemiLehe Oct 1, 2024
d2e1b1c
Merge branch 'fel' into fel_3d
RemiLehe Oct 1, 2024
a8e8a6d
Update script
RemiLehe Oct 1, 2024
8ef326e
Merge branch 'development' into fel_3d
RemiLehe Oct 30, 2024
3a9fc1d
Merge branch 'development' into fel_3d
RemiLehe Nov 12, 2024
90c9407
Fix conflicts
RemiLehe Nov 13, 2024
7dbef7b
Reintroduce rigid advance
RemiLehe Nov 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def extract_peak_E_lab(iteration):
assert abs(lambda_radiation_lab - lambda_expected) / lambda_expected < 0.01

# Analyze the diagnostics showing quantities in the boosted frame
ts = OpenPMDTimeSeries("diags/diag_boostedframe")
root = os.path.split(filename)[0]
ts = OpenPMDTimeSeries(root + "/diag_boostedframe")


# Extract the growth of the peak electric field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ electrons.uz = gamma_bunch
electrons.zmax = -25e-6
electrons.zmin = -125e-6
electrons.zinject_plane=0.0
electrons.rigid_advance=0
electrons.rigid_advance = 0

positrons.charge = q_e
positrons.injection_style = nuniformpercell
Expand All @@ -77,7 +77,7 @@ positrons.uz = gamma_bunch
positrons.zmax = -25e-6
positrons.zmin = -125e-6
positrons.zinject_plane=0.0
positrons.rigid_advance=0
positrons.rigid_advance = 0

warpx.do_moving_window = 1
warpx.moving_window_dir = z
Expand All @@ -86,7 +86,7 @@ warpx.moving_window_v = sqrt(1-(1+K*K/2)/(gamma_bunch*gamma_bunch))
# Undulator field
particles.B_ext_particle_init_style = parse_B_ext_particle_function
particles.Bx_external_particle_function(x,y,z,t) = 0
particles.By_external_particle_function(x,y,z,t) = if( z>0, Bu*cos(k_u*z), 0 )
particles.By_external_particle_function(x,y,z,t) = Bu*cos(k_u*z)
particles.Bz_external_particle_function(x,y,z,t) =0.0

warpx.cfl = 0.99
101 changes: 101 additions & 0 deletions Examples/Physics_applications/free_electron_laser/inputs_test_3d_fel
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
my_constants.gamma_bunch=100.6
my_constants.Bu = 0.5
my_constants.lambda_u = 3e-2
my_constants.k_u= 2*pi/lambda_u
my_constants.K = q_e*Bu/(m_e*clight*k_u) # Undulator parameter

warpx.gamma_boost = gamma_bunch/sqrt(1+K*K/2) # Lorentz factor of the ponderomotive frame
warpx.boost_direction = z
algo.maxwell_solver = yee
algo.particle_shape = 2
algo.particle_pusher = vay

# geometry
geometry.dims = 3
geometry.prob_hi = 400e-6 400e-6 0
geometry.prob_lo = -400e-6 -400e-6 -192e-6

amr.max_level = 0
amr.n_cell = 16 16 1024
amr.max_grid_size = 1024

# boundary
boundary.field_hi = pml pml pml
boundary.field_lo = pml pml pml
boundary.particle_hi = absorbing absorbing absorbing
boundary.particle_lo = absorbing absorbing absorbing

# diagnostics
diagnostics.diags_names = diag_labframe diag_boostedframe

# Diagnostic that show quantities in the frame
# of the simulation (boosted-frame)
diag_boostedframe.diag_type = Full
diag_boostedframe.format = openpmd
diag_boostedframe.intervals = 100
diag_boostedframe.fields_to_plot = Ex Ey Ez Bx By Bz jx jy jz rho rho_electrons rho_positrons

# Diagnostic that show quantities
# reconstructed in the lab frame
diag_labframe.diag_type = BackTransformed
diag_labframe.num_snapshots_lab = 25
diag_labframe.dz_snapshots_lab = 0.1
diag_labframe.format = openpmd
diag_labframe.buffer_size = 64

# Run the simulation long enough for
# all backtransformed diagnostic to be complete
warpx.compute_max_step_from_btd = 1

particles.species_names = electrons positrons
particles.rigid_injected_species= electrons positrons

electrons.charge = -q_e
electrons.injection_style = nuniformpercell
electrons.mass = m_e
electrons.momentum_distribution_type = constant
electrons.num_particles_per_cell_each_dim = 2 2 2
electrons.profile = constant
electrons.density = 2.7e19/2
electrons.ux = 0.0
electrons.uy = 0.0
electrons.uz = gamma_bunch
electrons.zmax = -25e-6
electrons.zmin = -125e-6
electrons.xmax = 130e-6
electrons.xmin = -130e-6
electrons.ymax = 130e-6
electrons.ymin = -130e-6
electrons.zinject_plane=0.0
electrons.rigid_advance = 0

positrons.charge = q_e
positrons.injection_style = nuniformpercell
positrons.mass = m_e
positrons.momentum_distribution_type = constant
positrons.num_particles_per_cell_each_dim = 2 2 2
positrons.profile = constant
positrons.density = 2.7e19/2
positrons.ux = 0.0
positrons.uy = 0.0
positrons.uz = gamma_bunch
positrons.zmax = -25e-6
positrons.zmin = -125e-6
positrons.xmax = 130e-6
positrons.xmin = -130e-6
positrons.ymax = 130e-6
positrons.ymin = -130e-6
positrons.zinject_plane=0.0
positrons.rigid_advance = 0

warpx.do_moving_window = 1
warpx.moving_window_dir = z
warpx.moving_window_v = sqrt(1-(1+K*K/2)/(gamma_bunch*gamma_bunch))

# Undulator field
particles.B_ext_particle_init_style = parse_B_ext_particle_function
particles.Bx_external_particle_function(x,y,z,t) = 0
particles.By_external_particle_function(x,y,z,t) = Bu*cos(k_u*z)
particles.Bz_external_particle_function(x,y,z,t) =0.0

warpx.cfl = 0.99
Loading