Introduction

Concepts

Reference Trajectory

ImpactX is an s-based beam dynamics code with space charge. Particles are tracked using the longitudinal accelerator lattice position \(s\) as the independent dynamical variable. Particle phase space coordinates are specified relative to a nominal reference trajectory.

The reference trajectory plays an important role in ImpactX. In addition to specifying the nominal machine orbit, it specifies the relationship between the local beam coordinate system and the global lab coordinate system. A reference trajectory is favorable instead of, e.g., differences to the beam centroid, because:

  1. the reference trajectory is the ideal single-particle orbit used as part of the optics design, so it is better that it can be computed independently of the beam distribution,

  2. differences between the beam centroid and the reference particle are important when investigating the effects of misalignments and errors for beamline designs,

  3. the fields are usually specified relative to the reference trajectory, and the dynamics becomes more nonlinear as one moves away from the reference trajectory, so knowing how far the beam particles are form the reference trajectory is important for accuracy,

  4. we want to keep track of the reference trajectory in global coordinates, and that global information is not available in the particle data alone, so it would need to be specified in some other way.

The reference values of \(z=ct\) and \(s\) should be identical until reaching a bending element. (If the lattice contains no bending elements, then they should coincide.) Also, the reference value of \(ct\) coincides with the value of \(s\) in the ultrarelativistic limit. More generally, the derivative \(ds/d(ct) = \beta\), where the relativistic \(\beta = \sqrt{1-\frac{1}{p_t^2}}\).

Collective Effects

Collective effects from space charge of the particle beam are solved between steps in \(s\). One can set the number of slice steps through each lattice element for the application of the space charge push.

Note

Currently, space charge kicks are calculated in 3D. A 2D space-charge solver for purely transversal effects will be added in the future.

Coordinates and Units

Each particle in the beam is described at fixed \(s\) by a set of 6 canonical phase space variables (x [m], px, y [m], py, t [m], pt). Coordinates x and y denote the horizontal and vertical displacement from the reference particle, respectively, and describe motion in the plane transverse to the velocity of the reference particle. The longitudinal coordinate t denotes the difference between the arrival time of the particle and the arrival time of the reference particle, multiplied by the speed of light \(c\).

The momenta conjugate to x, y, and t are denoted px, py, and pt, respectively. These variables are normalized by the magnitude of the momentum of the reference particle, and are therefore dimensionless. In a region of zero vector potential, for example, \(p_x = \Delta(\beta_x\gamma)/(\beta_0\gamma_0)\), where \(\beta_0\) and \(\gamma_0\) denote the relativistic factors associated with the reference velocity. In a region of zero scalar potential, pt denotes the deviation from the reference energy normalized by the design momentum times the speed of light, so that \(p_t = \Delta(\gamma)/(\beta_0\gamma_0)\).

Unlike particles within the beam, the reference particle is described by a set of 8 phase space variables (x [m], px, y [m], py, z [m], pz, t [m], pt) that are specified in a global laboratory coordinate system (x,y,z). The momenta of the reference particle are normalized by \(mc\), so that \(p_x=\beta_x\gamma\), etc. A parameteric plot of the reference trajectory variables (x,z) allows the user to view the global geometry of the accelerator structure (footprint).

Beam Distribution Input

phase space ellipse

Fig. 13 Phase space ellipse in the coordinate plane of position \(q\) (realized as \(x\), \(y\), and \(t\)) and associated conjugate momentum \(q\) (realized as \(p_x\), \(p_y\) and \(p_t\)).

Particle beam user input in ImpactX can be done in two ways.

The first option is to characterize the distribution via the intersections of the phase space ellipse with the coordinate axes and the correlation terms of the canonical coordinate pairs.

\[\begin{split}\begin{align} \lambda_q &= \sqrt{\frac{\epsilon}{\gamma}} \\ \lambda_p &= \sqrt{\frac{\epsilon}{\beta}} \\ \mu_{qp} &= \frac{\alpha}{\sqrt{\beta \gamma}} \end{align}\end{split}\]

The units are \([\lambda_q] = \mathrm{m}\), \([\lambda_p] = \mathrm{rad}\), and \([\mu_{qp}] = 1\). To convert between normalized and unnormalized emittance, use the relation \(\epsilon_\mathrm{n} = (\beta\gamma)_\mathrm{ref} \cdot \epsilon\) which uses the momentum of the reference particle. Attention: Here, \((\beta\gamma)_\mathrm{ref}\) are the Lorentz variables for the reference particle momentum and not the Courant-Snyder parameters.

The second option is to specify the distribution via the Courant-Snyder / Twiss parameters \(\alpha\) and \(\beta\) along with the unnormalized (geometric, 1-RMS) emittance \(\epsilon\) for all the spatial coordinates. Recall the Courant-Snyder relation \(\gamma\beta - \alpha^2 = 1\) for conversion from \(\gamma\) values to our input conventions.

Distribution Sampling and the Covariance Matrix

