Frequency-Domain Analysis¶
The frequency-domain solver, cav.fds, solves the driven time-harmonic problem
of an axisymmetric structure, one azimuthal order at a time, on the same finite
element discretisation as the eigenmode solver. The ends of the beam pipes are
ports. Each port carries the TM and TE modes of its pipe, and the solve gives the
network matrices of the structure: the impedance matrix \(\mathbf Z\), the
admittance matrix \(\mathbf Y\) and the scattering matrix \(\mathbf S\).
With a beam it also gives the generalised matrices, which include the beam as one
more port, and the beam coupling impedance. See Frequency-Domain Analysis for
the formulation.
The solver is staged, and every stage is kept in the cavity’s folder:
cav.fds.run(...)assembles the full-order model and sweeps it over the requested frequencies.cav.fds.reduce(...)builds a reduced model from solutions at a few frequencies. It solves any frequency of its band in milliseconds.cav.fds.concatenate()joins the reduced models of anAssembly’s elements through their port modes. It applies to anAssemblyrun withstrategy='coupled', which solves each element by itself and every repeated element once.
Every stage also has resonances. With every port left open they are the eigenmode
solver’s resonances with magnetic-wall pipe ends (boundary_conditions='mm').
With every port terminated in its pipe they are the loaded resonances, with
\(Q_L\) and the external Q of each port.
Interface¶
cav.fds.run(frequencies=[1000, 5000, 161], polarisation='monopole',
n_port_modes=3, beam=True, mesh_config={'h': 8, 'p': 3})
cav.fds.reduce(tol=1e-9, n_snapshots=12)
res = cav.fds.result() # the most derived stage: here the ROM
res.Z, res.S, res.Y # (n_freq, n_modes, n_modes)
res.Z_tilde, res.S_csc, res.Y_tilde # with the beam
cav.fds.impedance('longitudinal') # Z_par, columns as cav.wakefield.impedance()
cav.fds.plot_impedance('transverse', component='real')
cav.fds.plot_impedance(frequencies=grid) # sweep the ROM on another solver's grid
cav.fds.plot_modes('R/Q', source='rom') # R/Q of every resonance; 'Q' for loaded Q
cav.fds.plot_s([('2(TM01)', '1(TM01)')])
cav.fds.eigenmodes(source='rom', loaded=True)
cav.fds.solve([1000, 5000, 4001], source='rom') # sweep the ROM again, in MHz
Port modes are labelled by port and mode, for example '1(TM01)' for the
\(\mathrm{TM}_{01}\) mode of port 1 (the upstream end) and '2(TE11)' for the
\(\mathrm{TE}_{11}\) mode of port 2.
Configuration Dictionary¶
Every key can also be passed as a keyword argument, and keyword arguments override
the dictionary. The config is merged over a complete set of defaults, and the
merged dict is what runs and what fds/config.json records.
cav.fds.config_sample prints every key with its default.
frequencies(required)
[f_min, f_max, n]in MHz, or a list of frequencies in MHz.polarisation(int, str or list, default:
'monopole') The azimuthal order(s), as for the eigenmode solver. The monopole gives the longitudinal impedance and the dipole the transverse one.n_port_modes(int or dict, default: 3) TM and TE pipe modes carried at each port, or
{'TM': n, 'TE': n}. Every mode that propagates below the highest frequency must be carried; the solver warns when one is not. A mode left out sees a magnetic wall at the port.beam(None, True or dict, default: None) Adds the beam:
{'beta': 1.0, 'reference': 'auto', 'test_radius': None}.betais the velocity of the beam over the speed of light.test_radiusis the radius in mm of the line the voltage is read on. It defaults to the axis for the monopole and to half the aperture otherwise; the normalised impedance does not depend on it.referencechooses how the beam’s own field is split off:'pipe'(the default for equal pipes) or'free'(the default for unequal ones).mesh_config(dict, default:
{'h': 20, 'p': 3}) Element size in mm and polynomial order, as for the eigenmode solver.beampipe_length(float, default: None) Pipe length at each open end, in metres.
materials(dict, default: None) Overrides the properties of regions declared with
cav.add_dielectric(). A loss tangent makes the matrices complex.strategy(str, default:
'glued') For anAssembly:'glued'meshes the whole line as one model,'coupled'solves each element by itself, to be reduced and joined.reduce(dict, default: None)
{'tol': 1e-8, 'n_snapshots': 12}reduces (and, forstrategy='coupled', joins) right after the sweep.store_snapshots(bool, default: False) Keeps every solution of the sweep, so that
reduceuses them instead of solving at its own frequencies.
Outputs¶
cav.fds.result(source=None, polarisation=None) returns a SweepResult for the
stage 'fom', 'rom' or 'concat'; by default the most derived one that
exists. Its matrices are stacked over frequency first.
Z[Ohm],Y[S],S: the port matrices. The modes are normalised over the whole port disk, so these are the matrices of the three-dimensional structure for one azimuthal order and one polarisation.Suses the pseudo-waves of Marks and Williams with the wave impedance of each mode as reference. A mode below its cutoff has a reactive reference impedance, so the entries ofSthat belong to evanescent modes are not bounded by one.Z_tilde: the generalised impedance matrix[[Z, k_Z], [h_Z, z_oc]]with every port open.S_csc:(S, k, h, z_b), the CSC-BEAM matrix with every port mode matched;kholds the waves the beam sends into the pipes.S_tilde(R_b),Y_tilde: the beam as a port in waves (reference impedanceR_b, default 376.73 Ohm) and in admittances.beam_impedance(tails=True): the beam coupling impedance with matched ports.
cav.fds.impedance(kind) returns the beam coupling impedance in the columns of
cav.wakefield.impedance(): the longitudinal impedance \(Z_\parallel\) of the
monopole, or the transverse impedance \(Z_\perp = (v/\omega)\,\hat Z_1\) of the
dipole. With tails=True (the default) the impedance includes, in closed form,
the field of the waves that leave through the ports. It then describes the
structure with infinitely long pipes and does not depend on how much pipe is
meshed.
cav.fds.eigenmodes(source, loaded=False) lists the resonances of a stage with
their R/Q in the eigenmode solver’s conventions: the linac R/Q for the monopole and
the transverse R/Q_t for \(m \ge 1\). Reduced and joined models list the
resonances within 10 % of their training band. cav.fds.plot_modes(quantity)
plots each resonance’s R/Q ('R/Q') or loaded Q ('Q') against its frequency,
the same call as cav.eigenmode.plot_modes, so the two overlay.
frequencies= on impedance() and plot_impedance() evaluates the reduced
or joined model at the given frequencies (MHz) instead of reading the stored sweep,
for example on the frequency grid of a wakefield run.
Folder layout¶
<cavity>/fds/config.json
<cavity>/fds/<polarisation>/fom/matrices/ K, M, D, B, model description
<cavity>/fds/<polarisation>/fom/z/ the full-order sweep
<cavity>/fds/<polarisation>/fom/rom/ the reduced model and its sweep
<cavity>/fds/<polarisation>/foms/ an Assembly solved per element:
matrices/ z/ roms/matrices/ roms/concat/
Only Z and the beam blocks are stored; S and Y follow from them
exactly.
Limitations¶
Ports are circular pipes cut at a plane \(z = \mathrm{const}\), at the open (
PMC) ends of the model. A coaxial port, with an inner conductor on the axis, is not supported.A joint between elements must have the same pipe radius on both sides. Place it in a straight pipe, away from discontinuities. A cut through a corner of the wall needs many more port modes.
A beam needs ports at both ends and a vacuum cylinder around the axis that is free of walls and materials from end to end. For \(\beta < 1\) with pipes of different radii there is no impedance independent of where the model ends: the result refers to the two port planes, and a warning says so.
The walls are perfect conductors.
Near \(f = 0\) the system becomes ill-conditioned; start the band above a few MHz.
How-to guides¶
The comparisons of the reduced and joined models with the eigenmode solver, and of the beam coupling impedance with ABCI, are in Validation.