Fast Tracking of 6D Particle Phase Space Using the FC2CT Algorithm for rf Cavities
Abstract
In this paper, a fast cell to cell tracking algorithm (FC2CT) is developed, that determines the change in 6D phase space of a particle beam through rf accelerating cavities operated in both Standing and Traveling Wave modes. The performance is compared to well trusted tracking codes - ASTRA and RF-Track - for proton beams with relativistic beta 0.5. The FC2CT algorithm produces a complete analytical method to determine the change in particle momentum, with the constant particle velocity approximation over the integration region. Additional developments for FC2CT are discussed, such as altering the integration length. FC2CT can be used as a fast method class in common tracking codes to perform fast simulations through rf cavities.
I Introduction
The use of particle accelerators are paramount in multiple industries, examples including the health care, cargo scanning and research industries. As a result, there is constant requirement for additional developments within the particle accelerator industry, ensuring optimal efficiency of machines or increased beam energies. A large subset of accelerators are linear accelerators (linacs) that accelerate particles using radio-frequency (rf) cavities that contain electromagnetic (em) fields for particle acceleration. Beam dynamics simulations are a vital aspect of accelerator design, however can be computationally expensive, for example beam dynamics studies for circular machines requiring many thousands of turns.
In this paper, we outline a fast tracking algorithm for beam dynamics through coupled cavity linacs (CCL), and is called the Fast Cell to Cell Tracking algorithm (FC2CT), calculating the change in 6D phase space of a particle over one rf cell per iteration. The model approximates the particle velocity is constant over an rf cell, and space charge effects are ignored. The first approximation is accurate for protons of all energy that are to be accelerated by a CCL. The proton transition energy for more efficient acceleration by CCL is often taken to be 80-100 MeV, below which drift tube linacs may have increased shunt impedance shunt_impedance_diff_strucs . Nevertheless, some CCL accelerate protons from as low as 37.5 MeV light_linac . FC2CT is only accurate for electrons over 3 MeV. The tracking algorithm requires the on axis longitudinal electric field, from which the remaining non-zero field components () are approximated by determining the Taylor expansion coefficients in the small radial limit. This method has been utilised before, in order to quickly provide a method for 3D particle tracking in well-known tracking codes, such as ASTRA astra . The method is accurate for both Standing Wave (SW) and Traveling wave (TW) cavity types, however require slightly different algorithms. In addition, the algorithm described is purely for the TM cavity mode. The accuracy of the FC2CT model is compared with well trusted tracking codes, ASTRA (SW) and RF-Track (TW), rftrack .
I.1 Lorentz Force law and Maxwell Equations for a TM Mode
A particle in a region of non-zero em field will experience a force given by the Lorentz force griffiths . The force is the rate of change of momentum;
(1) |
Where is the particle velocity. In general, the em field and particle velocity are a function of time. The em fields in a given region will be described by Maxwell equations griffiths . For an rf single cell, the TM mode is often used for acceleration wangler . The longitudinal electric field () and azimuthal magnetic field () in a TM mode for a simple pillbox cavity are described by the zeroth and first order Bessel functions of the first kind bessel . rf single cells are often designed with nose-cones, to concentrate on-axis and improve shunt impedance and require a beam pipe, to allow power coupling and particle transmission. As a result, the initially separable em field components in the case of a pillbox cavity become functions of the longitudinal displacement, .
As a particle traversing an rf single cell will be at a small radial displacement relative to the cell radius, it is possible to describe the non-zero em field components as a function of the on-axis component, denoted , using a Taylor expansion about = 0. The TM mode in a given rf cell will have negligible , , components, as in a pillbox cavity.
The non-zero em field components observed by a particle at position, , time, can be described as follows,
(2) |
(3) |
(4) |
Where is the rf phase when the particle enters the cell (at ). The magnetic field lags the electric field by . is the longitudinal on-axis electric field component, and can be exported from em solver codes, such as CST microwave solver CST for a given rf single cell geometry. The terms describe the derivative of .
It is required to describe the on-axis component as a Fourier series fourier , as is periodic over some period, , defined by the phase advance per cell of the cavity. As can be described by a Fourier series, the partial derivatives of become straight-forward to compute. The Fourier terms required to construct for a SW cell is shown in Fig. 1.
For a SW cavity, the longitudinal electric field, and the derivatives, are given below at time ;
(5) |
(6) |
(7) |
Where are the Fourier series coefficients. The required number of coefficients varies for different field profiles, and should be the minimum number such that the field is accurately represented.
When the operating mode is a -mode, the field period is two cell lengths, . Thus, can be described using only terms, as for all . For TW cavities, the longitudinal electric field has both real () and imaginary () components, and thus both components (over one period) must be imported from an em field solver. Both the real and imaginary fields can also be described as a Fourier series, however will require both and coefficients. The field seen by a particle in a TW cavity is the real component of the complex field, and is given;
(8) |
Where A(z) and B(z) are described by Fourier series;
(9) |
and
(10) |
From Eqn. 1, the momentum change in the direction is given;
(11) |
As the particle velocity over the rf cell () is approximately constant, . It is also assumed that terms including are negligible, thus;
(12) |
The momentum change in the transverse planes are also given by the Lorentz force, and are a function of the particles azimuthal angle, , depicted in Fig. 2.
(13) |
(14) |
I.2 Derivation of single cell SW
Combining Eqns. 2 and 12 the change in is given;
(15) |
where the integration is defined over a single rf cell (the integration range can be over multiple cells, or sections of a single rf cell). Equation 15 can be simplified by noting all terms are of the form;
(16) |
Therefore, using the standard result of Eqn. 16, Eqn. 15 is simplified to
(17) |
Where
(18) |
I.3 Derivation of single cell TW
The derivation of the momentum gain for TW cavities is more involved, as both the real and imaginary field maps of are required. This is because the field behaves as described in Eqn. 8. The longitudinal momentum change, , is therefore found by computing the following integral;
(20) |
Using Eqn. 16, can be calculated for the TW case, noting that . In general, an iteration over a TW single cell requires four times the number of calculations than a SW cell, due to requiring both and coefficients for describing both the real and imaginary TW field components, and . As a result, the FC2CT method is less effective for TW cavities, as the speed benefit is reduced.
I.4 Calculation of Position in SW and TW cavities
The 3D particle position is also updated every rf cell. Firstly, the time of flight, , is calculated as follows;
(21) |
where the average particle velocity along the axis is defined
(22) |
The updated positions are therefore;
(23) |
For both the SW and TW methods, the rf phase, , is updated every cell due to phase slippage. The phase slippage is a function of the difference between particle and design velocity;
(24) |
A script was written in Python python , that takes the on-axis field map as an input, and extracts the Fourier coefficients. The script tracks a particle beam through an rf cavity with a specified number of the cells, with a specified gradient. The 6D phase space of each particle is updated after every cell, as is the rf phase. The position of the particle is increased by in the longitudinal direction and determined transversely using a calculated time of flight and transverse velocity. This allows a single iteration to be performed each rf cell, as opposed to multiple iterations, as used in conventional tracking methods. Section II describes the accuracy of the FC2CT method for both SW for protons with kinetic energy 37.5 and 150 MeV, and TW structures for protons at 150 MeV.
II Performance
For the comparison of SW FC2CT, ASTRA tracking code was used. The input distribution was created using the ASTRA generator function, producing protons at 37.5 and 150 MeV. Protons at 37.5 MeV are simulated as below this energy region, proton acceleration is often accomplished with RFQ and drift tube linac wangler , as the effective shunt impedance is higher than for CCL. Thus, exploring both 37.5 and 150 MeV proton energies assesses FC2CT for different values of relativistic Lorentz factor, . In addition, showing FC2CT is accurate for proton energies of 150 MeV, demonstrates the method will be accurate for higher energy protons (as the only approximation is constant relativistic over a cell).
Side-coupled single cells were designed in CST Microwave Solver CST . The cell lengths were defined such as to keep the field synchronous with protons of energy of 37.5 and 150 MeV. Figure 3 shows the transverse and longitudinal phase space of a proton beam after 20 SW cells. The tracked phase space is shown as calculated by both ASTRA and FC2CT. The two distributions agree strongly, suggesting the constant approximation is valid for protons at 37.5 MeV.
Figure 4 displays the output distributions for an initial proton energy of 150 MeV, after 50 SW cells. The two distributions agree well. The largest discrepancy between distributions occurs on the ‘neck’ of the phase space plot. Potential reasons for this are discussed later.
The difference between phase space components after a 40 cell SW structure, as calculated by ASTRA and FC2CT, are plotted in Fig. 5. The plot displays the maximum difference in occurs at maximum (positive) difference in . In this region, FC2CT underestimates both longitudinal particle momentum and position. This result is intuitive, as lower momentum particles will travel shorter distances. The maximum longitudinal momentum error is 1 MeV/c, resulting in a maximum percentage error of approximately 0.016 in . The ASTRA time step was set to 0.001 ns, resulting in approximately 150 iterations per cell.
Particles in this region reside on the ‘neck’ of the phase space plot, see Fig. 4 (b). These particles begin with gentle acceleration, due to a slightly accelerating initial phase. As the particles begin to phase slip, the phase tends to a zero-crossing phase. In the following cells, particles will experience very small changes in , and particles become physically spread out, as bunching occurs. The input distributions of Figures 3 and 4 were uniform in rf phase, however particles in the ‘neck’ are spread out, implying thus small changes in initial conditions (rf phase) result in large changes in output conditions. As a result, FC2CT will perform less accurately on particles in this region.
Very small discrepancies in calculated occurs at maximum (negative) error in . In this region, particle position is overestimated by FC2CT. However, the discrepancy in is very small, with a maximum percentage error of approximately 0.04. Particles with maximum and minimum are most accurately tracked using FC2CT. This is due to the particles residing at an rf phase that remains far from the zero-crossing phase, where FC2CT performs most poorly.
Figure 6 displays the longitudinal and transverse phase space as calculated by RF-Track and FC2CT for a TW cavity comprised of 45 cells. The longitudinal electric field component at some time, , is shown in Fig. 9 (b). The FC2CT method closely agrees with the well trusted tracking code, RF-Track. The output distribution has traversed a 45 cell TW cavity with phase advance per cell. For protons at 150 MeV, the length of the cavity is approximately 1 m. The RF-Track time step was set to 0.003 ns, resulting in approximately 44 iterations per cell. It is shown later that 44 iterations is beyond the limit of convergence.
Figure 7 displays the difference in calculated phase space components between FC2CT and RF-Track. Fig. 7 (a) shows a similar error relationship to the SW case shown in Fig. 5. The majority of particles have small discrepancies in , with the phase space of ‘neck’ particles being less well determined. The maximum difference in is approximately 0.02 , similar to the error in the SW case. The main difference is that FC2CT overestimates both and for all particles, as and are always negative. Similar to the SW case, maximum particles are well approximated, with small errors in both position and momenta. The maximum position error is 0.0012 m, approximately 6 of a cell length.
Figure 7 (b) displays the discrepancy in transverse momentum as a function of transverse position discrepancy. The relationship between errors appears to be a function of . For low particles (deep purple), is a straight line with respect to . For high particles, the relationship is also linear, albeit with a shallower gradient. For all other particles, is generally larger, with a maximum discrepancy of approximately 6. The maximum position error is 1.2 of the beam pipe radius.
From results displayed, the FC2CT is a highly efficient and accurate tracking method. The FC2CT method has the ability to vastly reduce the computational expense of large tracking jobs. Whilst FC2CT has been limited above to iterations every rf cell, the method allows iterations over any distance, by changing the bounds of integration in Eqn. 15.
II.1 Changes to FC2CT
FC2CT is based upon the approximation of constant particle over the cell. This approximation is highly effective for multiple energy ranges for both electrons and protons. The accuracy of the approximation is directly proportional to the change in particle over an rf cell, . However, for very low energy protons, may be small over an rf cell, however may be changing by a factor of two, thus the accuracy of the approximation must be normalised to the particle , giving .
Figure 8 shows the ratio for electrons and protons at different energy. The value of is calculated by estimating the energy gain over an rf cell of appropriate cell length with a fixed gradient. The quantitative value of is thus irrelevant, but the relative value is important for inferring particle energy where the constant approximation is valid. The eye guides shown at 37.5 and 150 MeV display the region of the phase space plots shown in Figures 3, 4 and 6, where the FC2CT model is valid and accurate. The value of is similar for electrons at 2.5 MeV and protons at 37.5 MeV. As previously discussed, CCL are often appropriate for protons with energy beyond 30 MeV, as below RFQ and DTL are superior.
The FC2CT method takes approximately four times longer for tracking through TW structures, as previously described. For certain TW structures, the beam aperture is small, in order to maximise the shunt impedance. For these structures, the cut-off frequency in the beam pipe is very low, and the field is highly evanescent in this region between cells, as is the case for the TW field in Fig. 9 (b). In these cases, the TW cell can be approximated as a SW cell, utilizing the same method outlined in Section I.2. The field has a fixed phase advance per cell and a symmetric on-axis field about the centre of the rf cell, thus is not a true TW. However, the results can be highly accurate, whilst faster by a factor of 4.
Figure 10 displays the phase space of a proton distribution after traversing a 45 cell TW structure. The true TW FC2CT method (slow) is shown alongside the SW FC2CT method (quick). Whilst the true TW FC2CT agrees with RF-Track more closely, there is not a huge drop in accuracy for the quick method.
Not all TW structures can be treated as SW structures, however. The more asymmetric the field is inside a TW cell, the less accurate the approach becomes. Figure 9 (a) shows for a disk-loaded electron cavity. For this type of cavity, approximating the field as a symmetric SW is not appropriate, and the true TW FC2CT is required. However, the number of Fourier terms required in the Fourier series description of A(z) and B(z) is far fewer than for the case in Fig. 9 (b), saving computation time.
Accuracy improvements for the FC2CT model have been explored by 1) running an iteration over an rf cell twice, updating the particle with a more accurate (mean) value for the second iteration or, 2) reducing the integration length of the iteration.
Figure 11 displays the change in initial calculation (in a 1D scheme) due to changes in FC2CT parameters, such as number of iterations and integration length, as described in points 1) and 2). The integration length is given as , so an integration length of 0.5 computes two iterations per cell.
Figure 11 shows that updating the particle with a mean value does not change the value of , relative to changing the integration region. The green line shows the change in from running over half an rf cell twice, requiring the same number of calculations as the orange line (two iterations, but updating for the second iteration). A much larger change occurs when reducing the integration step, relative to updating .
The change in converges for an integration length of 0.01. Therefore, separating the cell into ten separate calculations is as accurate as the model can be made, beyond which the change is negligible.
Figure 12 displays the error in phase space between RF-Track and FC2CT, with one and two iterations per cell. As expected, computing two iterations per rf cell produced an output distribution closer to RF-Track.
It is possible to reduce the computation time for FC2CT considerably for both SW and TW structures by using only the principal harmonic.
As FC2CT was designed as fast tracking code, decreasing the integration length is not advised, as the increase in accuracy is minor, with a maximum change in of 0.002 , requiring the computation time to increase by a factor of ten. In addition to reducing the integration length, computing time could be further reduced by iterating over multiple cells in one calculation. In general, the integration length must be chosen to reflect the particle rest mass and energy, in addition to the required accuracy. Another time-saving option for FC2CT is to use only the first harmonic in the Fourier Series expansion. This is possible as higher order spatial harmonics cancel exactly for relativistic particles, and are very small for non-relativistic particles.
III Conclusion and Next Steps
In this paper, the FC2CT method for fast particle tracking was displayed, with its performance compared relative to two well trusted tracking codes, ASTRA and RF-Track. FC2CT demonstrated strong agreement with the codes for both SW and TW cavities. Additional developments for FC2CT were discussed, such as altering the integration length, and treating certain TW cavities as SW cavities.
The SW FC2CT method works very effectively, as the number of computations is low, relative to TW FC2CT. Whilst TW FC2CT was highly accurate as a particle tracker, the computation time is approximately four times longer than the SW case. Currently, the effect of fringe fields at the entrance/exit of an rf cavity is not accounted for. Further work can incorporate the radial impulse due to these fringe fields to better approximate a real life situation.
In order to quantitatively measure the reduction in computation time, an FC2CT mode must be constructed in a compiled coding language. In this study, FC2CT was written in an interpretive language, the script is not written with minimising computation time as a major objective.
Acknowledgements.
The studies presented have been funded through the Cockcroft Core Grant by STFC Grants No. ST/P002056/1 and ST/V001612/1.References
- [1] Frank Bowman. Introduction to Bessel functions. Courier Corporation, 2012.
- [2] Dassault Systemes. CST STUDIO SUITE, R2021x. https://www.3ds.com/products-services/simulia/products/cst-studio-suite/, 2021. Computer code.
- [3] Veliko Dimov, Michele Caldara, Alberto Degiovanni, L Esposito, DA Fink, Marina Giunta, Adam Jeff, A Valloni, AM Lombardi, SJ Mathot, et al. Beam commissioning of the 750 mhz proton rfq for the light prototype. In 9th International Particle Accelerator Conference (IPAC2018), Vancouver, BC, Canada, JACoW, Geneva, Switzerland, pages 658–660. sn, 2018.
- [4] Klaus Flottmann. Astra-a space charge tracking algorithm. Technical report, DESY, Hamburg, 2000.
- [5] David J Griffiths. Introduction to Electrodynamics Fourth Edition. 2021.
- [6] Andrea Latina et al. Rf-track: Beam tracking in field maps including space-charge effects. features and benchmarks. In Proceedings of the 28th Linear Accelerator Conference-LINAC16, 2016.
- [7] N Pichoff. Beam dynamics basics in RF linacs. 2006.
- [8] Georgi P Tolstov. Fourier series. Courier Corporation, 2012.
- [9] Guido Van Rossum and Fred L Drake Jr. Python tutorial. Centrum voor Wiskunde en Informatica Amsterdam, The Netherlands, 1995.
- [10] Thomas P Wangler. RF Linear accelerators. John Wiley & Sons, 2008.