9. RF Cavities

Reference Energy

Every beamline has a reference particle (species_ref), a reference energy (E_ref, the total energy in eV), and a reference momentum (pc_ref, in eV). The three are interrelated, so knowing the reference particle and either the reference momentum or the reference energy, the third can be calculated. The magnetic rigidity p_over_q_ref (in T·m) is another way to give the reference momentum. The reference momentum is used to normalize the phase space momenta, as well as the normalized strengths of the elements.

For example, for a quadrupole, the field gradient Bn1 (in T/m) can be used to give the linear field gradient, and Kn1 (in 1/m²) is the field gradient normalized by the magnetic rigidity of the reference particle: Kn1 = Bn1/p_over_q_ref. Whichever of the two was set last is stored, and the other is computed from it, in the beamline the element is placed in:

using SciBmad

q1 = Quadrupole(L=0.1, Kn1=0.14)
q2 = Quadrupole(L=0.1)
lat = Beamline([q1, q2], species_ref=Species("proton"), pc_ref=1e9)
lat[q2].Bn1 = lat.p_over_q_ref*lat[q1].Kn1 # The same field gradient as q1 [T/m]
lat[q1].Bn1, lat[q2].Kn1
(0.4669897332774129, 0.14)

If the reference momentum of lat is changed, the field gradient of q1 changes (Kn1 is stored), and the normalized strength of q2 changes (Bn1 is stored). See Defining a Beamline for more.

In a ring, the reference energy is the same everywhere. The RF cavities of a ring (RFCavity) change the energy of the particles that arrive at another time than the reference particle, but not the reference energy: the reference particle arrives at the zero crossing of the RF voltage, and keeps its energy. (These are the rfcavity elements of Bmad.)

In a linac, the cavities accelerate the reference particle, and the reference energy changes from one cavity to the next. In SciBmad, such a cavity is an RFCavity with the change of the reference energy dE_ref, tracked with the SaganCavity tracking method (see SaganCavity Tracking). (These are the lcavity elements of Bmad.) A change of the reference energy starts a new beamline: an element with dE_ref is the first element of a Beamline, and the beamlines of a linac are joined in a Branch. This tutorial only needs the cavities of a ring.

The phase of an RF cavity is set by phi0 and zero_phase (see RFParams). A particle that arrives a time \(\Delta t\) after the reference particle gains the energy \(|q| V \cos(\phi_0 + \phi_\mathrm{zero} + \omega \Delta t)\). With zero_phase = PhaseRef.AboveTransition and phi0 = 0, the reference particle arrives at the zero crossing, and a particle arriving late (\(z < 0\)) loses energy. This is what keeps the longitudinal motion stable above transition, where particles with more energy take longer around the ring. For example, an electron 1 mm ahead of the reference particle in a 1 MV, 500 MHz cavity:

cav = RFCavity(L=0.5, voltage=1e6, rf_frequency=500e6, zero_phase=PhaseRef.AboveTransition)
lat = Beamline([cav], species_ref=Species("electron"), E_ref=18e9)
res = track(lat, v0=[0 0 0 0 1e-3 0])
res.pz[turn=1] # ≈ (1 MeV/18 GeV) sin(2π (1 mm)/(0.6 m))
1-element Vector{Float64}:
 5.821685182739537e-7

Adding RF Cavities

In a real machine, electrons emit synchrotron radiation as they bend around the ring, so the energy needs to be replenished with an RF system. Let’s put RF cavities into the 10 o’clock straight section of our ring. We will design a special FODO cell with RF cavities, fodorf, and replace the 4 FODO cells of the 10 o’clock straight section with it.

In the ESR, there are two RF cavities between each pair of quadrupoles, with equal drift spaces between the elements. For our ring, the cavities are 3.41 m long, as shown in the figure.

../_images/rf.svg

Fig. 19 FODO cell with RF cavities.

Example: Constructing the FODO Cell with RF Cavities

  1. Start with the ring with the tune cell of chapter 7:

include("lattices/07-tune-cell.jl");
  1. Define the RF cavities and the drifts. The drift length is computed from the length of the straight section cell. The harmonic number harmon is the RF frequency in units of the revolution frequency (the RF frequency is then computed from the length of the ring). Start with the voltage of the ESR, 68 MV divided among 18 cavities:

@elements begin
  rf0 = RFCavity(L=3.41, harmon=7560, voltage=68e6/18,
                 zero_phase=PhaseRef.AboveTransition)
  drf = Drift(L=((1.241 + 5.855 + 0.609) - 2*3.41)/3)
end;
  1. Define the fodorf cell:

fodorf = [qfss, drf, rf0, drf, rf0, drf, qdss, drf, rf0, drf, rf0, drf];
  1. Replace the 4 FODO cells of the 10 o’clock section by fodorf cells, in the sextants 9 and 11:

