SYMPLECTIC TRACKING AND COMPENSATION OF DYNAMIC FIELD INTEGRALS IN COMPLEX UNDULATOR STRUCTURES

This presentation covers analytical models that describe the interaction of a relativistic particle beam with the magnetic field of undulators. Analytic approximations to the Hamilton-Jacobi equation yield generating functions useful for particle tracking and, therefore, efficient simulation. Analytic expressions for kick maps of APPLE II undulators are presented as well. Passive and active shimming schemes including magic fingers and current sheets are also modelled. Applications at BESSY II are discussed which ensure efficient injection during top-up to satisfy machine protection and radiation safety requirements. TRACKING WITH GENERATING FUNCTIONS In synchrotron radiation sources, like storage rings, a large fraction of the circumference is covered by insertion devices and thousands of passages through the IDs are required in tracking simulation, to decide on beam stability. A fast and symplectic tracking code to simulate the ID effects is required for an effective scanning of a large parameter space. The method of GF offers this possibility. For Cartesian coordinates this is described in [1]. The GF is derived by starting with a special Hamiltonian function, given by the longitudinal particle momentum , All vector potential terms are normalized by the magnetic particle stiffness eB , yielding . Similarly, all momenta are normalized by the particle momentum p0, . This Hamiltonian is applied to solve the HamiltonJacobian equation by an iterative procedure [1] with increasing accuracy. As a result, F3 is solved by a series expansion, the leading terms are given by with the coefficients This GF expansion for arbitrary, 3-dimensional magnetic fields converges well, if the components of normalized vector potential and the transverse momenta are small. The GF depends on integration step length zf, the initial particle coordinates (x, y) and on the final momenta (pxf, pyf). The conjugated coordinates are derived from relations The resulting transformation is formed into an explicit function, depending on the initial particle coordinate variables and yielding the final particle coordinate variables. The tracking routine is solved for arbitrary magnetic fields, and can be applied to a specified field, if the components of the vector potential can be expressed by functions which can be integrated and differentiated as required, like terms of a Fourier series. The step length zf depends on the smallness of the scaled vector potential terms , but normally the steps are much longer than comparable integration steps, increasing the speed of the transformation enormously. This method becomes especially fast for fast oscillating fields, where many oscillations can be tracked in a single step, whereas an integration methods requires steps much shorter than the shortest oscillation period. If the vector potential is derived from a Fourier series, the required fijk coefficients become very simple, because many terms cancel. MAGNETIC FIELD MODELS OF UNDULATORS If possible it is extremely useful to develop analytic models of the magnet structures to be studied. Assuming a permeability of one (only for pure permanent magnet devices) the field can be composed with a linear superposition of the fields of individual undulator subarrays. Often, the complete system can be described in all modes of operation (energy and polarization, i.e. magnetic gap and magnet row phase) by only a small set of parameters. Many undulator structures can be composed of a combination of several longitudinally extended magnet arrays and, usually, several rows can be described with the same set of coefficients. A few more parameters describe the transverse and longitudinal row Proceedings of IPAC2012, New Orleans, Louisiana, USA FRXAB01 05 Beam Dynamics and Electromagnetic Fields D06 Code Developments and Simulation Techniques ISBN 978-3-95450-115-1 4165 C op yr ig ht c ○ 20 12 by IE E E – cc C re at iv e C om m on sA tt ri bu tio n 3. 0 (C C B Y 3. 0) — cc C re at iv e C om m on sA tt ri bu tio n 3. 0 (C C B Y 3. 0) position. In the following we give examples for various undulator designs.

All vector potential terms are normalized by the magnetic particle stiffness eB , yielding .Similarly, all momenta are normalized by the particle momentum p 0 , .This Hamiltonian is applied to solve the Hamilton-Jacobian equation by an iterative procedure [1] with increasing accuracy.As a result, F 3 is solved by a series expansion, the leading terms are given by with the coefficients This GF expansion for arbitrary, 3-dimensional magnetic fields converges well, if the components of normalized vector potential and the transverse momenta are small.The GF depends on integration step length z f , the initial particle coordinates (x, y) and on the final momenta (p xf , p yf ).The conjugated coordinates are derived from relations The resulting transformation is formed into an explicit function, depending on the initial particle coordinate variables and yielding the final particle coordinate variables.The tracking routine is solved for arbitrary magnetic fields, and can be applied to a specified field, if the components of the vector potential can be expressed by functions which can be integrated and differentiated as required, like terms of a Fourier series.The step length z f depends on the smallness of the scaled vector potential terms , but normally the steps are much longer than comparable integration steps, increasing the speed of the transformation enormously.This method becomes especially fast for fast oscillating fields, where many oscillations can be tracked in a single step, whereas an integration methods requires steps much shorter than the shortest oscillation period.If the vector potential is derived from a Fourier series, the required f ijk coefficients become very simple, because many terms cancel.

