Covariant Hamiltonian approach for time-dependent potentials applied to a pill-box cavity

The common treatment of time-dependent potentials, such as those used for radio frequency cavities, is to average a potential’s time component through the interval that the reference particle spends in the cavity. Such an approach, using the so-called transit-time factor, uses time as the independent variable in the Hamiltonian. In this paper, we instead propose a fully covariant Hamiltonian to treat the time component of the potential like any other space component. We show how to calculate the dynamics of the particles in a pill-box cavity using an explicit sympletic integrator. Finally, we compare the results with the simulator TraceWin.


I. INTRODUCTION
When a charged particle passes through an accelerator element which generates a time-dependent field, this yields a Hamiltonian which is no longer a constant of motion. This requires special techniques to handle the time component, such as the transit-time factor (TTF) for RF cavities, where the time component is averaged and removed from the Hamiltonian.
The time dependency of the Hamiltonian can also be removed if we consider the covariant Hamiltonian, in a 8dimensional phase space, where together with the usual 6-dimensions (x, P x ; y, P y ; z, P z ) we also have time and its canonical conjugate (t, P t ). In this phase space, the Hamiltonan H = H(x, y, z, t, P x , P y , P z , P t ) is always a constant of motion and will satisfy four pairs of Hamilton equations where τ is the"proper" time of the particle, that is the time in a reference frame that moves with the particle; x µ = ct, x, y, z when µ = 0, 1, 2, 3; and P µ , defined rigorously in the next section, are the corresponding momenta. The solutions to these Hamilton's equations can be obtained in many ways, the technique used to solve them depends on the form of the potential used. Expanding on preliminary studies [1], the potential considered in the example of this paper is a simple pill-box cavity. Such a potential can be split as explained in [2], so we will adopt that technique to have an explicit symplectic integrator.
The results obtained with this method will be compared with the standard simulator used at the European Spallation Source, TraceWin [3]. * emanuele.laface@ess.eu

II. HAMILTONIAN
The Lorentz invariant leads to the Lagrangian where With an external electromagnetic quadri-potential where is the electric charge of the particle. The corresponding Hamiltonian is calculated with the Legendre transform as This Hamiltonian generates eight equations of motion with the constraint v µ v µ = c 2 so not all the variables are independent.

III. THE PILL-BOX CAVITY
The case discussed here is the simple pill-box cavity with the simplest accelerating mode (TM 01 ). The electric and magnetic fields, expressed in cylindrical coordinates arXiv:2006.15910v2 [physics.acc-ph] 8 Sep 2020 plus time (t, r, θ, z) are [5] J 0 and J 1 are the Bessel functions of kind 0 and 1; b 01 is the first zero of J 0 , that is, J 0 (b 01 ) = 0; a is the radius of the pill box cavity (this leaves the electric field as zero when r = a); ω is the oscillation frequency of the field in the cavity multiplied by 2π which is fixed by the cavity aperture through the relationship ω = c b01 a ; and φ 0 is the phase that the particle sees when it arrives to the entrance of the cavity.
These fields can be expressed as a potential: Because the potential is only in the z direction, we do not need to transform the Lagrangian in cylindrical coordinates, but we can use the potential directly in the calculations recalling that r = x 2 + y 2 . The Lagrangian is The conjugate momenta are then so we can rewrite the 4-velocity as The Hamiltonian is or explicitly The Hamiltonian (22) can be treated with the explicit symplectic integrator first developed in [2] and discussed in [6] Chapter 12 Section 9.

IV. THE ALGORITHM
The only problematic term in the Hamiltonian (22) is the one dependent on z because it mixes the momentum P z with the position contained in A z . The idea of our integrator is to create a new function U z (t, x, y, z) such that A z = ∂Uz ∂z . In our case The Lie transform of U z has the property: and as consequence we have : .
This splitting technique is similar to the usual drift-kickdrift, but here the term U z can be seen as a gauge transformation instead of a kick.
This integrator can be extended to higher order integrators applying the technique of Yoshida [7] or that of Suzuki [8]. Both techniques are explored in detail in [9]. Every step of the integrator has to be evaluated on coordinates and momenta. The only terms different from the identity map are:

