Benchmarking Collective Effects of Electron Interactions in a Wiggler with OPAL-FEL

OPAL-FEL is a recently developed tool for the modeling of particle accelerators containing wigglers or undulators. It extends the well established 3D electrostatic particle-tracking code OPAL, by merging it with the finite-difference time-domain electromagnetic solver MITHRA. We present results of two benchmark cases where OPAL-FEL simulations are compared to experimental results. Both experiments concern electron beamlines where the longitudinal phase space is modulated with a short magnetic wiggler. Good agreement was found in both the space charge and radiation dominated regimes.


Introduction
Wiggler magnets, consisting of alternating polarity dipole magnets with a strong transverse magnetic field, are used in electron/positron storage rings as devices for producing intense synchrotron radiation. See [1,2,3] and references therein for an in depth introduction to the wigglers and undulators and descriptions of their diverse applications. Coherent synchrotron radiation (CSR) in wiggler magnets can cause a microwave-like beam instability in storage rings as suggested in [4] and evidenced in [5]. The observations in [6,7,8,9] may also be associated with a CSR-driven instability. These findings inspired the study of the longitudinal wakefield and impedance effect in a wiggler due to CSR described in [10]. With the advent of the free-electron lasers (FELs), wigglers began to be employed in setups aiming for enhanced self-amplified spontaneous emission [11,12] and setups that explore the wiggler's CSR for electron microbunching and obtaining large and narrow peak current spikes [13]. These current spikes cause strong longitudinal space charge forces as discussed in [14] that are particularly noticeable in the wiggler where the beam propagates with reduced average longitudinal velocityv z = c 1 − 1/γ 2 z , where c is the speed of light and γ z = γ/ 1 + K 2 /2. Here γ is the relativistic factor and K = eB w λ w /2πmc 2 is the wiggler parameter, where e, m are the electron charge and mass, λ w is the wiggler's period, and B w is the wiggler's peak magnetic field. When K 2 >> 1, the wiggler strongly influences the longitudinal space charge force such that the frequency of plasma oscillations inside the electron bunch propagating through the wiggler become a factor of γ/γ z larger than the frequency of the plasma oscillations in a drift section [15] and, thus, the wiggler can be conveniently used to control the plasma oscillation frequency. This feature can be useful for microbunched electron cooling (see, [16,17] and references therein), in which one can consider shortening the amplification cascades by replacing the drifts with wigglers. However, due to CSR, the evolution of the microbunched beam inside the wiggler is more complex than in the drift and must be analyzed considering simultaneously the radiation and space charge forces. To the best of our knowledge, this analysis can only be performed in the integral form [15,18] or numerically using a code based on first-principle equations.
Many computer tools for modeling wigglers and undulators have been developed during the last 20 years due to the increasing number of FEL facilities (some examples [19,20,21]). However, these codes often make assumptions to be computationally efficient at the cost of limiting their applicability to certain types of FELs (see [22] for a detailed comparison of FEL codes). For the experiments considered in this paper, it was necessary to use the less common electromagnetic particle-in-cell (EM-PIC) codes, which solve the full inhomogeneous Maxwell equations, and also simulate particles. Examples of such codes are OSIRIS [23] and MITHRA [22]. In this paper, we present and use OPAL-FEL [24], a combination of the 3D electrostatic code OPAL [25] and MITHRA. This code accounts for 3D effects and solves first-principle equations, making it very attractive for modeling the microbunched electron beam in a wiggler, but, it must first be benchmarked to experimental results. In this paper, we discuss the result of benchmarking simulations performed using OPAL-FEL for two experiments, one at SLAC using a wiggler and a high energy beam at LCLS in the regime dominated by CSR, and one at ANL using a wiggler and a low energy beam at AWA in the regime dominated by space charge.

