forked from ECP-WarpX/impactx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add KICKER to accepted MAD-X input (ECP-WarpX#419)
* Accept KICKER in MAD-X input Added the logic to read lines from MAD-X input files that contain kicker elements. Also added a MAD-X example input and a Python file that reads it. The output and analysis script results match with the original kicker example. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add kicker test with MAD-X input to ctests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update license in examples/kicker/run_kicker_madx.py Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
- Loading branch information
1 parent
0a1970f
commit d89f17e
Showing
6 changed files
with
129 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
beam, particle=electron, energy=2.0; | ||
|
||
M1: MONITOR, L=0.0; | ||
HK1: KICKER, hkick=2.0e-3, vkick=0.0; | ||
VK1: KICKER, hkick=0.0, vkick=3.0e-3; | ||
|
||
KICKLATTICE: Line=(M1,HK1,VK1,M1); | ||
USE, SEQUENCE = KICKLATTICE; |
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,54 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Copyright 2022-2023 ImpactX contributors | ||
# Authors: Chad Mitchell, Axel Huebl, Marco Garten | ||
# License: BSD-3-Clause-LBNL | ||
# | ||
# -*- coding: utf-8 -*- | ||
|
||
|
||
import amrex.space3d as amr | ||
from impactx import ImpactX, RefPart, distribution, elements | ||
|
||
sim = ImpactX() | ||
|
||
# set numerical parameters and IO control | ||
sim.particle_shape = 2 # B-spline order | ||
sim.space_charge = False | ||
# sim.diagnostics = False # benchmarking | ||
sim.slice_step_diagnostics = True | ||
|
||
# domain decomposition & space charge mesh | ||
sim.init_grids() | ||
|
||
# load a 2 GeV electron beam with an initial | ||
# unnormalized rms emittance of nm | ||
bunch_charge_C = 1.0e-9 # used without space charge | ||
npart = 10000 # number of macro particles | ||
|
||
# reference particle | ||
ref = sim.particle_container().ref_particle().load_file("kicker.madx") | ||
|
||
# particle bunch | ||
distr = distribution.Waterbag( | ||
sigmaX=4.0e-3, | ||
sigmaY=4.0e-3, | ||
sigmaT=1.0e-3, | ||
sigmaPx=3.0e-4, | ||
sigmaPy=3.0e-4, | ||
sigmaPt=2.0e-3, | ||
) | ||
sim.add_particles(bunch_charge_C, distr, npart) | ||
|
||
# add beam diagnostics | ||
monitor = elements.BeamMonitor("monitor", backend="h5") | ||
|
||
# design the accelerator lattice | ||
sim.lattice.load_file("kicker.madx", nslice=1) | ||
|
||
# run simulation | ||
sim.evolve() | ||
|
||
# clean shutdown | ||
del sim | ||
amr.finalize() |
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