Multipacting¶
An electron hitting a cavity wall can knock out more electrons. If the field brings them back to the wall in step with its own oscillation, each impact frees more, and their number grows from one RF cycle to the next: multipacting. It takes power from the field and can stop a cavity from reaching its gradient. The multipacting analysis launches electrons from the wall into the cavity’s field, tracks them over many impacts at a range of field levels, and shows where electrons survive and where they multiply. Multipacting Analysis describes the method.
Multipacting teaches the analysis step by step; this page is the
full reference. Everything is reached through cav.multipacting.
Running it¶
Prepare the run one step at a time, looking at each before you run:
import numpy as np
mp = cav.multipacting
mp.set_mesh_parameters(h=6, p=3, pec_maxh=1.0) # the mesh for the field
mp.show_mesh()
mp.set_emission_points([-0.005, 0.005]) # where electrons start, z in metres
mp.show_emission_points()
mp.run({'epks': np.linspace(1e6, 45e6, 45), # peak surface fields, V/m
'phis': np.linspace(0, 2 * np.pi, 72)}) # launch phases, rad
The field is the cavity’s monopole mode. run() solves it first if it has not been
solved yet, so the mesh step is optional, but the wall needs a fine mesh; see
The mesh near the wall. The emission points are required: they say from which
part of the wall, between two values of z in metres, the electrons start.
show_emission_points() draws the wall and marks the points; n_points=
adds launch points between the mesh’s own points along the wall.
Each set_* call can instead be a key of the run() dictionary, and a key given
both ways takes the run() value, with a warning.
Reading the results¶
mp.plot_counter() # c20/c0: where electrons survive
mp.plot_enhanced_counter() # e20/c0: where they multiply
mp.plot_final_energy() # the energy of their last impact
mp.plot_distance_map(epk_i=10) # where each launch ends up, at one field level
mp.plot_trajectories() # browse the paths (in a notebook)
The counter function, \(c_{20}/c_0\), is the fraction of the launched electrons still bouncing after 20 impacts. Where it is above zero, electrons have locked into a resonant path.
The enhanced counter, \(e_{20}/c_0\), also counts the electrons each impact frees. Above 1 their number grows: multipacting.
The final impact energy tells you why: an electron frees more than one other only in a band of impact energies, which the secondary emission yield of the wall sets. The plot marks the band’s edges.
The numbers are mp.epk (the peak fields, in MV/m), mp.counter and
mp.final_energy; mp.results holds everything the run saved.
Each plot takes ax and show. show=False returns the axes without drawing
them, to add another cavity:
ax = mp.plot_counter(show=False)
other.multipacting.plot_counter(ax=ax)
plot_counter(launchable_norm=True) divides by the fraction of electrons that can
leave the wall at all, about one half, as the MultiPac code does.
Animations¶
animate_trajectories() plays the surviving electrons moving along their paths, in
a notebook or to a file:
mp.animate_trajectories() # every survivor
mp.animate_trajectories(epk_i=83) # one field level
mp.animate_trajectories(epk_i=83, zoom='follow') # the view follows them
mp.animate_trajectories(epk_i=83, save='mp.mp4') # to a file (.gif or .mp4)
epk_i, phi_i and traj choose field levels, launch phases and electrons by
index; with phi_i and traj both given, the electrons of either are shown.
color_by colours the paths by 'energy' (the default) or 'velocity'.
The paths are a fraction of a millimetre across, so the view zooms in on them
(zoom='auto'); zoom=None shows the whole cavity.
animate_phase_space(x, y) plays the same electrons with any two quantities on the
axes:
key |
unit |
quantity |
|---|---|---|
|
mm |
position along the axis, and from it |
|
m/s |
velocity along the axis, and away from it |
|
m/s |
speed |
|
eV |
kinetic energy |
|
deg |
RF phase, within one cycle |
|
ns |
time since launch |
mp.animate_phase_space(x='z', y='vz') # axial phase space
mp.animate_phase_space(x='phase', y='energy') # energy against RF phase
Velocities and energies are worked out from the recorded positions, so they look jagged near the wall impacts.
Settings¶
Key |
Meaning |
|---|---|
|
Required: the part of the wall the electrons start from, |
|
Launch points to add along the wall between the mesh’s own points. |
|
The peak surface fields to sweep, in V/m. Default: 0 to 80 MV/m in 192 steps. |
|
The launch phases, in radians. Default: 72 over \([0, 2\pi]\). |
|
Which mode’s field to use, counting from 0 (default 0, the fundamental). |
|
The energy an electron starts with, in eV (default 2). |
|
How long each electron is tracked, in seconds (default |
|
What happens to an electron the field pushes back into the wall:
|
|
The element size on the wall, in mm; see The mesh near the wall. |
|
How many processes share the field levels. |
|
Show a progress bar over the field levels (default True). |
The run saves the complete set of settings it used in multipacting/config.json,
and each process writes its progress to multipacting/mworker_<n>.log.
The mesh near the wall¶
The electrons that matter stay within a fraction of a millimetre of the wall, so
multipacting needs the field resolved much more finely there than the figures of
merit do. pec_maxh sets the element size on the wall alone:
mp.set_mesh_parameters(h=6, p=3, pec_maxh=1.0) # 1 mm elements on the wall
With pec_maxh set, the multipacting analysis solves the field on its own mesh, in
multipacting/field/, and leaves the eigenmode results alone. Without it, it reuses
the eigenmode field. Set it whenever the emission points reach beyond the equator,
for example towards the iris.
Secondary emission yield¶
How many electrons an impact frees depends on the wall material and the impact energy. A copper-like yield curve is used by default. To use your own, give a file of two columns, impact energy in eV and yield:
mp.set_sey('my_material.sey')
mp.plot_sey()
How-to guides¶
The shape how-to guides run the analysis on other walls: Spline cavities, RF guns, and Reentrant cavities, whose folded wall is where multipacting electrons can be trapped.