OPAL-FEL
Having computational tools capable of accurately modeling accelerators has become essential for the study of complex phenomena in beam physics. The open source framework OPAL (Object Oriented Parallel Accelerator Library) [25] is a parallel, fully 3D code for the simulation of charged particle beams. In order to compute space charge forces within the bunch, OPAL solves the static Maxwell equations in a Lorentz-boosted frame co-propagating with the particle. In this model, the magnetic field vanishes and one is simply left with the Poisson equation which is efficiently solved on a mesh using Fast Fourier Transform (FFT) techniques. While this approach is sufficient for many problems in accelerator science, the coupling between electric and magnetic fields is lost due to the static approximation, thus OPAL cannot account for the propagation of electromagnetic waves.
Recently, we integrated MITHRA [22] into OPAL so that OPAL is now able to simulate wigglers and undulators [24] in addition to its general capabilities for the simulation of charged particle beams. In this new flavor of OPAL, OPAL-FEL, the inhomogeneous Maxwell equations are solved by considering the potential wave equations using finite differences in time and space. One can then explicitly update the scalar and vector potentials on a mesh. At each time step the charge and current density from the particles are deposited on the discrete mesh-points, and the fields are interpolated from the mesh-points to the particle positions. The entire simulation is done in a Lorentz-boosted frame moving at the average speed of the bunch. In this way, the mesh can be smaller since it only needs to encapsulate the bunch rather than the whole undulator.
With OPAL-t the accelerator is modeled from the gun up to the undulator, using the static solver and, when it reaches the fringe fields of an undulator or wiggler, the MITHRA solver in OPAL is used to solve the full Maxwell equations. When the bunch exits the wiggler OPAL automatically switches back to OPAL-t with its static solver and continues the simulation until the desired end-point.

LCLS Benchmark
Wigglers and undulators can be used in FELs, not only at the end of the linac to produce coherent radiation, but also in the upstream section of the linac to reshape the electron bunch phase space. In these cases, a wiggler and a laser pulse are overlapped to generate small energy modulations in the bunch, that can later be compressed into short bunches [26,27].
In [13], MacArthur et al. investigate the possibility to generate a single cycle energy modulation in an electron bunch by means of a wiggler, but without the aid of an external laser. Using a line charge model they argue that a long bunch with a high-charge tail (figure 1), should emit coherent radiation strong enough to imprint an energy modulation in the beam core. In the paper they also validate their hypothesis through computer simulations with the electromagnetic code Osiris [23], and with an experiment at LCLS.
The same experiment was simulated in OPAL-FEL to serve as a benchmark, as it represents an example where both space charge and radiation effects are important, and thus the full Maxwell equations need to be considered. The model included the 2.10 m wiggler, and an 80 cm drift before and after it, such that the initial and final bunch positions would be clear from the fringe fields. The input bunch had a charge of Q = 200 pC, a transverse rms size σ x,y = 74 µm, an average energy of E = 3.95 GeV with an energy spread of σ E = 2 MeV, and a current profile as shown in figure 1. The wiggler had a strength parameter K = 51.5, and 6 periods of length λ w = 35 cm.  The longitudinal phase space before and after the wiggler can be seen in figure 2, where the wiggler-induced effects are clearly visible. The wake fields inside the wiggler affect mostly the high-charge spikes in the head and tail of the bunch. Less noticeably, the radiation also causes a chirp in the bunch center, as predicted by the theory. In figure 3 we see the slice-energy, where the single cycle energy modulation in the bunch center is evident. The slice-energy is also plotted for the OSIRIS simulation and the measurement at LCLS carried out by MacArthur et al, both showing good agreement with our OPAL-FEL simulations.

