11. Beam lines

A cavity is installed between beam pipes, bellows, tapers and absorbers, and its neighbours change its modes. cavsim2d joins devices with + into one structure, an Assembly, which meshes, solves and tunes like a single cavity.

In this tutorial you will:

  1. Join a beam pipe, a bellows, a cavity, another bellows and an absorber into one line.

  2. See how the line names its parameters.

  3. Solve the line and compare it with the bare cavity.

  4. Tune the cavity while it sits in the line.

Before you start: work through Tune a cell to a target frequency. Running the whole notebook takes about two minutes.

1. Build a line

Each device is a class with its own dimensions, in millimetres: Beampipe (a straight pipe of radius R and length L), Bellows (a corrugated pipe), BLA (a pipe with a lossy absorber ring in its wall), and any cavity. Add them together in the order the beam meets them. The cavity here is an 800 MHz elliptical cell, built without beam pipes, because the line supplies them.

The beam lines guide explains each device’s dimensions, with figures.

from cavsim2d import BLA, Beampipe, Bellows, EllipticalCavity

mid_cell = [62.22, 66.13, 30.22, 23.11, 80.0, 93.5, 171.20]   # A, B, a, b, Ri, L, Req  [mm]
bore = 80.0                                                    # the cell's iris radius

def bellows():
    return Bellows(Ri=bore, A=15.0, L_p=10.0, N_conv=6, R_root=2.0, R_crest=2.0)

line = (Beampipe(R=bore, L=187.0, name='pipe_in')
        + bellows()
        + EllipticalCavity(1, mid_cell, beampipe='none', name='cav')
        + bellows()
        + BLA(R=bore, L=150.0, absorber_length=80.0, absorber_thickness=8.0,
              eps_r=10.0, tan_delta=0.3, maxh=4.0))
line.set_name('line')

print(line.labels)
print(f'{line.length:.1f} mm long')
['pipe_in', 'bellows_1', 'cav', 'bellows_2', 'bla']
644.0 mm long
line.plot('geometry', mirror=True);
../_images/4a76da79092cdc3de25171bed9a79390ebc0bced9b6df17e446a06a5e380022e.png

The plot shows the full cross-section (mirror=True): the input pipe, the first bellows, the cell, the second bellows, and the absorber pipe with its ring shaded in the wall. line.labels lists the devices in order; the two bellows became bellows_1 and bellows_2 because they share a name.

2. How the line names its parameters

A line gathers its devices’ dimensions into one dictionary. Each name is '<device label>:<dimension>', and that name is how you refer to a dimension when you tune, optimise or vary the line.

for key in ['pipe_in:L', 'bellows_1:A', 'cav:Req_m', 'bla:absorber_thickness']:
    print(f'{key:24s} {line.parameters[key]}')
pipe_in:L                187.0
bellows_1:A              15.0
cav:Req_m                171.2
bla:absorber_thickness   8.0

The bellows’ A is its corrugation depth, a different quantity from the cell’s A; the prefix keeps them apart. The cavity’s dimensions keep their cell-type suffix, so cav:Req_m is its equator radius.

3. The cavity in the line

Solve the line, and, for comparison, the same cell on its own with plain beam pipes. The absorber has a large loss tangent, so the line is solved with lossy materials; Q then includes the power the absorber takes.

settings = {'n_modes': 3, 'mesh_config': {'h': 8, 'p': 2}}

line.eigenmode.run(settings)
bare = EllipticalCavity(1, mid_cell, beampipe='both', name='bare_cell')
bare.eigenmode.run(settings)

for name, cav in [('bare cell', bare), ('in the line', line)]:
    q = cav.eigenmode.qois
    print(f"{name:12s} f = {q['freq [MHz]']:9.3f} MHz   R/Q = {q['R/Q [Ohm]']:6.2f} Ohm"
          f"   Q = {q['Q []']:9.0f}")

q = line.eigenmode.qois
print(f"in the line, the walls alone would give Q = {q['Q_wall []']:.0f}, "
      f"the absorber alone Q = {q['Q_diel []']:.3g}")
bare cell    f =   801.207 MHz   R/Q =  79.55 Ohm   Q =     36489
in the line  f =   800.917 MHz   R/Q =  77.85 Ohm   Q =     35520
in the line, the walls alone would give Q = 35967, the absorber alone Q = 2.86e+06

In the line the cell’s frequency drops by 0.290 MHz and its R/Q by 1.70 Ohm: the neighbouring devices change the field slightly. Q falls from 36489 to 35520, but the absorber takes little of that. On its own it would allow a Q of 2.86 million, so it absorbs only about 1 % as much power as the walls. The 800 MHz mode cannot travel along an 80 mm pipe, so its field barely reaches the absorber, which is there for the higher-order modes that can. The walls’ own Q, 35967, is also lower than the bare cell’s, presumably because the corrugated bellows add wall area near the cell.

4. Tune the cavity in the line

Tuning takes the line’s own name for the dimension, 'cav:Req'. The tuner changes only that dimension and solves the whole line at each step, so the result accounts for the neighbours. This line has a pipe at each end and one bellows. Each step re-solves the whole line, so a tolerance of 0.01 MHz (tol=1e-2) saves time and is still far finer than a 2D model’s accuracy.

short_line = (Beampipe(R=bore, L=187.0, name='pipe_in')
              + bellows()
              + EllipticalCavity(1, mid_cell, beampipe='none', name='cav')
              + Beampipe(R=bore, L=187.0, name='pipe_out'))
short_line.set_name('short_line')

short_line.tune.run({'freqs': 800, 'cell_type': {'mid-cell': 'cav:Req'}, 'tol': 1e-2,
                     'eigenmode_config': settings})

result = short_line.tune.qois['mid-cell']
print(f"cav:Req {short_line.parameters['cav:Req_m']:.3f} -> "
      f"{short_line.tuned.parameters['cav:Req_m']:.3f} mm, at {result['FREQ']:.3f} MHz")
cav:Req 171.200 -> 171.398 mm, at 800.002 MHz

The tuner moved cav:Req from 171.200 to 171.398 mm, which brings the line to 800.002 MHz, within the 0.01 MHz tolerance. Every step solved the whole line, so the tuned radius is right for the cell as installed.

What you learned

  • Devices joined with + form an Assembly, which you analyse like any cavity.

  • A line names its dimensions '<device>:<dimension>', and those names drive tuning, optimisation and uncertainty quantification.

  • Neighbouring devices shift a cavity’s mode, and an absorber lowers its Q.

  • To repeat one cavity into a module instead, pass chain=N to the cavity; see the beam lines how-to guides.

Next

Your own cavity shape: describe a new geometry once and use it in every analysis.