6. Low-Beta Interaction Region Insertion¶
Introduction¶
In this chapter an interaction region (IR) with a low-beta interaction point (IP) will be constructed, by modifying the quadrupoles of the 6 o’clock straight section as shown in the figures A and B below.
Fig. 14 A) Layout before modification. B) Layout with the IR constructed. C) Beta functions in the IR.¶
Fig. 15 Interaction region dimensions. IPF: forward section before the IP. IPR: reverse section after the IP.¶
The IR is divided into two parts, which are constructed separately as shown above. IPF is the upstream “forward” section before the IP (labeled IP6), and IPR is the downstream “reverse” section after IP6. At the IP, the beta functions are to be matched to \(\beta_1^* = 0.6\) m and \(\beta_2^* = 0.06\) m and, as is standard for many IPs, the alpha functions \(\alpha_1^*\) and \(\alpha_2^*\) to zero (a “waist”). The surrounding quadrupoles are adjusted to match these IP parameters, while still matching to the periodic solution of the straight section at the ends of the IR furthest from the IP.
Because this region is particularly sensitive, the match is done in two steps:
Match the forward line IPF from the straight section to the IP.
Match the reverse line IPR from the IP, with the lattice functions that IPF actually gives there, to the periodic lattice functions of the straight section.
(In the Bmad version of this tutorial, IPR was matched backwards from the straight section to the IP, and then once more forward to correct the small mismatch at the IP. Because IPR starts with the lattice functions of IPF here, the second match is already exact.)
For IR simulations, SciBmad has crab cavities (CrabCavity) to simulate crabbing with a nonzero
crossing angle. A discussion of this is beyond the scope of this tutorial.
Example: Constructing and Matching the IR¶
Start with the ring of chapter 5:
include("lattices/05-ring.jl");
Define the drifts and quadrupoles of the IR, with the dimensions of the figure above. The strengths are to be determined: start with the straight section strengths. Define also the IP itself, as a
Marker. Markers have zero length and no effect on the orbit or spin.
@elements begin
qef1 = Quadrupole(L=0.5, Kn1=k_ss)
qef2 = Quadrupole(L=0.5, Kn1=-k_ss)
def1 = Drift(L=20.46)
qef3 = Quadrupole(L=1.6, Kn1=k_ss)
def2 = Drift(L=3.76)
qef4 = Quadrupole(L=1.2, Kn1=-k_ss)
def3 = Drift(L=5.8)
ip6 = Marker()
der3 = Drift(L=5.3)
qer4 = Quadrupole(L=1.8, Kn1=-k_ss)
der2 = Drift(L=0.5)
qer3 = Quadrupole(L=1.4, Kn1=k_ss)
der1 = Drift(L=23.82)
qer2 = Quadrupole(L=0.5, Kn1=k_ss)
qer1 = Quadrupole(L=0.5, Kn1=-k_ss)
end;
Define the upstream and downstream lines. The IP is at the end of
ipf. (It is not repeated at the beginning ofipr, so that it is placed once in the ring.)
ipf = [qef1, d1, db, d2, qef2, d1, db, d2, def1, qef3, def2, qef4, def3, ip6]
ipr = [der3, qer4, der2, qer3, der1, qer2, d2, db, d1, qer1, d2, db, d1]
ir_f = Beamline(ipf, species_ref=electron, pc_ref=pc_ref)
ir_r = Beamline(ipr, 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 der3 Drift 5.3 0.0f0 5.3
2 qer4 Quadrupole 1.8 5.3 7.1
3 der2 Drift 0.5 7.1 7.6
4 qer3 Quadrupole 1.4 7.6 9.0
5 der1 Drift 23.82 9.0 32.82
6 qer2 Quadrupole 0.5 32.82 33.32
7 d2 Drift 1.241 33.32 34.561
8 db Drift 5.855 34.561 40.416
9 d1 Drift 0.609 40.416 41.025
10 qer1 Quadrupole 0.5 41.025 41.525
11 d2 Drift 1.241 41.525 42.766
12 db Drift 5.855 42.766 48.620999999999995
13 d1 Drift 0.609 48.620999999999995 49.23
IPF follows a straight section cell, so it starts with the periodic lattice functions of the forward straight section cell. IPR starts with the lattice functions at the end of IPF:
tw_ipf = lazy_twiss(ir_f, a_initial=tw_ssf.a[end])
tw_ipr = lazy_twiss(ir_r, a_initial=tw_ipf.a[end])
TwissExpr of a Beamline with 13 elements (a_initial=a[end])
With the straight section strengths, the beta functions at the IP are far from the goal:
value([tw_ipf.beta1[end], tw_ipf.beta2[end]])
2-element Vector{Float64}:
16128.970986155447
531.4475568154746
Match IPF. The beta functions here range from 0.06 m at the IP to several hundred meters in the final focus quadrupoles. A difference of 1 m from the goal means little at 600 m, but a lot at 0.06 m. It is therefore better to match the logarithm of β: then a relative error counts the same everywhere. Targets can be any expression of the quantities of
twiss:
optimize!(vary=[@knob(qef1.Kn1), @knob(qef2.Kn1), @knob(qef3.Kn1), @knob(qef4.Kn1)],
targets=[log(tw_ipf.beta1[end]) == log(0.6), log(tw_ipf.beta2[end]) == log(0.06),
tw_ipf.alpha1[end] == 0, tw_ipf.alpha2[end] == 0])
Converged (all targets met) with Gauss-Newton: 15 iterations, 39 evaluations (11 with derivatives), 0.112 s
Target value goal met
log(beta1[end]) -0.5108256235 == -0.5108256237659907 yes
log(beta2[end]) -2.813410717 == -2.8134107167600364 yes
alpha1[end] -4.039708236e-9 == 0.0 yes
alpha2[end] -5.520642121e-11 == 0.0 yes
Knob before after lower upper
qef1.Kn1 0.3519574627 0.2423377679 -Inf Inf
qef2.Kn1 -0.3519574627 -0.4037910818 -Inf Inf
qef3.Kn1 0.3519574627 0.1074866814 -Inf Inf
qef4.Kn1 -0.3519574627 -0.229137628 -Inf Inf
Match IPR to the periodic lattice functions of the reverse straight section cell, which follows it:
optimize!(vary=[@knob(qer1.Kn1), @knob(qer2.Kn1), @knob(qer3.Kn1), @knob(qer4.Kn1)],
targets=[log(tw_ipr.beta1[end]) == log(tw_ssr.beta1[begin]),
log(tw_ipr.beta2[end]) == log(tw_ssr.beta2[begin]),
tw_ipr.alpha1[end] == tw_ssr.alpha1[begin],
tw_ipr.alpha2[end] == tw_ssr.alpha2[begin]])
Converged (all targets met) with Gauss-Newton: 20 iterations, 59 evaluations (12 with derivatives), 0.507 s
Target value goal met
log(beta1[end]) - log(beta1[qfss#1]) -8.962045772e-9 == 0.0 yes
log(beta2[end]) - log(beta2[qfss#1]) -1.526972326e-9 == 0.0 yes
alpha1[end] - alpha1[qfss#1] -8.770487447e-9 == 0.0 yes
alpha2[end] - alpha2[qfss#1] -2.189519344e-9 == 0.0 yes
Knob before after lower upper
qer1.Kn1 -0.3519574627 -0.3809384449 -Inf Inf
qer2.Kn1 0.3519574627 -0.009919585246 -Inf Inf
qer3.Kn1 0.3519574627 0.2352160113 -Inf Inf
qer4.Kn1 -0.3519574627 -0.2371060269 -Inf Inf
Add the IR into the ring. It replaces the last three straight section cells of sextant 5 and the first three of sextant 7 (each half of the IR is as long as three cells):
sextant5 = [repeat(fodossf, 4); ss_to_arcf; repeat(fodoaf, 20); arc_to_ssf; fodossf; ipf]
sextant7 = [ipr; fodossr; 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)
tw = twiss(ring)
tw.beta1[ip6], tw.beta2[ip6], tw.alpha1[ip6], tw.alpha2[ip6]
(0.6000000485124318, 0.05999999867771454, -3.221985396294639e-8, -6.374183454244967e-10)
The periodic lattice functions of the whole ring have the IP values: the IR is matched into the rest of the ring. The beta functions around the IP:
using CairoMakie
s0 = tw.s[ip6]
fig = Figure(size=(800, 350))
ax = Axis(fig[1, 1], xlabel="s - s(IP6) [m]", ylabel="β [m]")
rows = (s0 - 120, s0 + 120) # An s-range around the IP
lines!(ax, tw.s[rows] .- s0, tw.beta1[rows], label="β₁")
lines!(ax, tw.s[rows] .- s0, tw.beta2[rows], label="β₂")
axislegend(ax, position=:ct)
fig
Exercises¶
Initial lattice functions for a reflected line: A line can be matched backwards, from its end to its start, by computing the optics of the reflected line
reverse(ipr). (This is only correct for elements that are symmetric front to back, such as drifts and quadrupoles.) How must the initial Twiss parameters \(\beta\) and \(\alpha\) be changed for the reflected line? Hint: the Twiss parameters are the same as computed in earlier chapters.Matching backwards: Match IPR backwards: start the reflected line with the periodic lattice functions of the reverse straight section cell (given with
initial, as numbers of atwisstable), and matchqer1toqer4so that \(\beta_1 = 0.6\) m, \(\beta_2 = 0.06\) m and \(\alpha_1 = \alpha_2 = 0\) at its end, the IP. Start with the strengths found above, each multiplied by 1.01. Do you get the same strengths back? What happens if the initial alpha functions are not changed for the reflected line? (Starting with the straight section strengths, this match stops at a point that is not a solution.)Logarithms: Start again with the straight section strengths, and match IPR with targets for β instead of log β. What happens? Several matches in this tutorial stop at a point that is not a solution, because small changes of the knobs cannot improve the merit function there. How the targets are written decides which points these are.
No step size: In Bmad, the derivatives for the optimizer are computed with finite differences, with a step size for each variable, and a step size of \(10^{-4}\) instead of \(10^{-6}\) for the quadrupole strengths keeps this match from converging. Why does the step size matter? Why does SciBmad not need one?
The lattice file of this chapter is
lattices/06-interaction-region.jl.