Free-electron lasers and masers use a relativistic electron beam as their light source, meaning that being able to study and understand the behavior of free-electron lasers requires being able to model electron beams. This guide is a comprehensive overview of how we can model electron beams mathematically and computationally.

Note: This is a general overview on modelling electron beams, with primary emphasis on analytic methods. For specific information about using numerical methods for electron beam modelling, please see Numerical modelling of electron beams.

Modelling of undulator electron beams

Here, we will use slightly different coordinate conventions compared to Free-electron maser physics, in an attempt to match the standard literature convention. In our new conventions, is the optical axis, is the direction parallel to the north-south axis of the magnets, and the direction perpendicular to the magnets. The electrons travel in the plane in the undulator.

The electron beam trajectory follows the relativistic Lorentz force equation for magnetic fields:

This is a highly-nonlinear system of differential equations, one we will need to solve (either through analytical or numerical means) to determine the trajectory of the electron beam through undulator. It is pretty obvious that an exact analytical solution is near-impossible to obtain, and we will need to use numerical methods.

Why do we care about the electron beam trajectories? Well, because a well-behaved electron beam is essential to high-efficiency operation of the maser. If the electron beam loses collimation or diverges, the power output of the maser will drop, and energy would be wasted; indeed, in some cases, the maser may not be able to function at all. This is why it is so important to calculate (or simulate) electron beam trajectories, prior to the start of construction.

Fundamental parameters controlling electron beams

From the Lorentz force equations, we can clearly see that the trajectories of charged particles in a magnetic field are dependent on their velocities, their charge, and the magnetic field strength (and orientation). In our case, the beam is made of one type of particle (electrons) so the charge is fixed; however, the electron velocity can be varied by changing the accelerator voltage (see Vacuum tube Lorentz factor calculation) and the magnetic field strength can be modified by raising and lowering the magnets. These two will be the key parameters used to control the electron beam.

A heuristic derivation of the beam energy threshold

The electron beam’s behavior is dependent on many variables, but a particularly important one is the beam energy: the average kinetic energy of electrons in the beam. A beam energy that is too low will lead to a beam that is deflected straight back by the undulator magnets. A beam energy that is too high is very inefficient. Finding the right beam energy is essential, but very difficult to calculate by analytical methods.

A good way to try to estimate the beam energy necessary is to consider just one magnet, which we assume produces a constant magnetic field of . Note that this field is oriented transverse to the motion of a charged particle. By Newton’s second law, we know that the particle will follow a circular path if its velocity satisfies:

Thus upon rearrangement we have:

Therefore, only a particle with an “escape velocity” would avoid ending up in a circular orbit, and successfully “escape” to reach the next magnet in the undulator. Note that we can rearrange our previous equation in terms of the normalized velocity as follows:

For an electron, we can rearrange in terms of natural constants to obtain:

Where is the electron mass-energy. Since the electron beam should be fairly paraxial, we know that (where is the width of the undulator), which allows us to obtain a rough order-of-magnitude estimate for (in addition, we can take known values of for other free-electron maser and laser installations). At a field and a radius beam, this yields a minimum velocity of (or around 6% of the speed of light, corresponding to a beam energy of around 1 keV) for . Note, however, that this is less for off-axis electrons, i.e. for . While this calculation is ultimately a very rough approximation, it does set a theoretical minimum for the energy necessary for an electron to escape the rotational pull of the magnetic field.

We may obtain a more accurate approximation from , the analytical expression for the displacement of an electron beam from the centerline in an ideal undulator (from Jackson, Classical Electrodynamics), where , , and . Thus after the substitution , one has:

For a field strength of , this result gives around 1% the speed of light for , and around 8% the speed of light for , rising to around 14% the speed of light for due to the quadratic dependence on . However, using weaker field strengths, the beam energy requirements are much lower; for instance, at a field strength of and the required velocity is less than a percent of the speed of light.

Undulator modelling

Now that we have a rough benchmark, we can attempt to analytically solve for the electron beam trajectories. This will only allow us to get an approximate result, for reasons that will become clear shortly; but it does provide us with a useful reference result.

