3. Matching the Dispersion Suppressor to the Straight Section¶
Introduction¶
The periodic beta functions in the arcs are different from the periodic beta functions in the straight sections. After suppressing the dispersion to zero, four quadrupoles after the dispersion suppressor are needed to match \(\alpha_1\), \(\alpha_2\), \(\beta_1\), and \(\beta_2\) to the periodic ones of the following straight section.
Fig. 6 Dispersion suppressor and matching section.¶
Example: Forward Matching Section¶
The procedure for creating the forward matching section is shown below. Matching the reverse matching section is left as an exercise.
Start with the lattice of chapter 2, which contains the dispersion suppressors, and the straight section cells of chapter 1 (exercises 2 and 3):
include("lattices/02-dispersion-suppressor.jl");
Define four quadrupoles for matching to the straight section. Because this is the forward matching section (F), and these are the 2nd and 3rd special focusing and defocusing quadrupoles, they are named
qff2,qdf2,qff3, andqdf3. They start with the strength of the straight section quadrupoles:
k_ss = qfss.Kn1 # The straight section strength, to start with
@elements begin
qff2 = Quadrupole(L=0.5, Kn1=k_ss)
qdf2 = Quadrupole(L=0.5, Kn1=-k_ss)
qff3 = Quadrupole(L=0.5, Kn1=k_ss)
qdf3 = Quadrupole(L=0.5, Kn1=-k_ss)
end;
Define the matching section
mssfof the figure, with the straight section driftsdb, and the linearc_to_ssffrom the end of the arc to the straight section, which contains the dispersion suppressor and the matching section. In Julia,[a; b]joins the vectorsaandb:
mssf = [qff2, d1, db, d2, qdf2, d1, db, d2, qff3, d1, db, d2, qdf3, d1, db, d2]
arc_to_ssf = [dispsupf; mssf]
line_f = Beamline(arc_to_ssf, species_ref=electron, pc_ref=pc_ref)
tw_f = lazy_twiss(line_f, a_initial=tw_af.a[end])
TwissExpr of a Beamline with 32 elements (a_initial=a[end])
The last four quadrupoles need to be matched so that at the end of
arc_to_ssfthe Twiss parameters are equal to the periodic ones of the straight section FODO cells. These are computed by the lazy twisstw_ssfof the straight section cell (chapter 1, exercise 2): its Twiss parameters at the beginning of the cell aretw_ssf.beta1[begin]and so on. The targets therefore compare two quantities, one of each lazy twiss:
targets = [tw_f.beta1[end] == tw_ssf.beta1[begin], tw_f.alpha1[end] == tw_ssf.alpha1[begin],
tw_f.beta2[end] == tw_ssf.beta2[begin], tw_f.alpha2[end] == tw_ssf.alpha2[begin]]
4-element Vector{Target}:
Target: beta1[end] - beta1[qfss#1] == 0.0
Target: alpha1[end] - alpha1[qfss#1] == 0.0
Target: beta2[end] - beta2[qfss#1] == 0.0
Target: alpha2[end] - alpha2[qfss#1] == 0.0
No number has to be copied from one lattice to another: if the straight section cells change, these targets follow.
Run the match. A matching problem like this one can have several solutions: the knobs that make the targets hold are not unique. Which solution is found depends on the starting point and on the method of the optimizer. From the strengths of the straight section,
optimize!finds the solution of the Bmad version of this tutorial:
optimize!(vary=[@knob(qff2.Kn1), @knob(qdf2.Kn1), @knob(qff3.Kn1), @knob(qdf3.Kn1)],
targets=targets)
Converged (all targets met) with Gauss-Newton: 11 iterations, 14 evaluations (3 with derivatives), 6.75 s
Target value goal met
beta1[end] - beta1[qfss#1] 4.16147472e-9 == 0.0 yes
alpha1[end] - alpha1[qfss#1] -2.195252868e-10 == 0.0 yes
beta2[end] - beta2[qfss#1] -1.942658479e-9 == 0.0 yes
alpha2[end] - alpha2[qfss#1] 2.060706161e-9 == 0.0 yes
Knob before after lower upper
qff2.Kn1 0.3519574627 0.3568781072 -Inf Inf
qdf2.Kn1 -0.3519574627 -0.352748347 -Inf Inf
qff3.Kn1 0.3519574627 0.3788662922 -Inf Inf
qdf3.Kn1 -0.3519574627 -0.3612539468 -Inf Inf
The Levenberg-Marquardt method finds another solution (exercise 3).
The betas through the line, from the arc into the straight section:
using CairoMakie
s = value(tw_f.s[:])
fig = Figure(size=(700, 350))
ax = Axis(fig[1, 1], xlabel="s [m]", ylabel="β [m]")
lines!(ax, s, value(tw_f.beta1[:]), label="β₁")
lines!(ax, s, value(tw_f.beta2[:]), label="β₂")
axislegend(ax, position=:lt)
ax2 = Axis(fig[2, 1], xlabel="s [m]", ylabel="η [m]")
lines!(ax2, s, value(tw_f.dx[:]))
fig
and at the end, together with the periodic values of the straight section:
value([tw_f.beta1[end], tw_ssf.beta1[begin], tw_f.alpha2[end], tw_ssf.alpha2[begin]])
4-element Vector{Float64}:
27.205988504317155
27.20598850015568
0.48460554557640995
0.4846055435157038
Exercises¶
Reverse matching section: Construct the reverse matching section
mssrwith the quadrupolesqfr2,qdr2,qfr3,qdr3, following the same steps as in the example but for the reverse cells (it follows the reverse dispersion suppressor, and matches into the reverse straight section cell). How do your quadrupole strengths compare to those of the forward matching section?Weights: Optimization success or failure can depend heavily on the relative weights of the targets. As an example of this, start again with the unoptimized quadrupoles, and this time give the first target the weight
1e5, by writing it asTarget(tw_f.beta1[end] - tw_ssf.beta1[begin], 0; weight=1e5). With this, how well does the optimization do?Several solutions: Start again with the unoptimized quadrupoles, and run the match with the Levenberg-Marquardt method (
solver=LM()). Check that the solution is different, and that it meets the targets. Compare the maximum beta functions in the matching section for both solutions, for example withvalue(maximum(tw_f.beta1["qff2:qdf3"])). Which would you choose?
The solution of exercise 1 is in the lattice file of this chapter,
lattices/03-match-to-straight.jl.