Experimental Setup
Among several available AWA beamlines [28,29], the straight section after the linac was used for this experiment (see figure 4). The first 13 meters of the beamline form the photoinjector, consisting of a photocathode gun and six accelerating cavities. During this experiment, 4 accelerating cavities were used to generate 300 pC electron bunches with energy of 45.6 MeV. The straight section of the beamline that follows after the photoinjector is referred to as the "experimental beamline". It includes four matching quadrupoles (Q1-Q4, referred to as upstream quadrupoles), a wiggler, a longitudinal phase space (LPS) measurement section, and several YAG screens (diagnostic stations equipped with 50-mm diameter Cerium-doped Yttrium aluminium garnet (Ce:YAG or YAG for short) electron imaging screens to measure the transverse beam distribution) ( fig. 4). The upstream quadrupoles are used to match the beam from the photoinjector to produce the required transverse beam conditions at the wiggler center. The wiggler can be mechanically inserted in and out of the experimental beamline such that we were able to insert or remove the wiggler from the beam path (referred to as wiggler-in and wiggler-out settings). The LPS measurement section at the end of the beamline is used to measure the beam's temporal and energy spectrum perturbations after having passed through the wiggler. The LPS consists of four more quadrupole magnets (Q5-Q8, referred to as downstream quadrupoles) for transverse focusing at YAG5 and YAG6, a 100 µm horizontal slit for improved temporal resolution, a transverse deflecting cavity (TDC) and an energy spectrometer. The slit can be inserted or removed from the beamline when necessary.
The AWA photoinjector was used to generate a 300 pC electron bunch with an rms bunch length of around 0.1 mm. The photoinjector parameters to achieve this were determined with OPAL-t numerical simulations. The laser spot size (diameter) on the cathode was 12 mm and its pulse length (FWHM) was 300 fs. A single solenoid, located at the photocathode gun exit, was used to match bunches into the linac and on to the upstream quadrupoles. The solenoid was used to create a transverse waist at the entrance to the upstream quadrupole (i.e. Q1). The upstream quadrupoles were then easily used to match to the transverse beam conditions needed at the center of the wiggler.
The measurement of the Twiss parameters at the wiggler center with wigglerout was necessary for this experiment. However, the experimental beamline does not allow for the installation of a YAG screen at that point. For this reason we used a three screen method instead [30], to measure the Twiss parameters. Once the upstream quadrupoles had been set to produce a specific beam condition, the three YAG screens (YAG1, YAG2, and YAG3), which are separated by drifts, were used to measure the rms beam sizes. We then analytically fit the beam sizes at the YAGs (wiggler-out), to obtain the Twiss parameters at YAG1 and at the wiggler center.
The main measurement necessary for this experiment was that of the longitudinal phase space. Since we know that the wiggler perturbs the beam's temporal and energy spectrums, we needed to compare the LPS of the wigglerin to the LPS of the wiggler-out (and to our simulations). Downstream of the wiggler, the beam passes through the four downstream quadrupoles which are used to minimize transverse contributions on YAG5 and YAG6 [31], where the longitudinal measurements are made. The 100 µm horizontal slit can be used in some cases to truncate the beam vertically to improve temporal resolution. The TDC deflects the beam in the vertical direction such that the temporal information gets projected onto the YAG in vertical direction. Energy spectrum information appears on the YAG in horizontal direction because the 20 degree energy spectrometer horizontally bends the beam depending on electron's energy. The LPS measurement section is able to measure the temporal distribution and the energy spectrum and the LPS, separately or simultaneously. In the case of temporal distribution only measurement (TDC-only), we focused the beam vertically at YAG5 and turned on the TDC (without the slit). Similarly, the energy spectrum (spectrometer-only) was measured with horizontal beam focusing at YAG6 with the energy spectrometer turned on (also without the slit). Lastly, the LPS measurement required transverse beam focusing at YAG5, the horizontal slit, and turning on both the TDC and the energy spectrometer. Note that drift length from the spectrometer to YAG5 and to YAG6 is the same.
The experiments and measurements were carried out for two specific settings of the upstream quadrupoles. They were set such that the transverse beam size would have a waist at the center of the wiggler. The two settings are from here on referred to as round beam and elliptic beam, and only differ in their transverse size, described in The choice of the two transverse beam sizes was made in an attempt to perform an experiment that probed both above and below the wiggler's radiation diffraction limit σ dif f , given by where σ z is the longitudinal rms size of the bunch, and λ w the wiggler period. From [14] we expect that with a transverse beam size σ r σ dif f the wigglerinduced radiation effects become negligible, and only the space charge effects remain. In the current experiment, with an average bunch length of σ z = (250 ± 40) µm and a wiggler period λ w = 8.5 cm, we find σ dif f = (1.84 ± .15) mm. For this reason the horizontal beam size σ x was chosen to be in one case greater and in one case smaller than σ dif f . The vertical beam size σ y was unfortunately limited by the height of the vacuum chamber in the wiggler, and thus remained below the diffraction limit at all times.

