RF guns¶
An RFGun is a photoinjector or VHF gun: a cathode at one end, a nose cone, and an
exit pipe, its wall a chain of arcs and straight segments. This guide builds one and
runs each analysis on it. Unlike every other cavity in cavsim2d, a gun’s lengths and
radii are in metres and its angles in radians, and the same goes for its tune values,
optimisation bounds and UQ spreads. Wakefield runs need ABCI (see
Installation).
Build the gun¶
The geometry is a dictionary of named segments, listed in the
geometry guide. beampipe='left' adds a pipe at the cathode end;
the exit pipe is part of the gun.
import numpy as np
from cavsim2d import RFGun
geometry = {'y1': 1.5e-2, 'R2': 3e-2, 'T2': np.deg2rad(45), 'L3': 24e-2,
'R4': 5e-2, 'L5': 11e-2, 'R6': 6e-2, 'L7': 19e-2, 'R8': 4e-2,
'T9': np.deg2rad(8), 'R10': 3e-2, 'T10': np.deg2rad(40),
'L11': 5e-2, 'R12': 3e-2, 'L13': 3e-2, 'R14': 3e-2, 'x': 1e-2}
gun = RFGun({'geometry': geometry}, name='gun')
gun.plot('geometry');
Eigenmodes¶
A gun has one cell, so its accelerating mode is the lowest.
gun.eigenmode.run({'mesh_config': {'h': 6, 'p': 3}})
q = gun.eigenmode.qois
for key in ['freq [MHz]', 'R/Q [Ohm]', 'G [Ohm]']:
print(f'{key:12s} {q[key]:8.3f}')
freq [MHz] 213.081
R/Q [Ohm] 132.381
G [Ohm] 140.989
The gun’s accelerating mode is at 213.081 MHz, with an R/Q of 132.381 Ohm and a geometry factor of 140.989 Ohm. Its peak-field ratios are left out on purpose: the field at the cathode corner keeps growing as the mesh is refined, so they would describe the mesh rather than the gun (see the geometry guide).
Wakefield¶
ABCI needs a pipe at each end, so build the gun with a cathode pipe for this run.
gun_with_pipe = RFGun({'geometry': geometry}, name='gun_with_pipe', beampipe='left')
gun_with_pipe.wakefield.run({'MROT': 2, 'wakelength': 20, 'bunch_length': 25})
for key, value in gun_with_pipe.wakefield.qois.items():
print(f'{key:20s} {value:.4g}')
gun_with_pipe.wakefield.plot_impedance('longitudinal');
|k_loss| [V/pC] 0.3122
k_FM [V/pC] 0.06643
k_loss_HOM [V/pC] 0.2458
|k_kick| [V/pC/m] 26.45
A 25 mm bunch loses 0.3122 V/pC to the gun, and only 0.06643 V/pC of that into the accelerating mode: 0.2458 V/pC goes into higher-order modes. A gun this large has many modes within the spectrum of a 25 mm bunch, each a peak in the impedance, and the bunch leaves energy in all of them.
Multipacting¶
Launch the electrons from the wall between \(z\) = -0.15 and 0 m: the slanted wall that runs out from the cathode, and the outer wall above it.
mp = gun.multipacting
mp.set_mesh_parameters(h=8, p=2, pec_maxh=2)
mp.set_emission_points([-0.15, 0.0], n_points=30)
mp.show_emission_points();
mp.run({'epks': np.linspace(1e6, 50e6, 20), 'phis': np.linspace(0, 2 * np.pi, 24)})
mp.plot_counter();
mp.plot_enhanced_counter();
Up to 47 MV/m no electron survives 20 impacts. Survivors appear only at the top of the
sweep: at 50 MV/m the counter function is 0.0203 and the enhanced counter 0.76, still
below 1 but rising steeply. To find out whether this gun multipacts at higher fields,
extend epks beyond 50 MV/m.
Tune it¶
Tune by the gun dimension that moves the frequency most. Here that is L3, the long
straight wall from the cathode nose outward: a longer wall makes a larger gun, with a
lower frequency. 'mid-cell' names the gun’s single cell.
gun.tune.run({'freqs': 210, 'cell_type': {'mid-cell': 'L3'},
'eigenmode_config': {'mesh_config': {'h': 6, 'p': 3}}});
result = gun.tune.qois['mid-cell']
print(f"L3: 0.2400 -> {gun.tuned.parameters['L3']:.4f} m, at {result['FREQ']:.3f} MHz")
L3: 0.2400 -> 0.2445 m, at 210.000 MHz
The tuner lengthened L3 from 0.2400 to 0.2445 m, by 4.5 mm, which brings the gun from
213.081 to 210.000 MHz: a longer wall makes a larger gun, and a larger gun resonates
lower.
See also¶
Geometry and parameterisation: the gun’s segments, and its units.
Spline cavities and reentrant cavities: the same analyses on other shapes.
Uncertainty quantification of non-elliptical cavities: a manufacturing tolerance on a gun.