Approximate solution in the highly-relativistic regime

The analytical solution to the problem is based on the famous EM textbook Classical Electrodynamics by Jackson. On pg. 684 (in chapter 14.7, 3rd. ed.), the solution for the beam trajectories is given as (here Jackson uses but we would write this as in our notation). He then claims that one can divide between wigglers (which emit incoherent radiation) and undulators (which emit coherent radiation) via the value of . For a wiggler, , but for an undulator, . This is a result that we have regarded as implicitly-known.

On pg. 687, Jackson then defines (in our notation, ) and . This definition of is clearly in Gaussian units due to his extra factor of , since in SI we have , which we can also write in our notation as . Rearranging gives us . If we then define we can write this more elegantly as . Thus (in our notation):

Thus we see that the electrons exhibit oscillatory “wiggling” motion with period , and a maximum displacement proportional to . Since , the maximum displacement of the electron oscillations decreases for faster electrons, but the period remains constant, which is the result of relativistic length contraction.

Note: For the electrons to not smash into the undulator walls, we obviously need , where is the width of the undulator. Note that so the maximum displacement of the electrons from the axis is strongly dependent on the separation between the magnets. In practice, even with very strong fields of and a long magnet separation of , is only around 3.7 cm.

However, exactly how Jackson’s initial claim that is derived is not directly shown; we can assume that it is just an ansatz. A hint comes from when Jackson states that:

“If the periodicity of the magnetic field structure is , the particle’s path will be approximately sinusoidal in the transverse direction with the same period.” (pg. 684)

He does explain that (on pg. 686) that working from the Lorentz force equation the -component can be written as , which is the only meaningful component since is assumed to be “negligible or zero”. Note that since he is working in Gaussian units, the relativistic Lorentz force equation reads as , which has an extra factor of compared to SI units. He assumes that (its components may change but its magnitude stays relatively constant) so and he can factor it out, giving .

With the approximations and , he arrives at an expression for the magnetic field, where . Afterwards, he acknowledges that “an actual magnet structure will be periodic, but not sinusoidal” and that is better represented as a Fourier series in , though he keeps only the fundamental mode of the series for simplicity.

On the following page, he gives (which can be written as using his previous approximation), so at we have . And since it is assumed that then , where he claims that and thus he uses a binomial approximation to derive (specifically, ). We may infer that it is reasonable to assume that the electrons are initially moving nearly purely along the axis as they enter the undulator (by definition the direction of motion points in the same direction as the velocity vector, and thus points along ).

However, note that the solution from Jackson is only valid under very idealized conditions, including (but not limited to) a magnetic field that is close to a pure harmonic, highly-relativistic electrons, , and . These are assumptions that generally do not hold in the mildly-relativistic regime that free-electron masers typically operate at, so we need better approximations.

Derivation of Jackson’s analytical solution

Since Jackson does not derive his analytical solution for directly, we will sketch out a derivation here. To start, we know (or at least Jackson tells us) that the magnetic field inside the undulator is given by:

(Note that here is the same thing as ; it is just a different notation that we’ll use interchangeably). Here, is the magnetic field amplitude, is the wavenumber, and is the spatial period (distance between every pair of magnets with same polarity).

To solve the problem approximately, we assume that the initial velocity of the electrons (when they are fed into the undulator) is almost entirely along the axis. Since there is no or component, by substituting and expanding the cross-products in the Lorentz force formula, we have:

Thus, we find that the electrons move purely in the -plane, and their equations of motion are given by:

Now, we will make the assumption that the -component of the electron’s velocity is assumed to be essentially constant (). This means that the second differential equation becomes , which has the trivial solution of . It also means that we have just one differential equation left, that being the one for . But given that we know , the first differential equation simplifies to:

This is still a nonlinear differential equation, and indeed if we expand it it takes the rather-ugly-looking form1:

Where we once again define . This is made even worse by the fact that the Lorentz factor itself depends on , making this even harder to solve. It certainly cannot be solved analytically in this form. However, if we assume that , then it can be factored away, giving us:

