7. Tune Cell¶
Introduction¶
In order to adjust the tunes of the ring, the phase advance per FODO cell in one of the straight
sections can be adjusted, while ensuring that it is still matched to the periodic solution in each
of the surrounding arcs. We’ll put this “tune cell” in the 2 o’clock straight section, between the
sextants 1 and 3, and name its quadrupoles by appending _2 to the names of the quadrupoles they
replace.
Fig. 16 The tune cell in the 2 o’clock straight section.¶
Required for the match is:
Setting the phase advances in the
fodossf_2/fodossr_2cells of the straight section for the desired tunes \(Q_1 = 54.08\) and \(Q_2 = 54.14\) (2 constraints).Matching from the dispersion suppressor to the new periodic Twiss parameters of the
fodossf_2/fodossr_2cells (4 constraints).Matching the
fodossf_2/fodossr_2cells to the dispersion creator (4 more constraints, but these are already met by the mirror symmetry).
These 6 constraints can be met using the four quadrupoles of the forward matching section
(qff2_2, qdf2_2, qff3_2, and qdf3_2) and the two quadrupoles of the straight section cells
(qfss_2 and qdss_2).
Example: Matching the Tune Cell¶
Start with the ring with the IR of chapter 6:
include("lattices/06-interaction-region.jl");
twiss(ring, at=[]) # The tunes before
Twiss:
summ:
q1 = 54.02970665118919
q2 = 54.12406265003318
etac = 0.0006460281674751177
alphac = 0.0006460289873459912
df:
0×26 DataFrame
Row │ index name kind s beta1 phi1 dx x beta2 phi2 dy y slip alpha1 alpha2 ⋯
│ [m] [m] [2π] [m] [m] [m] [2π] [m] [m] [m] [1] [1] ⋯
─────┴──────────────────────────────────────────────────────────────────────────────────────────────
11 columns omitted
Define the new quadrupoles, starting with the strengths of those they replace:
@elements begin
qfss_2 = Quadrupole(L=0.5, Kn1=qfss.Kn1)
qdss_2 = Quadrupole(L=0.5, Kn1=qdss.Kn1)
qff2_2 = Quadrupole(L=0.5, Kn1=qff2.Kn1)
qdf2_2 = Quadrupole(L=0.5, Kn1=qdf2.Kn1)
qff3_2 = Quadrupole(L=0.5, Kn1=qff3.Kn1)
qdf3_2 = Quadrupole(L=0.5, Kn1=qdf3.Kn1)
end;
Define the lines of the tune cell, and put them into the sextants 1 and 3. The dispersion suppressor and the dispersion creator keep their quadrupoles:
fodossf_2 = [qfss_2, d1, db, d2, qdss_2, d1, db, d2]
fodossr_2 = [qfss_2, d2, db, d1, qdss_2, d2, db, d1]
mssf_2 = [qff2_2, d1, db, d2, qdf2_2, d1, db, d2, qff3_2, d1, db, d2, qdf3_2, d1, db, d2]
mdcr_2 = [qfss_2, d2, db, d1, qdf3_2, d2, db, d1, qff3_2, d2, db, d1, qdf2_2, d2, db, d1]
dispcrer_2 = [qff2_2, d2, bh, d1, qdf1, d2, bh, d1, qff1, d2, bh, d1, qd, d2, bh, d1]
arc_to_ssf_2 = [dispsupf; mssf_2]
ss_to_arcr_2 = [mdcr_2; dispcrer_2]
sextant1 = [repeat(fodossf, 4); ss_to_arcf; repeat(fodoaf, 20); arc_to_ssf_2;
repeat(fodossf_2, 4)]
sextant3 = [repeat(fodossr_2, 4); ss_to_arcr_2; 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
⋮ ⋮ ⋮ ⋮ ⋮ ⋮
1688 rows omitted
The targets need three lazy twisses: of the new straight section cell (its periodic Twiss parameters), of the line from the arc into the new straight section (the first half of the tune cell), and of the ring (its tunes):
cell_ss2 = Beamline(fodossf_2, species_ref=electron, pc_ref=pc_ref)
line_2 = Beamline(arc_to_ssf_2, species_ref=electron, pc_ref=pc_ref)
tw_ss2 = lazy_twiss(cell_ss2)
tw_2 = lazy_twiss(line_2, a_initial=tw_af.a[end])
tw_ring = lazy_twiss(ring)
TwissExpr of a Beamline with 1707 elements
All three depend on the knobs, and optimize! computes each of them once
per evaluation.
Run the match:
optimize!(vary=[@knob(qfss_2.Kn1), @knob(qdss_2.Kn1), @knob(qff2_2.Kn1), @knob(qdf2_2.Kn1),
@knob(qff3_2.Kn1), @knob(qdf3_2.Kn1)],
targets=[tw_2.beta1[end] == tw_ss2.beta1[begin],
tw_2.alpha1[end] == tw_ss2.alpha1[begin],
tw_2.beta2[end] == tw_ss2.beta2[begin],
tw_2.alpha2[end] == tw_ss2.alpha2[begin],
tw_ring.q1 == 54.08, tw_ring.q2 == 54.14])
Converged (all targets met) with Gauss-Newton: 6 iterations, 7 evaluations (1 with derivatives), 0.5 s
Target value goal met
beta1[end] - beta1[qfss_2#1] -2.74663492e-9 == 0.0 yes
alpha1[end] - alpha1[qfss_2#1] 1.489643964e-10 == 0.0 yes
beta2[end] - beta2[qfss_2#1] -7.304024052e-11 == 0.0 yes
alpha2[end] - alpha2[qfss_2#1] 7.503386801e-12 == 0.0 yes
q1 54.08 == 54.08 yes
q2 54.14 == 54.14 yes
Knob before after lower upper
qfss_2.Kn1 0.3519574627 0.3569267873 -Inf Inf
qdss_2.Kn1 -0.3519574627 -0.3543727094 -Inf Inf
qff2_2.Kn1 0.3568781072 0.3568798055 -Inf Inf
qdf2_2.Kn1 -0.352748347 -0.3530781928 -Inf Inf
qff3_2.Kn1 0.3788662922 0.3812928735 -Inf Inf
qdf3_2.Kn1 -0.3612539468 -0.3627590786 -Inf Inf
The tunes of the ring are now 54.08 and 54.14, and the beta functions are only changed in the tune cell:
tw = twiss(ring)
using CairoMakie
fig = Figure(size=(800, 300))
ax = Axis(fig[1, 1], xlabel="s [m]", ylabel="β [m]")
rows = (0.0, 1300.0) # The sextants 1 and 3
lines!(ax, tw.s[rows], tw.beta1[rows], label="β₁")
lines!(ax, tw.s[rows], tw.beta2[rows], label="β₂")
axislegend(ax, position=:rt)
fig
Exercises¶
Periodicity inside the tune cell: In the Bmad version of this tutorial, the periodicity of the Twiss parameters inside the tune cell was a target of its own: the Twiss parameters at the fourth
qfss_2of the ring must be equal to those at the fifth. Write these targets withtw_ringonly. Hint:ring[[qfss_2]]is the vector of all placements ofqfss_2in the ring, and each of them is a location by itself.Other tunes: Change the tunes to 54.12 and 54.18. How much do the quadrupole strengths of the tune cell change? Which tunes can the tune cell reach?
The lattice file of this chapter is
lattices/07-tune-cell.jl.