Download Library User Guide
Transcript
3.3 subroutines
27
call make_states(.false.)
exact_model = .true.
default = default + nocavity + exactmis
505 call update_states
madlength = .false.
ang = (twopi * 36.d0 / 360.d0)
Larc = 2.54948d0
510 brho = 1.2d0 * (Larc / ang)
call set_mad(brho = brho, method = 2, step = 10)
madkind2 = drift_kick_drift
515
kf = 2.72d0 / brho
kd = -1.92d0 / brho
d1 =
d2 =
qf =
520 qd =
b =
cell
525
drift("D1", 2.28646d0)
drift("D2", 0.45d0)
quadrupole("QF", 0.5d0, kf)
quadrupole("QD", 0.5d0, kd)
rbend("B", Larc, ang)
= d1 + qd + d2 + b + d2 + qf + d1
PSR = 10 * cell
PSR = .ring.PSR
call survey(PSR)
end subroutine build_PSR
The lines 502–506 set important internal state variables for tracking. In the call
to make_states, the boolean argument .false. means we are modeling a proton
lattice. Use .true. for electrons.4 To use the full “square-root” Hamiltonian, we set
the global parameter exact_model to .true. The global variable default, of type
internal_state, is here modified from its default value by adding the following two
flags:
• nocavity, which tells PTC to ignore RF cavities;
• exactmis, which tells PTC to treat misalignments exactly.
(For more on internal-state variables, see appendix A.) Finally, we set the flag
madlength to .false. This means that PTC will use the arc length, rather than the
chord length, to define the geometry of a rectangular bending magnet. Use .true.
to make PTC use the chord length.
The call, in line 511, to set_mad defines (via brho) the scale momentum po for the
fibres in the layout returned by this subroutine. It also specifies the type (method
= 2) and number (STEP = 10) of integration steps in the body of each element. We
then define the five fibres needed for our basic cell:
• Fibres d1 and d2 denote the long and short drifts.
• Fibres qf and qd denote the focusing and defocusing quadrupoles.
• And fibre b denotes the rectangular bending magnet. Note that it is defined by
its arc length and bend angle—here Larc and ang, respectively. See figure 3.4.
The symbols in quotes (e.g., "QF") are the names given to these elements.5 We may
now define the variable cell, of type layout, as the appropriate sequence of fibres.
4
For other particles, use
the ratio of particle mass
to electron mass as the
argument of make_states.
Larc = 2.54948
ang
Figure 3.4: Geometry of the
rectangular bend.
5
Because a layout may have
any number of these elements, the names actually
define classes of elements.