Quickstart¶
A first simulation in a few minutes: build one elliptical cell, solve for its modes, and tune it to 1300 MHz. Run the code in a Jupyter notebook, where the plots appear inline. The tutorials then explain each step properly.
Build a cell¶
An elliptical cell is described by seven dimensions in millimetres,
[A, B, a, b, Ri, L, Req]: the half-axes of its two ellipses, its iris radius, its
half-length and its equator radius. Geometry shows them in a figure.
from cavsim2d import EllipticalCavity
cell = [42, 42, 12, 19, 35, 57.7, 100.0]
cav = EllipticalCavity(1, cell, beampipe='none', name='my_cell')
cav.plot('geometry') # the cell's half cross-section
The first argument is the number of cells. beampipe='none' leaves out the beam
pipes, and name names the folder the results go in.
Solve its modes¶
cav.eigenmode.run() # solve its monopole modes
qois = cav.eigenmode.qois # figures of merit of the accelerating mode
print(f"{qois['freq [MHz]']:.1f} MHz, R/Q = {qois['R/Q [Ohm]']:.1f} Ohm, "
f"G = {qois['G [Ohm]']:.1f} Ohm, Epk/Eacc = {qois['Epk/Eacc []']:.2f}")
1349.6 MHz, R/Q = 113.5 Ohm, G = 279.0 Ohm, Epk/Eacc = 1.99
qois holds the figures of merit of the accelerating mode: its frequency, R/Q (how
strongly it couples to the beam), the geometry factor G, the peak surface fields, and
more. Eigenmode analysis lists them all, and the Glossary explains each one.
Tune it¶
The cell resonates above 1300 MHz. Tuning changes one dimension, here the equator
radius Req, until the cell resonates at the target:
cav.tune.run({'freqs': 1300, 'cell_type': {'mid-cell': 'Req'}})
tuned = cav.tuned # a new cavity, saved beside the original
tuned.eigenmode.run()
print(f"Req = {tuned.parameters['Req_m']:.2f} mm -> "
f"{tuned.eigenmode.qois['freq [MHz]']:.1f} MHz")
Req = 103.37 mm -> 1300.0 MHz
A larger cell resonates lower, so the tuner widened the equator from 100 to 103.37 mm.
Where the results are¶
Every result is saved in the cavity’s folder, my_cell, in the working directory:
the eigenmode results in my_cell/eigenmode, and the tuned cavity in
my_cell/tuned. To keep several cavities together, add them to a
Study, a project folder that also compares them; see
Compare designs: studies, sweeps and saved results.
Next steps¶
Work through the tutorials, starting with Your first cavity: a pillbox.
To install ABCI for the wakefield analysis, see Installation.