In ImpactX, beam sampling is performed under the assumption that the initial beam distribution centroid (mean phase space vector) coincides with the phase space origin. The covariance matrix \(\Sigma\) is defined by \(\Sigma_{ij}=\langle{\zeta_i\zeta_j\rangle}\), where \(\zeta\) denotes the vector of phase space coordinates, and indices \(i,j\) specify the components of \(\zeta\).

Let \(P\) denote a phase space probability density with unit covariance matrix (i.e., equal to the identity matrix). To produce a phase space density with a target covariance matrix \(\Sigma\), we write \(\Sigma\) in terms of its (lower) Cholesky decomposition as:

\[\begin{equation} \Sigma = LL^T, \end{equation}\]

where \(L\) is a lower triangular matrix.

Define a beam distribution function \(f\) by:

\[\begin{equation} f(\zeta)=\kappa P(L^{-1}\zeta),\quad\text{where}\quad \kappa=|\det L|^{-1}. \end{equation}\]

Then \(f\) has the desired covariance matrix \(\Sigma\). Samples from \(f\) are obtained by sampling from \(P\) and performing the linear transformation \(\zeta\mapsto L\zeta\).

Let \(P\) above denote a 2D probability distribution that is radially symmetric, in the sense that:

\[\begin{equation} P(\zeta)=G(||\zeta||^2)=G(q^2+p^2),\quad\quad \zeta=(q,p) \end{equation}\]

Here \(q\) denotes a position coordinate (e.g., \(x\), \(y\), or \(t\)) and \(p\) denotes the corresponding conjugate momentum.

Then the resulting distribution \(f\) has 2D elliptical symmetry, in the sense that:

\[\begin{equation} f(\zeta)\propto P(L^{-1}\zeta)=G(||L^{-1}\zeta||^2)=G(\zeta^TS\zeta),\quad\quad S=\Sigma^{-1}. \end{equation}\]

The argument of \(G\) is a quadratic form in \((q,p)\), and it is convenient to express this quadratic form as:

\[\begin{equation} \zeta^TS\zeta = \frac{q^2}{\lambda_q^2} + 2\mu_{qp}\frac{qp}{\lambda_q\lambda_p}+\frac{p^2}{\lambda_p^2}=\frac{1}{\epsilon}\left(\gamma q^2+2\alpha qp + \beta p^2\right). \end{equation}\]

Here \(\alpha\), \(\beta\), and \(\gamma\) denote the Courant-Snyder Twiss functions, and \(\epsilon\) denotes the rms (unnormalized) emittance.

The associated covariance matrix may be written explicitly in terms of the above parameters as:

\[\begin{split}\begin{equation} \begin{pmatrix} \lambda_q & 0 \\ 0 & \lambda_p \end{pmatrix} \begin{pmatrix} 1 & \mu_{qp} \\ \mu_{qp} & 1 \end{pmatrix}^{-1} \begin{pmatrix} \lambda_q & 0 \\ 0 & \lambda_p \end{pmatrix} = \epsilon \begin{pmatrix} \beta & -\alpha \\ -\alpha & \gamma \end{pmatrix}. \end{equation}\end{split}\]

Note: In the special case that \(\mu_{qp}=0\), we have \(\lambda_q=\sigma_q\) and \(\lambda_p=\sigma_p\), where \(\sigma_q=\langle{q^2\rangle}^{1/2}\) and \(\sigma_p=\langle{p^2\rangle}^{1/2}\).

Assumptions

This is an overview of physical assumptions implemented in the numerics of ImpactX.

Tracking and Lattice Optics

Tracking through lattice optics in ImpactX is performed by updating the canonical phase space variables (x,px,y,py,t,pt) using symplectic transport. The elements supported currently fall into one of the following categories:

  • zero-length (thin) elements, such as multipole kicks and coordinate transformations

  • ideal (thick) elements using a hard-edge fringe field approximation, such as drifts, quadrupoles, and dipoles

  • soft-edge elements described by \(s\)-dependent, user-provided field data, such as RF cavities

  • ML surrogate models using a trained neural network (not necessarily symplectic)

Transport may be performed using one of three possible levels of approximation to the underlying Hamiltonian:

  • linear transfer map (default): obtained by expanding the Hamiltonian through terms of degree 2 in the deviation of phase space variables from those of the reference particle

  • chromatic or paraxial approximation: obtained by expanding the Hamiltonian through terms of degree 2 in the transverse phase space variables, while retaining the nonlinear dependence on the energy variable pt

  • exact Hamiltonian: obtained using the exact nonlinear Hamiltonian

Space Charge (Poisson Solver)

  • velocity spread: when solving for space-charge effects, we assume that the relative spread of velocities of particles in the beam is negligible compared to the velocity of the reference particle, so that in the bunch frame (rest frame of the reference particle) particle velocities are nonrelativistic

  • electrostatic in the bunch frame: we assume there are no retardation effects and we solve the Poisson equation in the bunch frame