V. NUMERICAL RESULTS
We compared the results of this symplectic integrator with the well-established code TraceWin [3]. In particular, we benchmarked against a drift-gap-drift model, where we used the "bunched cavity or thin gap" element of TraceWin for the gap. We also compared with a fieldmap model, but the discrepancies with a thin gap are negligible and not presented here.
In order to compare the results of this symplectic integrator with TraceWin, we need the results in the same reference frame. The first step is thus to find the transformation from the covariant Hamiltonian to the Hamiltonian in the laboratory frame that uses t as the independent variable. This can be done using Eq. (3) noting that dt dτ = γ. From the definition of the momenta Eq. (8) we have for the general Hamiltonian and this is where the vector notation refers to the three spatial coordinates and the square is the norm square of the vector. Using the fact that v 2 = 1 − 1 γ 2 , we can connect the spatial component with the time component this is the Hamiltonian when t is used as an independent variable [4] if we identify cP 0 as the Hamiltonian. From this Hamiltonian we can apply the transformations as in [5]. The first transformation is to normalize the left and right sides of Eq. (33) by the reference momentum P r = βγmc. This momentum is well established when the Hamiltonian does not depend on time, but it is not uniquely defined along the motion of a time-dependent Hamiltonian because β and γ are not constant. Thus, for every instance in which we compare a step of the covariant Hamiltonian algorithm with TraceWin, we need to normalize the result to the reference momentum of that step calculated from the total energy cP 0 .
It is worth stressing here that the algorithm used for the integration of the covariant Hamiltonian is the one in Eqs. (27) and (28) where no normalization is applied, and only the final result (or an intermediate result as with energy plot in Fig. 1) is normalized for comparison with TraceWin. To introduce a normalization on each step may be useful to keep the numerical quantities small in the execution of the algorithm, but it introduces an additional dependence of the steps from the energy that does not come from the Hamiltonian itself and violates the symplectic nature of the Lie transform. This is why we use the normalization only on the final result for comparison purposes.
The last input we need for our simulator is the step size h. At the entrance of the cavity we have γ i which can be calculated from the initial kinetic energy as γ i = E k i mc 2 + 1 while the speed in the laboratory frame is 1 − 1 Without acceleration, the time to traverse the first length step dL of the pill-box cavity having a total length L is dL = β i cdt and we can again use the transformation dt dτ = γ leaving We can thus divide the length L into segments and calculate the proper h in Eqs. (28) to evaluate the integrator. The β i and γ i must be recalculated at each step. This manner of selecting h may seem to introduce a dependence on the energy that can break the symplectic nature of the algorithm because it does originate from the Hamiltonian. This is not true for the integrator used here because the step length is pre-calculated and used as a constant for each step of pure drifts (the only part of Eqs. (28) where h appears) and we know that the Lie transform always generates a canonical (and so symplectic) map, regardless the size of the integration step.
The symplecticity is preserved by this procedure where the momentum is fixed along the drift sections, but another issue is a more subtle. The separation methods for symplectic integration, including the one used in this paper, minimize the error compared to the full Hamiltonian when the choice of the coefficients cancels the high-order terms of the Zassenhaus formula (which provides the expansion of the exponential of the Lie operator, see [5] p. 314). For our algorithm, this cancellation occurs when h is unchanged from the first to the last drift of the S 2 integrator.
However, in our case we want to change the value of h every time that we pass through a kick given by the U z potential. This procedure may break the symmetry of the S 2 integrator, which is no longer of second order, and introduces some error. To avoid this problem, one can use the same value for h along one full step of integrating S 2 , and then only recalculate h between integration steps.
The test case we use for comparison with Tracewin is a bunch consisting of 10 5 protons uniformly distributed around a kinetic energy of 100 MeV and passing through a pill-box cavity with a frequency of 200 MHz and a length of 1 m. The phase space for the three spatial dimensions x, y, z at the entrance and at the exit of the cavity is shown in Fig. 2, where z is collinear with the beamline. The comparison shows a strong matching, but this is not a surprise because such a cavity is primarily a drift space for our beam.
The interesting part here is in the behaviour of the energy. The parameters selected for this numerical test are such that the cavity is working quite far from any ideal acceleration conditions. In fact, a proton of 100 MeV has a relativistic β = 0.428 and will take 7.79 ns to pass through the 1 m of length of the cavity. A cavity oscillating at 200 MHz will do 1.5 full oscillations in 7.79 ns. This oscillation becomes traceable (Fig. 1) in the energy gain of the covariant Hamiltonian algorithm if we track a reference particle with initial conditions set to zero for each coordinate and momenta component and with a ki-netic energy of 100 MeV.
The transit-time factor of such a field is 0.197, that is, the acceleration is only 20% of the peak field. In TraceWin, the effect will be to have a total energy increase of 0.2 MeV because the GAP element of this program uses the TTF to calculate the energy gain. In the simulator constructed with the covariant Hamiltonian, we will see the same increase in energy at the end, but we can see the integration along the length of the cavity for each integration step.

VI. CONCLUSIONS
We presented an algorithm for performing symplectic integration of Hamiltonian when the external potential depends on time. The main idea is to use the full covariant Hamiltonian and to integrate the field in 8dimensional phase space applying a Lie-operator method to the field component as was done for s-dependent fields in [2]. A comparison with TraceWin, a well-established particle simulator, shows that the method reproduces the correct dynamics for the simple case of a pill-box cavity. More complicated potentials are feasible if they respect the separability expressed by Eq. (26).