Definition Tools¶
Phase Trombone¶
A phase trombone is an element that changes the phase advances without changing the Twiss parameters
anywhere. This can be useful for dynamic aperture optimizations where the phase advance between arcs
can have a significant impact on the nonlinear correction scheme.
phase_trombone! turns any element in a Beamline into a phase
trombone. For example, using a Marker at the end of a FODO cell:
@elements begin
qf = Quadrupole(Kn1=0.36, L=0.5)
sf = Sextupole(Kn2=1.2, L=0.2)
d = Drift(L=0.1)
b = SBend(L=1.2, angle=pi/132)
qd = Quadrupole(Kn1=-0.36, L=0.5)
sd = Sextupole(Kn2=-1.2, L=0.2)
tr = Marker()
end
fodo = Beamline([qf, sf, b, d, qd, sd, b, d, tr],
species_ref=Species("electron"), pc_ref=18e9)
tw = twiss(fodo)
println("Before: q1 = ", tw.q1, ", q2 = ", tw.q2)
# Add 0.1 to the horizontal-like tune and subtract 0.05 from the vertical-like one:
phase_trombone!(fodo[tr]; phi1=0.1, phi2=-0.05)
tw = twiss(fodo)
println("After: q1 = ", tw.q1, ", q2 = ", tw.q2)
Before: q1 = 0.053449304660113016, q2 = 0.052539994232309394
After: q1 = 0.15344930466011306, q2 = 0.0025399942323093517
phi1, phi2, and phi3 are stored as the first three entries of the element’s
transport_map_params, so they can be changed at any time without calling
phase_trombone! again. transport_map_params is a tuple, which cannot be
changed in place, so it’s best to let them be deferred expressions stored in the beamline context:
# Remove the current phase trombone map by setting MapParams = nothing:
fodo[tr].MapParams = nothing
tw = twiss(fodo)
println("Before: q1 = ", tw.q1, ", q2 = ", tw.q2)
# Add variables to the context:
fodo.context.tr_phi1 = 0.1
fodo.context.tr_phi2 = -0.05
# Set the phase trombone angles to be deferred expressions
phase_trombone!(fodo[tr]; phi1=DefExpr(c -> c.tr_phi1), phi2=DefExpr(c -> c.tr_phi2))
tw = twiss(fodo)
println("After: q1 = ", tw.q1, ", q2 = ", tw.q2)
# Change the context variables to adjust the phases
fodo.context.tr_phi1 = 0.2
tw = twiss(fodo)
println("After again: q1 = ", tw.q1, ", q2 = ", tw.q2)
Before: q1 = 0.053449304660113016, q2 = 0.052539994232309394
After: q1 = 0.15344930466011306, q2 = 0.0025399942323093517
After again: q1 = 0.253449304660113, q2 = 0.0025399942323093517
The phase trombone is built from the closed orbit and the linear optics at the element at the time
phase_trombone! is called. As such, if you plan to change the closed orbit
and/or linear optics afterwards, first remove the phase trombone before doing anything, and then
call phase_trombone! again when the orbit and linear optics are not
changing anymore.
phase_trombone! — Function.
phase_trombone!(ele::LatElement; phi1=0.0, phi2=0.0, phi3=0.0, rf_on=true)
Makes ele into a phase trombone - a matrix expanded around the current closed orbit
(at the time of calling this function) which applies a linear rotation in normal form
coordinates (which are also computed at the time of calling this function). Useful for
creating zero-length elements where the phase advance can be tuned without impacting the
linear optics. The LatElement must be in a Beamline in order to
use this function.
phi1, phi2, and phi3 are the changes of the phase advances of the three normal modes, in
units of 2π (i.e. the changes of the tunes). The LatElement property transport_map is filled
with the corresponding phase trombone transport map, and transport_map_params with its parameters.
The first three entries of transport_map_params are phi1, phi2, and phi3, and can be
changed later to change the phase advances.
With rf_on=false, the normal form is that of the beamline with its RF cavities turned off (as
in twiss), and the map does not change δ. Use it if the beamline is analyzed without
synchrotron motion, e.g. for its chromatic functions with twiss(…; rf_on=false): with RF
cavities on, the normal modes mix the transverse and longitudinal coordinates, and the map
then changes δ, so that the beamline does not have a coasting beam with its cavities off.
Spin tracking is NOT currently compatible with phase trombones.
Note
If the closed orbit and/or linear optics at ele are changed after calling
this function, then the phase trombone map is no longer valid.