-
Notifications
You must be signed in to change notification settings - Fork 0
Multipass
Consider the following lattice:
A: quadrupole
ll: line = (A, A)
use, ll
The lattice has two elements both called A. These two elements, even though they have the same name, are independent.
Tao> change ele 1 k1 0.01 ! Can modify first A element.
Tao> change ele 2 k1 0.02 ! And can modify second A element independently.
With an ERL the beam will go through the linac section multiple times
linac: line = (...)
arc: line = (...)
erl_line: line = (injector, linac, arc, linac, ...)
Here you don't want the elements of the fist linac in erl_line to be treated as separate from the second linac in erl_line since they represent the same set of physical elements. This is where multipass comes in. Multipass is used to describe the situation where a beam recirculates through the same physical set of elements multiple times.
Essentially the solution is to mark the linac line as multipass to tell Bmad that the first instance of linac in erl_line contains the same physical elements as the second instance of linac:
linac: line[multipass] = (...)
beginning[beta_a] = 100. ! m a-mode beta function
beginning[beta_b] = 100. ! m b-mode beta function
beginning[p0c] = 10e6 ! eV
parameter[geometry] = open ! or closed
cavity: lcavity, l = 1, voltage = 10e6
linac: line[multipass] = (cavity)
erl: line = (linac, linac)
use, erl
expand_lattice
cavity\2[phi0_multipass] = 0.5
Using the above as content, create a file 'multipass.bmad' and run tao with
> tao -lat multipass
Tao> show lat
Tao> show lat
Values at End of Element:
Index name key s l beta phi eta orbit beta phi eta orbit Track_State
a a a x [mm] b b b y [mm]
0 BEGINNING Beginning_Ele 0.000 --- 100.00 0.000 0.00 0.000 100.00 0.000 0.00 0.000 Alive
1 CAVITY\1 Lcavity 1.000 1.000 78.87 0.011 -0.00 0.372 78.87 0.011 0.00 0.000 Alive
2 CAVITY\2 Lcavity 2.000 1.000 42.09 0.028 -0.00 0.352 42.09 0.028 0.00 0.000 Alive
3 END Marker 2.000 0.000 42.09 0.028 -0.00 0.352 42.09 0.028 0.00 0.000 Alive
Lord Elements:
4 CAVITY Lcavity 0.000 1.000 0.00 0.000 0.00 --- 0.00 0.000 0.00 --- Not_Set
Index name key s l beta phi eta orbit beta phi eta orbit Track_State
a a a x [mm] b b b y [mm]
Values at End of Element:
Bmad creates a multipass_lord called cavity to control the multipass_slaves called cavity\1 and cavity\2:
Tao> show ele 4
Element # 4
Element Name: CAVITY
... etc...
Slave_status: Free
Lord_status: Multipass_Lord
Slaves:
Index Name Type
1 CAVITY\1 Lcavity
2 CAVITY\2 Lcavity
Since the cavity element represents the physical element, any change in the parameters of cavity will be be reflected in the slaves:
Tao> set ele cavity x_offset = 0.001
Tao> show ele 2
Element # 2
Element Name: CAVITY\2
Key: Lcavity
S_start, S: 1.000000, 2.000000
Ref_time: 6.675633E-09
Attribute values [Only non-zero/non-default values shown]:
1 L = 1.0000000E+00 m
... etc...
36 X_OFFSET = 1.0000000E-03 m 57 X_OFFSET_TOT = 1.0000000E-03 m
... etc...
The exception to the rule that the multipass_lord completely controls the multipass_slave attributes is the phi0_multipass attribute of lcavity and rfcavity elements. phi0_multipass allows for different settings of the RF phase for different passes through the cavity element. From the above lattice:
expand_lattice ! cavity\2 is created during lattice expansion
cavity\2[phi0_multipass] = 0.5 ! This shifts the RF phase for cavity\2 by 180^deg
Giving:
Tao> show lat -attrib e_tot
Values at End of Element:
Index name key s l e
tot
0 BEGINNING Beginning_Ele 0.000 --- 1.0013E+07
1 CAVITY\1 Lcavity 1.000 1.000 2.0013E+07
2 CAVITY\2 Lcavity 2.000 1.000 1.0013E+07
3 END Marker 2.000 0.000 1.0013E+07
Lord Elements:
4 CAVITY Lcavity 0.000 1.000 2.0013E+07
Index name key s l e
tot
Notes:
- Bmad does not demand that the global position of the multipass_slaves of a multipass_lord be in the same position in the global coordinate system.