OPAL-FEL Benchmark
In order to benchmark OPAL-FEL with the AWA wiggler experiment, the experimental beamline was computationally modeled and used for simulations that could be compared to the experiment. The simulated section goes from the first electron imaging screen (YAG1) up to the energy spectrometer 7 meters downstream. This section includes the wiggler, four YAGs for transverse beam measurements, the four downstream quadrupoles, and the LPS measurement section ( figure 4). Simulating the electron bunch starting from YAG1, requires accurate knowledge of the bunch parameters in all 3 phase space planes at YAG1. The transverse beam parameters were known, since the transverse emittance and Twiss parameters at YAG1 were measured by the three-screen methods using YAG1-3. These transverse beam parameters can be seen in  The longitudinal beam parameters were numerically recreated at YAG1 by the following method. The LPS was not directly known at YAG1, as it was only measured at the LPS measurement section at the end of the beamline. There, the spectrometer and TDC provided images of the longitudinal particle distribution and the energy spread, of which examples can be seen in figure 5. These images are available for both the round and elliptic beam experiments. Additionally, in each case, the experiment and images were repeated with the wiggler in the beamline (wiggler-in), and the wiggler removed from the beamline (wiggler-out). The images from the wiggler-in experiments were used later on for benchmarking the simulations, while the wiggler-out images were used to numerically recreate the LPS at YAG1. In this way, the longitudinal parameters at YAG1 were combined with the Twiss parameters at YAG1 to obtain the initial bunch conditions for the simulations.
In summary, the following steps were carried out to recover the full 6D phase space at YAG1: 1. A 2D particle distribution was generated with the energy spread from the spectrometer images (figure 5b), and with the longitudinal distribution from the TDC images (figure 5c). The correlation of this 2D distribution was taken from the z − E correlation seen in the LPS images (figure 5a), which were captured with both the spectrometer and TDC simultaneously turned on. The resulting 2D distribution was the LPS at the spectrometer (figure 5d). All the images used in this step were taken with the wiggler-out. Note that the energy spectrum from the spectrometer shows a "bump" at 45.6 MeV of energy (figure 5b). The source of this anomaly was discovered to be a low charge satellite bunch that was spuriously emitted from the cathode. This satellite bunch trailed the main bunch 4.5 mm behind it, and had a charge of approximately 6 pC. The effect of this low charge bunch is negligible with respect to the 300 pC main bunch, and was thus not included in the simulations.
2. The Twiss parameters at the spectrometer were computed by transferring the Twiss parameters from YAG1 (table 2), through the 7 meter section of the beamline to the spectrometer in the wiggler-out case, using linear transfer matrices.
3. With the known Twiss parameters at the spectrometer, it was possible to sample the 4D transverse phase-space, and add it to the 2D longitudinal phase space generated in step 1, giving us the full 6D particle distribution. Note that with this method there were assumed to be no longitudinaltransverse correlations in the bunch.
4. Finally, since OPAL's electrostatic solver assumes conservative forces, the simulation can be run in reverse to effectively track the bunch back in time.
Using this approach, the bunch was simulated backwards from the spectrometer to YAG1, with the wiggler-out, thus obtaining the 6D particle distribution at YAG1 (figure 6), the starting point of our simulations.
With these four steps we were able to obtain the initial bunch conditions which were needed for our wiggler-in simulations.
Note that simulation back-tracking only works in the wiggler-out case, because only the electrostatic solver can be run in reversed time. The MITHRA solver that OPAL-FEL uses to track the bunch through a wiggler cannot be run backwards in time. The reader might remark that the experimental shots that combined the TDC and spectrometer simultaneously (figure 5a) provide a full picture of the LPS, and these LPS images could have been used to generate the 2D longitudinal particle distribution, instead of combining the TDC-only and spectrometer-only shots as we did. However, the shot from figure 5a was captured with a horizontal slit present in the beamline, placed in front of the TDC ( figure 4). This slit blocked part of the bunch, potentially distorting the histograms. As a consequence, we only took the z −E correlation from these images, but not the energy and z histograms. In the TDC-only and spectrometer-only images (figures 5b and c), the slit was not present, thus all electrons reached the YAG screens. The most notable effect that the wiggler has on the bunch, as can be seen by comparing the wiggler-out and wiggler-in shots, is an increase in the total energy spread. This effect was to be expected since, as explained in the introduction 1, the wiggler increases the plasma oscillation frequency of the bunch by enhancing space charge [15]. The same effect is also observed in simulations, as is apparent from the plots and    Despite the good agreement between simulations and experiments, small discrepancies remain between the shape of the histograms (figure 7c). These differences are suspected to be due to inaccuracies in the bunch's initial conditions for the simulations. The initial particle distributions were deduced from LPS measurements which had uncertainties, and gave no information about the transverse beam parameters, thus not allowing for an entirely realistic modeling of the bunch.

