Geometry¶
A cavity in cavsim2d is axisymmetric, so one outline describes its shape: the wall
in the (z, r) half-plane, from the beam axis outward. You never draw that outline
yourself. You pick a shape class and give it a handful of named dimensions; the class
builds the outline, and every analysis uses that same outline.
This page lists the built-in shapes and their dimensions, explains how a multicell cavity is described, and shows how to fill part of a cavity with a dielectric. Beam pipes, bellows, tapers and absorbers, and joining devices into a beam line, are on the Beam lines page. To describe a shape of your own, see Writing a new cavity model.
All lengths are in millimetres, except the RF gun’s, which are in metres (see
below). cav.plot('geometry') draws the upper half of the
outline, the part that is solved; mirror=True draws the full cross-section.
Built-in shapes¶
Elliptical cavity (EllipticalCavity)¶
The standard superconducting cavity shape. A cell is two ellipses joined by a
straight line: one at the equator, the outer wall, and one at the iris, the opening
the beam passes through. Seven numbers describe half of a cell,
[A, B, a, b, Ri, L, Req]:
Fig. 1 The seven dimensions of an elliptical half-cell.¶
A,B: the half-axes of the equator ellipse, alongzand alongr.a,b: the half-axes of the iris ellipse.Ri: the radius of the iris.L: the length of the half-cell, from the iris to the equator; a full cell is2 Llong.Req: the radius of the equator.
The straight line joining the two ellipses is tangent to both, so its angle follows from the seven dimensions. A multicell cavity takes one list for its inner cells and one for each end cell:
EllipticalCavity(n_cells, mid_cell, end_cell_left, end_cell_right, beampipe='both')
The end-cell lists default to mid_cell. A one-cell cavity is built from its two
end halves, so for one cell it is the end-cell lists that count. beampipe adds a
beam pipe at 'left', 'right' or 'both' ends, or 'none'. See
Multicell cavities for how the cells are joined.
Flat-top elliptical (EllipticalCavityFlatTop)¶
An elliptical cell with a straight, flat section at the equator. A half-cell takes the
elliptical cell’s seven dimensions plus l, the length of the flat section,
[A, B, a, b, Ri, L, Req, l], so a full cell is 2 L + l long.
Pillbox (Pillbox)¶
A cylinder, five dimensions [L, Req, Ri, S, L_bp]:
L: the length of a cell along the axis.Req: the radius of the cylinder.Ri: the radius of the opening at each end.S: the straight gap between neighbouring cells, at radiusRi; 0 joins the cells directly.L_bp: the length of the beam pipe added at each end thatbeampipeselects.
Pillbox(n_cells, [L, Req, Ri, S, L_bp], beampipe='both')
Spline cavity (SplineCavity)¶
A free-form wall: a Bézier curve through six control points p0 to p5, each a
[z, r] pair:
SplineCavity({'geometry': {'p0': [0, 35], 'p1': [0, 70], 'p2': [30, 103],
'p3': [85, 103], 'p4': [115, 70], 'p5': [115, 35]},
'beampipe': 'both', 'beampipe_length': 40})
Each coordinate is a dimension of its own, named p<i>_z or p<i>_r (for
example 'p2_r'), which you can tune, vary and optimise. Placing p1 and p4
at the same radius as p0 and p5 makes the wall leave the beam pipe smoothly
instead of at a sharp corner. cav.plot('geometry') also draws the control points
and the polygon joining them; pass control_points=False to hide them.
RF gun (RFGun)¶
A photoinjector or VHF gun: a cathode at one end, a nose cone, and an exit pipe. Its
wall is a chain of arcs and straight segments, given as a dictionary of named radii
(R), lengths (L) and angles (T), in wall order from the cathode:
RFGun({'geometry': {'y1': ..., 'R2': ..., 'T2': ..., 'L3': ..., 'R4': ..., 'L5': ...,
'R6': ..., 'L7': ..., 'R8': ..., 'T9': ..., 'R10': ..., 'T10': ...,
'L11': ..., 'R12': ..., 'L13': ..., 'R14': ..., 'x': ...}})
dimensions |
segment |
|---|---|
|
radius of the opening at the cathode plane |
|
radius and angle of the first arc, at the cathode nose |
|
straight segment after that arc, at angle |
|
a blending arc, and the straight segment after it |
|
the arc into the barrel, and the barrel’s length |
|
radius and angle of the arc into the nose cone |
|
radius and angle of the arc at the exit nose |
|
the straight segment after the nose, and the next arc |
|
the straight segment to the exit, and the arc at the exit |
|
length of the drift tube to the exit opening |
Unlike every other shape, a gun’s lengths and radii are in metres and its angles
(T2, T9, T10) in radians. The same units apply wherever a gun dimension
is used, such as an optimisation bound or a UQ delta: a 0.5 mm spread on R6
is delta=[5e-4].
beampipe='left' adds a pipe at the cathode end, which a wakefield run needs; the
exit pipe is part of the gun. Two points about a gun’s figures of merit:
EaccandEpk/Eacctake the length of the on-axis field as the active length. Seteigenmode_config['normalization_length'](mm) to choose another.Epk/Eacckeeps changing as the mesh is refined, because the field at the cathode corner grows without limit. Treat it as mesh-dependent. The frequencies and the fields converge as usual.
Multicell cavities¶
The elliptical shapes are the ones built from cells. Neighbouring cells share their iris, and the two halves of a cell share their equator, so:
Reqis shared by the two halves of a cell;Riis shared by the two halves that meet at an iris;A,B,a,bandLbelong to each half-cell.
There are two ways to name a multicell cavity’s dimensions.
By cell type, the default. A bare name such as
'Req'means the dimension of one type of cell:Req_mfor the inner cells,Req_elandReq_erfor the left and right end cells. This is what tuning uses; see Tuning.Per half-cell.
cav.half_cells()returns every half-cell as a row of[A, B, a, b, Ri, L, Req], two rows per cell, andcav.set_half_cells(array)sets them, so every half-cell can differ. This is how uncertainty quantification varies each half-cell on its own; see Uncertainty quantification.
Dielectric regions¶
A cavity is vacuum inside unless you add a dielectric.
add_dielectric() fills a ring of the cavity, a
rectangle in (z, r), with a material of the given relative permittivity:
# a 0.5 mm-thick quartz tube lining a 5 mm opening, along the whole cavity
cav.add_dielectric('quartz', 3.8, z=(-1e4, 1e4), r=(2.0, 2.5), maxh=0.15)
Lengths are in millimetres, and the region is cut to the cavity, so a generous z
span means “the full length”. maxh sets the element size inside the region,
which a thin layer needs. Only the eigenmode solver takes dielectrics into account;
Dielectric regions covers the figures of merit they add, and lossy
materials.
One outline, every analysis¶
Each part of the outline is labelled: PEC for the metal wall, PMC for an
opening, such as the end of a beam pipe. The analyses read the labels and nothing
else, so the same outline serves all of them, and the differences between the
analyses are in their settings (see Configuration reference):
the eigenmode solver meshes the outline;
eigenmode_config['mesh_config']sets the element sizehand orderp;the wakefield solver writes the outline into an ABCI input file, adding a beam pipe at an end that has none, because ABCI needs one at each end;
the multipacting analysis launches electrons from the metal wall into the field the eigenmode solver found.
A shape of your own therefore only has to produce a labelled outline, and every analysis works on it; see Writing a new cavity model.