Solving is then simply a matter of twice-integrating the above, giving us:

Defining as the “relativistic” form of gives us:

Note that with the approximation (the strongly-relativistic limit) this is the same result as Jackson (where ), up to a sign difference; the sign difference comes from the negative charge of the electrons, so . This result clearly shows that the electrons move in sinusoidal trajectories, “wiggling” from left to right along the plane - which is indeed what we would expect. However, remember that this is an approximate solution!

Approximate solution in the non-relativistic and mildly-relativistic regime

A more rigorous approximate solution can be found by linearizing the system about the critical points. This solution works in the non-relativistic and mildly-relativistic limit, where we can assume that . However, it is not too difficult to extent it to the strongly-relativistic limit as long as we assume that .

To start, let us begin with the exact equations of motion with no simplifications:

As a reminder, these are highly-nonlinear differential equations that are not easy to solve using SciPy’s native differential equation solver. However, we can quasi-linearize them by taking which holds in the non-relativistic and mildly-relativistic limit (meaning it is valid to around , more than enough for our purposes). This gives us:

Or in vector form:

Note that if (we may call this constant field ) then it would be possible to solve this system of differential equations analytically. We would then have , and the system simplifies to:

Using a computer algebra system or by just using the general methods of solving ODEs, we can solve the (simplified) system exactly; the solution is simply in terms of sines and cosines. An example implementation for solving the system symbolically using SymPy is given below:

# first show symbolic solution
import sympy as sp
from sympy import symbols, Eq, Function, re, Matrix
from sympy.solvers.ode.systems import dsolve_system
t, q, By, m = symbols("t q B_0 m", real=True)
x = Function("x")(t)
z = Function("z")(t)
 
# define derivatives
xdot = x.diff(t)
xddot = xdot.diff(t)
zdot = z.diff(t)
zddot = zdot.diff(t)
w0 = q*By/m
 
# define the simplified system of ODEs
ode1 = Eq(xddot, -w0*zdot)
ode2 = Eq(zddot, w0*xdot)
 
# solve the simplified system
symbolic_sols = dsolve_system([ode1, ode2])
 
# print out the solutions from SymPy
symbolic_sols[0][0]
symbolic_sols[0][1]

The solutions (from SymPy or worked-out manually) are given by:

Thus we find that if (that is, if it were a uniform field) we have where here is an angular frequency. Therefore, in the case of a uniform field (or alternatively, in the limit of ), we have formally shown the electrons just orbit in circles with characteristic orbital frequency .

We can also use a classical method for solving nonlinear ODEs to obtain an approximate solution without assuming . This involves linearizing the system about its steady-states. To do so, let us start with the system with only the simplification . This gives us:

The system can then be rewritten in the following (phase-space) form, where :

The steady-states of the system can be found by setting the RHS of the above equation to zero; they are at and (for odd ), with in both cases. Since the steady-state is trivial, the first non-trivial steady state occurs at . Now expanding about this steady state is equivalent to evaluating the Jacobian at . The Jacobian in this case is given (in general) by:

Evaluating at gives us:

The linearized version of the differential equation is then given by . The solution can be found by first finding the eigenvalues and eigenvectors of the Jacobian (which we’ll notate as from now on for short). They can be manually, or (more conveniently) with a computer algebra system; an example code using SymPy is shown below:

from sympy import symbols, Matrix
# calculate eigenvalues & eigenvecs of Jacobian
w0 = symbols("w_0")
J_star = Matrix([
    [0, 0, 1, 0],
    [0, 0, 0, 1],
    [0, 0, 0, -w0],
    [0, 0, w0, 0]
])
J_eigenvecs = J_star.eigenvects()
print(J_eigenvecs)

Whether calculated manually or on computer, the result should be the same: there are three sets of eigenvalues and eigenvectors. The first is the trivial eigenvalue with multiplicity 2, with associated eigenvectors and . The second is the eigenvalue with multiplicity 1, with associated eigenvector . The third is simply the conjugate of the second, with the eigenvalue of and associate eigenvector . Thus the general solutions are:

Simplifying with some new constants gives us:

Which…is a fairly underwhelming result, since we have essentially arrived at our circling-particle solution once again, although this time in a much more mathematically-formal manner. However, this result is not useless; an important aspect of any numerical solver is that it must reproduce this solution in the appropriate limits.

Numerical methods for undulator simulations

Information about numerical methods can be found in Numerical modelling of electron beams.

Electron gun modelling

Understanding electron beams also involves being able to model electron guns, which are what produce electron beams in the first place. Electron guns come in a wide variety of designs, but here we will focus on electrostatic electron guns, and discuss how they can be modelled and simulated. In an electrostatic electron gun, a potential is maintained between a cathode (negatively-charged plate) and anode (positively-charged plate). This potential difference is what “pushes” free electrons between the plates, which can then be collimated to form a beam (see Vacuum tube Lorentz factor calculation for more details). We will explain how to model an (electrostatic) electron gun below.

Modelling electron trajectories through electron gun

The key aim in electron gun modelling is beam tracing: tracing the paths of electrons as they exit the cathode surface and are propelled and collimated into a beam. This is significant because the whole point of an electron gun is to create a collimated beam of free electrons. Since power is proportional to both current and voltage, the more free electrons are in the beam, the more efficient the electron gun will be.

In an electron gun, several key physical mechanisms are at play, which must all be accounted for in a realistic model of an electron gun. First, electrons “boil off” the cathode due to primarily thermionic emission, at which point the electrons have random velocities and are moving in random directions[^5]. To be able to focus the electrons into a beam, a potential is applied. The applied potential difference between the cathode and anode is a constant value , that is:

Note: Be careful to note that while the potential difference is constant, the electric potential itself isn’t! Indeed, if it was, we would have an equipotential surface, meaning that there would be no electrostatic acceleration at all!

Considering the problem in 1 dimension, we may solve for the potential via the boundary conditions[^6] and , where is the distance between the cathode and anode. Thus, by solving Laplace’s equation for electrostatics (that is, ) in one dimension (in which case it becomes where is the beam’s axis of propagation), one finds that:

Where is the linear potential density (potential per unit length). The applied electric field is thus given by:

However, the applied electric field is not the only field that affects the motion of the electrons. First, we must consider the effects of the electron self-potential, caused by the electrostatic repulsion of the electrons within the beam. This causes the beam to diverge, which requires collimating magnetic lenses to correct for the divergence and collimate the beam. Second, we must model the collimating magnets themselves, in which case we must consider the magnetic term in the Lorentz force law as well as the electric term.

Given the complexity of the dynamics involved, it is easiest to model the magnetic field the electron beam divergence caused by the self-potential as two separate problems. Of course, the underlying assumption is that they are indeed able to be treated as separate systems; mathematically, this assumption is valid if the self-potential-caused beam divergence is minimal over the length scales where the magnetic field is strong. We will assume this for the rest of our discussion.

We will now consider the behavior of the electrons after they boil off the cathode (we’ll discuss what happens prior in a section later down), excluding the electrostatic acceleration from the anode-cathode-potential. The velocity distribution of the electrons are thus encoded in the initial conditions, which is decoupled from their equations of motion. To compute the electron trajectories, we will once again need to use the Lorentz force law, whose most general form is given by:

In the non-relativistic regime, we have:

This is a reasonable approximation if the transverse acceleration of the electrons is generally non-relativistic or mildly-relativistic, which is the case for most electron guns used in free-electron masers. We now consider the electron self-potential caused by electron-electron repulsion in the beam. We may state it as follows:

By tracing the paths of the electrons chosen from different positions across the plate, one may find the general shape of the electron beam. As for their velocities, since the magnitude of the electron velocities must be equal or greater than the work function, the kinetic energy of the electrons is thus (non-relativistically):

Assuming the minimal kinetic energy to overcome the material’s work function and thus allow the electrons within the material to escape, we must have:

The problem can then be solved numerically with suitable assumptions for the initial conditions (for instance, and ). There are different algorithms for this purpose, such as the Barnes-Hut algorithm in electrostatics and the multigrid method for Poisson’s equation. A promising alternative is the particle-in-cell method, commonly used in plasma physics. However, a discussion of all of these algorithms would be far, far too lengthy here. Instead, we will simply show the analytical solution to the problem.

Analytical solution for electron trajectories with self-potential

In the absence of a magnetic field, the only interaction that shapes the electron beam is the inter-electron repulsion, which leads to beam divergence. The analytical solution of the problem, which is valid for both the non-relativistic and relativistic regimes, is given in implicit form by[^7]:

Where is the axis of propagation for the beam, is the beam waist (the initial width of the beam at ), is the ratio of the beam radius to the beam waist, is a constant, and is a dimensionless variable known as the generalized beam perveance, given by[^9]:

Where is the magnitude of the elementary charge, is the permittivity of free space, is the electron rest mass, is the Lorentz factor, is the beam current, and is the electron velocity in the direction. Note that the Lorentz factor can be computed from the beam energy (see Vacuum tube Lorentz factor calculation for more details), and if we assume that the divergence is fairly small () then:

Finally, is defined by the following logarithmic integral:

Note: it is also possible to write the solution in the more familiar (implicit) form with . However, when the beam divergence is very small (on the order of micrometers), this becomes difficult to evaluate numerically, so it is preferred to use the dimensionless variable rather than .

Note that as long as the distance between the cathode and anode is short (i.e. is small), the solution can be approximated via:

In which case it is possible to write out the solution explicitly as a function of , as follows:

This comes from the leading-order term in the series expansion for , which is a Puisseux series in the form:

One may derive this with the substitution [^8], . This then gives us:

Where . This integral can be evaluated by means of the following identity:

Where is the incomplete upper gamma function, given by:

In our case, we have and , therefore:

Note that by the properties of the incomplete gamma function, where is the error function and is the complementary error function Thus the above reduces to:

The Maclaurin series of the error function is given by:

Thus we have:

And thus:

Thus, the solution of the integral can be written in series form as:

And thus, to leading-order, we obtain the following approximation, which we may then substitute into :

Magnetic lens modelling

Now, as the electrons pass through the magnetic lens comprised of 2 sextupole magnets, we also need to factor in the effect of the magnetic field. Here it is easiest to work with the (magnetic) vector potential rather than the magnetic field ; they are related by . In our case, the vector potential satisfies the differential equation:

This is simply Laplace’s equation for magnetostatics, and it can be solved via the multipole expansion. In polar coordinates one finds that the vector potential takes the form:

Where are some constants determined by the boundary conditions. This polar form is useful because the sextupole magnet is rotationally-symmetric. We will ignore the component here since it turns out it is unimportant.[^12]

Note: See a visualization of the magnetic vector potential at https://www.math3d.org/DSWoli41Gv. Note that the magnetic field is always perpendicular to the vector potential .

The equations of motion are easiest to find from the electromagnetic Hamiltonian, which may be written in terms of the position and canonical momentum as follows:

This gives you Hamilton’s equations, a system of two first-order differential equations, which are respectively given by:

Excluding the electric potential (since we are considering only the effects of the magnetic lens) and noting that is time-independent (since we are considering only magnetostatics), we have:

Note that since , the first-order equations obtained from the Hamiltonian approach end up exactly equivalent to the Lorentz force law. Now expanding with the formulas for the curl in polar coordinates[^11], we obtain a system of differential equations for , given by:

Where , , and:

It should be more than obvious that this system is impossible to solve analytically without a slew of approximations. However, it can be solved numerically using the same techniques as described previously for the undulator beam.

Note: See notebooks/magnetic-lens-calculations.ipynb for the derivation of the equations of motion in explicit form.

Thermocathode modelling

The last part, which we have left out so far, is how the electrons are ejected from the first place from the cathode prior to being collimated into a beam. This is a complex topic, so it is out of scope for this page, but please see Thermocathode design for electron gun for more details.

Footnotes

  1. We substituted in into and then substituted in to obtain this result.