Conclusion and Further Work
Good agreement with the experimental results has been demonstrated in the modeling of two experiments using OPAL-FEL. The considered experiments al-lowed us to test the code in different regimes of electron-wiggler interaction: a higher-energy case (c.f. section 3) governed by the effects of emitted radiation, and a lower-energy case (c.f. section 4) governed by space charge effects. We have now all reasons to believe that the code can be reliably used for modeling of complex beamlines consisting of magnetic chicanes, wigglers, and undulators simultaneously accounting for the space charge and coherent synchrotron radiation effects.
With the OPAL-FEL code and thanks to the parallel nature of OPAL, full start-to-end modeling of complex beamlines is possible. In regions where radiation does not play a significant role, the 3D electrostatic solver is used, while in undulators and wigglers the full 3D electromagnetic solver will take radiation into account. The ability of OPAL-FEL to switch between the two solvers reduces the computational expense of simulations by using the faster electrostatic solver in the sections where radiation can be neglected. Adapting the numerical model to the physics needs has a great positive impact on the time to solution and contributes to an economical use of computing resources.
The current plan is to apply OPAL-FEL to evaluate the gain in the recently proposed wiggler enhanced plasma cascade amplifier [32] for coherent electron cooling [33]. It is expected to be particularly fruitful since both the space charge and coherent synchrotron radiation effects are considered to play equally important roles there.

Statement of Contribution
Arnau Albà integrated OPAL and MITHRA, carried out simulations, analyzed the experimental data and lead preparation of the paper for a publication; Jimin Seok conducted the experiment, analyzed the data and contributed to paper writing; Andreas Adelmann provided ideas for OPAL-FEL, provided the oversight for the data analysis, and contributed to paper writing; Gwanghui Ha conducted the experiment; Soonhong Lee, Maofei Qian, and Joseph Xu designed the wiggler and provided the oversight for a fabrication of the wiggler's strong back; Yinghu Piao carried out magnetic measurements and wiggler's tuning; Scott Doran designed the wiggler's vacuum chamber and support, installed the wiggler, and assembled the beamline; Eric Wisniewski assembled the beamline; John Power provided the oversight for the experiment and data analysis; Alexander Zholents conceived the experiment, led the activity and contributed to paper writing.

Acknowledgement
We are grateful to John TerHAAR, Joseph Gagliano III, and Eric McCarthy from the Advanced Photon Source of Argonne National Laboratory who assembled the wiggler that worked flawlessly in the experiment. This work was supported by FY 2018 Research and Development for Next Generation Nuclear Physics Accelerator Facilities DOE National Laboratory Announcement Number: LAB 18-184 Proposal ID 0000235339.