sextant9 = [repeat(fodossf, 4); ss_to_arcf; repeat(fodoaf, 20); arc_to_ssf;
            repeat(fodossf, 2); repeat(fodorf, 2)]
sextant11 = [repeat(fodorf, 2); repeat(fodossr, 2); ss_to_arcr; repeat(fodoar, 20);
             arc_to_ssr; repeat(fodossr, 4)]

ring = Beamline([sextant1; sextant3; sextant5; sextant7; sextant9; sextant11],
                species_ref=electron, pc_ref=pc_ref)
Beamline:
 species_ref = electron
 pc_ref = 1.7846262612447e10

  Index   Name   Kind         L [m]   s [m]                s_downstream [m]   
  1       qfss   Quadrupole   0.5     0.0f0                0.5
  2       d1     Drift        0.609   0.5                  1.109
  3       db     Drift        5.855   1.109                6.964
  4       d2     Drift        1.241   6.964                8.205
  5       qdss   Quadrupole   0.5     8.205                8.705
  6       d1     Drift        0.609   8.705                9.314
  7       db     Drift        5.855   9.314                15.169
  8       d2     Drift        1.241   15.169               16.41
  9       qfss   Quadrupole   0.5     16.41                16.91
  10      d1     Drift        0.609   16.91                17.519
  11      db     Drift        5.855   17.519               23.374
  12      d2     Drift        1.241   23.374               24.615
  13      qdss   Quadrupole   0.5     24.615               25.115
  14      d1     Drift        0.609   25.115               25.723999999999997
  15      db     Drift        5.855   25.723999999999997   31.578999999999997
  16      d2     Drift        1.241   31.578999999999997   32.82
  17      qfss   Quadrupole   0.5     32.82                33.32
  18      d1     Drift        0.609   33.32                33.929
  19      db     Drift        5.855   33.929               39.784000000000006
  ⋮       ⋮      ⋮            ⋮       ⋮                    ⋮

                                                              1704 rows omitted

With RF cavities, the longitudinal motion oscillates too, and twiss computes it as the third normal mode: the synchrotron tune is q3.

twiss(ring, at=[])
Twiss:
summ:
 q1     = 54.0800000000138
 q2     = 54.14000000001404
 q3     = -0.051534752469028014
 etac   = 0.0006367024729195226
 alphac = 0.0006367032927903974

df:
0×30 DataFrame
 Row │ index  name  kind  s    beta1  phi1  dx   x    beta2  phi2  dy   y    slip  phi3  alpha1  a ⋯
     │                    [m]  [m]    [2π]  [m]  [m]  [m]    [2π]  [m]  [m]  [m]   [2π]  [1]     [ ⋯
─────┴──────────────────────────────────────────────────────────────────────────────────────────────
                                                                                  15 columns omitted

The synchrotron tune is negative above transition, because the longitudinal motion turns the other way in the \(z\)-\(p_z\) plane than below transition (see Twiss).

  1. Set the synchrotron tune to 0.05 by varying the voltage of the cavities. All 16 cavities are placements of rf0, so one knob varies them all:

tw_ring = lazy_twiss(ring)
optimize!(vary=[@knob(rf0.voltage)], targets=[tw_ring.q3 == -0.05])
Converged (all targets met) with Gauss-Newton: 4 iterations, 5 evaluations (1 with derivatives), 1.27 s
 Target  value          goal      met
 q3      -0.0500000006  == -0.05  yes
 Knob         before         after          lower  upper
 rf0.voltage  3.777777778e6  3.557943628e6  -Inf   Inf

The momentum compaction \(\alpha_c\), the relative change of the length of the closed orbit with \(\delta\), is defined without synchrotron motion: compute it with the cavities turned off, with rf_on=false.

tw = twiss(ring, rf_on=false, at=[])
tw.alphac
0.0006460289873460027

Exercises

  1. Synchrotron tune: For small oscillations, the synchrotron tune is \(Q_s = \sqrt{h\,\eta_c\, e V_\mathrm{tot} / (2\pi \beta^2 E)}\), where \(h\) is the harmonic number, \(\eta_c\) the slip factor (etac), \(V_\mathrm{tot}\) the total voltage and \(E\) the energy. Compute it with the matched voltage, and compare with q3.

  2. Velocity and z: For a particle slower than light, \(z = -\beta c\,(t - t_\mathrm{ref})\) depends on its velocity. Make a beamline of a short cavity (L = 1e-6) for protons with the reference momentum pc_ref = 1e9, with the voltage 1e9 and zero_phase = PhaseRef.Accelerating (on crest), and track a particle that starts with z = 1e-3. Calculate its velocity before and after the cavity, and verify that the change of \(z\) is consistent with what track calculates.

  3. RF phase: Change phi0 of the cavity of the previous exercise. How does the energy gain change? Does the reference energy change?

The lattice file of this chapter is lattices/09-rf.jl.