elegant started as a tracking code, and it is still well-suited to this task. elegant tracks in the 6-dimensional phase space (x,x′,y,y′,s,δ), where x (y) is the horizontal (vertical) transverse coordinate, primed quantities are slopes, s is the total, equivalent distance traveled, and δ is the fractional momentum deviation. Note that these quantities are commonly referred to as (x, xp, y, yp, s, dp) in the namelists, accelerator element parameters, and output files. (“dp” is admittedly confusing—it is supposed to remind the user of ΔP∕Po. Sometimes this quantity is referred to as “delta.”)
In some elements, elegant uses canonical coordinates in place of the slopes. These are defined as
The inverse relationship is
Tracking may be performed using matrices (of selectable order), canonical kick elements, numerically integrated elements, or any combination thereof. For most elements, second-order matrices are available; matrix concatenation can be done to any order up to third. Canonical kick elements are available for bending magnets, quadrupoles, sextupoles, and higher-order multipoles; all of these elements also support optional classical synchrotron radiation losses. Among the numerically integrated elements available are extended-fringe-field bending magnets and traveling-wave accelerators. A number of hybrid elements exist that have first-order transport with exact time dependence, e.g., RF cavities. Some of the more unusual elements available are third-order alpha-magnets[5, 4], time-dependent kicker magnets, voltage-ramped RF cavities, beam scrapers, and beam-analysis “screens.”
Several elements support simulation of collective effects, such as short- and long-range wakefields, resonator impedances, intra-beam scattering, coherent synchrotron radiation, and the longitudinal space charge impedance.
A wide variety of output is available from tracking, including centroid and sigma-matrix output along the accelerator, phase space output at arbitrary locations, turn-by-turn moments at arbitrary locations, histograms of particle coordinates, coordinates of lost particles, and initial coordinates of transmitted particles. In addition to tracking internally generated particle distributions, elegant can track distributions stored in external files, which can either be generated by other programs or by previous elegant runs. Because elegant uses SDDS format for reading in and writing out particle coordinates, it is relatively easy to interface elegant to other programs using files that can also be used with SDDS to do post-processing for the programs.
elegant allows the addition of random errors to virtually any parameter of any accelerator element. One can correct the orbit (or trajectory), tunes, and chromaticity after adding errors, then compute Twiss parameters, track, or perform a number of other operations. elegant makes it easy to evaluate a large number of ensembles (“seeds”) in a single run. Alternatively, different ensembles can be readily run of different CPUs and the SDDS output files combined.
In addition to randomly perturbing accelerator elements, elegant allows one to systematically vary any number of elements in a multi-dimensional grid. As before, one can track or do other computations for each point on the grid. This is a very useful feature for the simulation of experiments, e.g., emittance measurements involving beam-size measurements during variation of one or more quadrupoles.
Like many accelerator codes, elegant does accelerator optimization. It will optimize a user defined function of the transfer matrix elements (up to third-order), beta functions, tunes, chromaticities, radiation integrals, natural emittance, floor coordinates, beam moments, etc. It also has the ability to optimize results of tracking using a user-supplied function of the beam parameters at one or more locations. This permits solution of a wide variety of problems, from matching a kicker bump in the presence of nonlinearities to optimizing dynamic aperture by adjusting sextupoles.
elegant provides several methods for determining accelerator aperture, whether dynamic or physical. One may do straightforward tracking of an ensemble of particles that occupies at uniform grid in (x, y) space. One may also invoke a search procedure that finds the aperture boundary. A related feature is the ability to determine the frequency map for an accelerator, to help identify aperture-limiting resonances.
In addition to using analytical expressions for the transport matrices, elegant supports computation of the first-order matrix and linear optics properties of a circular machine based on tracking. A common application of this is to compute the tune and beta-function variation with momentum offset by single-turn tracking of a series of particles. This is much more efficient than, for example, tracking and performing FFTs (though elegant will do this also). This both tests analytical expressions for the chromaticity and allows computations using accelerator elements for which such expressions do not exist (e.g., a numerically integrated bending magnet with extended fringe fields).
A common application of random error simulations is to set tolerances on magnet strength and alignment relative to the correctability of the closed orbit. A more efficient way to do these calculations is to use correct-orbit amplification factors. elegant the computes amplification factors and functions for corrected and uncorrected orbits and trajectories pertaining to any element that produces an orbit or trajectory distortion. It simultaneously computes the amplification functions for the steering magnets, in order to determine how strong the steering magnets will need to be.