MAGNETIC FIELD MODELS OF UNDULATORS
If possible it is extremely useful to develop analytic models of the magnet structures to be studied.Assuming a permeability of one (only for pure permanent magnet devices) the field can be composed with a linear superposition of the fields of individual undulator subarrays.Often, the complete system can be described in all modes of operation (energy and polarization, i.e. magnetic gap and magnet row phase) by only a small set of parameters.Many undulator structures can be composed of a combination of several longitudinally extended magnet arrays and, usually, several rows can be described with the same set of coefficients.A few more parameters describe the transverse and longitudinal row position.In the following we give examples for various undulator designs.

Planar Undulator
In [1] the generating function is derived for one longitudinal and one transverse Fourier component of a planar undulator.Any arbitrary periodic structure in longitudinal direction can be expanded into Fourier components in longitudinal and transverse direction.The vertical field dependence follows from Maxwell equations [2]: with . The sin-terms can be skipped ( ) for magnet configurations which are symmetric in transverse direction.The Fourier components add linearly in the vector potential.The generating function contains products and higher order terms of the vector potential.The convergence of the described tracking method permits the integration over several period lengths in a single step.Thus, cross terms of longitudinal Fourier components with different spatial frequencies drop out due to orthogonality and only products from terms of identical frequencies remain.

APPLE II Undulator
The magnetic structure of an APPLE II device is composed of four identical magnet rows which can be moved independently in longitudinal direction.It is sufficient to parametrize the field of one array via a transverse Fourier decomposition.The fields of the other rows follow from symmetry considerations and they depend on the relative longitudinal phases [1].Sin-terms are required if the magnets employ cut-outs for clamping or if the magnet shape is non-symmetric transversely, as it is the case for an APPLE III undulator [3] or a DELTA undulator [4].The 3 rd field harmonic in longitudinal direction is zero because the number of blocks per period is four.Higher order terms can be neglected.

Asymmetric Figure-8 Undulator
At high K-values conventional planar undulators produce a high heat load on axis which can deteriorate the performance of a high resolution beamline.The magnet design of the figure-8 undulator [5] is optimized for a reduced on-axis power density.The magnet array on each girder consists of a central magnet row for the vertical field and two side magnet rows with double the period length for the horizontal field.A further advantage of the design is the presence of odd-half-integer harmonics with vertical linear polarization besides the odd-integer harmonics with horizontal polarization.Thus, the figure-8 magnet configuration is ideally suited for an in-vacuum device with variable polarization since no magnet row phasing is required.In air the outer magnet rows can be moved longitudinally which provides elliptical light.This scheme has been proposed by Tanaka and Kitamura as the asymmetric figure-8 undulator [6].This device can be parametrized in a similar way as the APPLE II undulator.
The outer magnet rows are parametrized in the same way as the APPLE II arrays and the center magnet rows are modelled as a pure permanent magnet planar undulator.Two sets of Fourier coefficients are required for the inner and outer magnet arrays, respectively.The vector potential is given by: + with , , , period length of the outer arrays, = transverse distance of outer arrays and = difference gap to nominal gap where the Fourier coefficients have been determined.
, the phases of the two centre magnet rows, are usually zero.A similar expression can be found for and is assumed to be zero without any restriction of generality.Deriving the generating function, integrals over products of vector potential components have to be evaluated.Mixed terms from the contributions of inner and outer arrays do not show up due to the orthogonality of the functions.

MODELLING THE ENDPOLES
Undulator end structures are designed such that they minimize the net kick and sometimes also the net displacement.Usually, tracking of planar undulators assumes a cos-like vertical field at the undulator ends and zero horizontal fields.Elliptical / helical undulators are more complicated since the end structures must be compensated for both transverse field components.Two methods are available to treat the end structures of arbitrary undulator fields.Both methods are implemented into the tracking code Elegant [7].
The 1 st method [8] models the endpoles by two half periods with amplitudes of and of the periodic pole amplitude including the complete 3dimensional field distribution.Tracking through each endpole is done in two steps with step sizes of and appropriate amplitudes.Apart from the amplitude scaling the endpole tracking scheme follows exactly the scheme of the periodic part.
The 2 nd method [9] extrapolates the vector potential to zero at both ends and integrates in two steps (not necessarily equal in length) over the end structure.For illustration we discuss the 2 nd method for an APPLE II device.The vector potential of each magnet row i can be written as: Then, the total vector potential is given by: with and .Both schemes are applicable also to more complicated structures such as the asymmetric figure-8 undulator.
In both cases the magnetic field of the end structure shows non-differentiable points (the field is non-Maxwellian) where the number of these points is larger in the 1 st case.Nevertheless, the integration method is symplectic.Concerning the excitation pattern the 1 st method models a kick and displacement free configuration (i.e.: the axis of the trajectory helix within the periodic part of the undulator coincides with the undulator axis) whereas the configuration of the 2 nd method employs a finite beam displacement.Nevertheless, both methods deliver useful results and we see no preference for one of them.

