Wakefield analysis

A bunch of charged particles passing through a cavity leaves electromagnetic fields behind it, its wake. The wake takes energy from the bunch, and its transverse part kicks later bunches sideways, which can make a beam unstable. The wakefield analysis computes the wake of a Gaussian bunch, the loss and kick factors that sum it up, and the impedance: the wake as a spectrum over frequency, whose peaks are the cavity’s modes.

cavsim2d runs the wakefield with ABCI, a time-domain solver from KEK. ABCI is installed separately; see Installation. Wakefields and impedance teaches the basics; this page is the full reference.

Running it

cav.wakefield.run({'wakelength': 50, 'bunch_length': 25})

or study.run_wakefield(...) for every cavity in a study. ABCI needs a beam pipe at each end of the cavity, and adds one at an end that has none.

Reading the results

cav.wakefield.qois holds the loss and kick factors:

Key

Description

|k_loss| [V/pC]

The loss factor: the energy the bunch loses, per unit charge squared.

k_FM [V/pC]

The part of it left in the fundamental, accelerating mode.

k_loss_HOM [V/pC]

The rest, left in the higher-order modes.

|k_kick| [V/pC/m]

The kick factor: the sideways kick per unit charge and per metre of offset.

As with the eigenmode results, a key can be read without its unit and bars: cav.wakefield.qois['k_loss'] is cav.wakefield.qois['|k_loss| [V/pC]'].

The plots:

cav.wakefield.plot_impedance()                  # longitudinal |Z| against f, in kOhm
cav.wakefield.plot_impedance('transverse')      # transverse, the dipole modes
cav.wakefield.plot_wake()                       # the wake potential against s
cav.wakefield.plot_k_loss()                     # loss factor summed up to each f
cav.wakefield.plot_k_kick()                     # kick factor summed up to each f

plot_impedance takes unit ('k' for kOhm, the default, or 'M') and ax, to draw into an existing figure. The eigenmode solver’s impedance plot takes the same arguments, so an impedance built from the modes overlays the wakefield’s:

ax = cav.eigenmode.plot_impedance()     # from the modes (needs open ends)
cav.wakefield.plot_impedance(ax=ax)     # from the wake

The data behind the plots are cav.wakefield.impedance(kind), cav.wakefield.wake_z and cav.wakefield.wake_t, as pandas DataFrames. For a study, study.wakefield.plot_impedance() and the other plots draw one curve per cavity.

The field as the bunch passes

With 'save_fields': True, ABCI also saves snapshots of the electric field lines as the bunch crosses the cavity, and animate_fields() plays them:

cav.wakefield.run({'MROT': 0, 'wakelength': 20, 'save_fields': True})
cav.wakefield.animate_fields()                       # in a notebook
cav.wakefield.animate_fields(save='fields.mp4')      # or to a file

Settings

Pass the settings as a dictionary, or as keywords, which take precedence. Settings you leave out keep their defaults, and the run saves the complete set it used in wakefield/config.json. Wakefield — cav.wakefield.run / study.run_wakefield lists them all.

wakelength

(float, default 50) How far behind the bunch the wake is computed, in metres. A longer wake resolves the impedance more finely in frequency, and takes longer.

bunch_length

(float, default 25) The RMS length of the Gaussian bunch, \(\sigma_z\), in mm. A shorter bunch has a wider spectrum, so it excites, and the impedance shows, modes of higher frequency.

MROT

(int, default 2) Which wake to compute: 0 the longitudinal (monopole) wake, 1 the transverse (dipole) wake, 2 both.

save_fields

(bool or dict, default None) Save the field-line snapshots for animate_fields(); {'nshot': N} sets how many.

operating_points

(dict, default None) Beam parameters for which to compute the power lost into higher-order modes; see Operating points.

processes

(int, default 1) How many cavities of a study to run at once.

rerun

(bool, default True) False reuses results already computed for this geometry.

Operating points

An operating point describes the beam at one machine setting. With operating points, the run also computes the power the beam leaves in the higher-order modes:

op_points = {
    'Z': {
        'freq [MHz]': 400.79,
        'E [GeV]': 45.6,
        'I0 [mA]': 1280,
        'sigma [mm]': 4.32,
        'Nb [1e11]': 2.76,
    }
}
cav.wakefield.run({'operating_points': op_points})
cav.wakefield.qois_op           # the results for each operating point

sigma [mm] is the RMS bunch length. When an operating point has more than one bunch length, give them as a dictionary with a label for each, for example a collider with and without beamstrahlung:

'sigma [mm]': {'SR': 4.32, 'BS': 15.2}

Each bunch length gets its own wakefield run, filed as <operating point>_<label>_<sigma>mm (Z_SR_4.32mm), or <operating point>_<sigma>mm for a single unlabelled one. The first bunch length listed is the one the comparison plots and tables show. Several operating points compare the power across machine settings; for a study, study.wakefield.plot_hom_bar() draws the comparison.

How-to guides

The wakefield under manufacturing tolerances is covered with the other uncertainty quantification guides, in Uncertainty quantification.