STORAGE RING MAGNETS Fringe ields of ultipole agnets
Describing storage ring multipoles higher than a dipole cylindrical coordinates are best suited.The Hamiltonian has the form: The magnetic fields are given by [10] With the generic function and the related functions: The Hamiltonian requires the vector potential.We choose a vector potential with A z =0: The function is the 1 st integral of the generic function with respect to z.The field is completely defined by and we choose the following Ansatz: Higher derivatives of contribute only further off axis.
Thus, we have an analytic description of the vector potential for a real 3D multipole.The derivation of the generating function for symplectic tracking follows exactly the same procedure as for Cartesian coordinates using the canonical variables r, , p r , p .The implementation into a tracking code requires the transformation from Cartesian coordinates and (kinematic) impulses to cylindric, canonic coordinates and impulses and vice versa.The generating function can be derived analytically as described previously.The Hamiltonian employs quadratic terms of the vector potential.In case the integration over the multipole is done in a single step the vector potential terms in the Hamilton-Jacobi Equation are significantly reduced because cross terms of different spatial frequency drop out during integration.
For illustration we evaluated the fields of a permanent magnet quadrupole as proposed by Halbach [11] with 8 segments and inner / outer radius of 20mm / 40mm.
Figure 1 shows the longitudinal field distribution in the midplane r 0 off-axis with r 0 =3, 9, 18mm.A Fourierdecomposition provides the coefficients c i0 with Even close to the magnets (2mm distance) 25 Fourier coefficients describe the field within 0.2% accuracy.The coefficients a i are extracted from the c i0 via: Due to the low number of segments the radial field dependence is non-linear further off-axis.The 7 th order polynomial fit of Fig. 2 shows the contributions from 3 rd , 5 th and 7 th order radial terms (p 0 =4).
Figure 1: Longitudinal -field distributions in the midplane and representations with Fourier coefficients for a permanent magnet quadrupole with inner/outer diameter of 20/40mm.The fields are given at distances of 3mm (black), 9mm (red), 18mm (blue) to the beam axis.
The method of GF derived for Cartesian coordinates can be extended to cylindrical coordinates , where the transformation from the Cartesian in to the cylindrical coordinate variables is given by a GF of type [12] with and the variables 'z' and 'p z ' stay unchanged.
The implementation into a tracking code requires the transformation from Cartesian coordinates and (kinematic) impulses to cylindric, canonic coordinates and impulses and vice versa.In cylindrical coordinates the Hamiltonian is given as If the vector potential , the Hamiltonian describes transformations in a drift section.The changes of the particle coordinate variables within the drift are These are applied to construct the GF of a drift section As a consistency check, this GF can be used for a small drift length to approximate (difference quotient is replaced by differential quotient) comparable results from the Hamiltonian, for example which yields in agreement with the related derivatives from the Hamiltonian function.
This GF of a drift is used as a starting solution, to derive higher order terms of the GF by iteration [1] Assuming A z =0, the coefficients f ijk [1] are given by The GF depends on the initial position variables and final momenta, the conjugated coordinate variables are derived by Similar as in the Cartesian case, the resulting equation system can be formed into an explicit system, which yields the final particle coordinates as a function of the

Dipole Magnet
Applying the formalism to dipole magnets requires another coordinate system which is defined along the ideal orbit through the magnet.With an analytic description of the dipole in this specific coordinate system the derivation of the generating function for tracking is straight forward.This is subject to further investigations.

ANALYTIC UNDULATOR KICKMAPS
The tracking scheme described above includes the finite length of the magnet devices.Assuming short devices (thin lens approximation) kick maps can be used instead.Kick maps have been used for undulators where the kick maps are derived from magnetic field simulations.In case of complex undulator structures with many different modes of operation (e.g.APPLE II undulator in universal mode) and analytic field model permits an analytic description of the dynamic kicks.The canonical kicks are related to the generating function via: Within the periodic structure the integration is taken over integer multiples of the period length.The vector potentials are equal at the start and end points of integration (z 0 and z 0 +z f ) and, thus, the kinematic kicks and are identical to the canonical kicks.For illustration we give the kicks for an APPLE II device in the elliptical mode: with L= undulator length, = difference to reference gap, = electron beam stiffness.The analytic functions and (they depend only on the magnet row phase ), , and are given in [1].This description is based on a single set of Fourier coefficients which has been evaluated once.With this set of coefficients a fast evaluation of the dynamic kicks at all phases and gaps is possible which permits an on-line evaluation and compensation of tune shifts.Analytic kick maps for other operation modes (inclined mode or universal mode) are given in [1].

FRXAB01○
2012 by IEEE -cc Creative Commons Attribution 3.0 (CC BY 3.0) -cc Creative Commons Attribution 3.0 (CC BY 3.0) 05 Beam Dynamics and Electromagnetic Fields initial ones.The solution becomes more complicated as in the Cartesian case, but easily feasible for a FORTRAN tracking code.

Figure 2 :
Figure 2: Transverse -field distribution in the midplane for a permanent magnet quadrupole as described in the text.