The book was published by CRCpress in March 2019 and all MATLAB scripts referred to in the book are available form the publisher's web page
The live scripts (with file extension .mlx) in this repository are specially prepared MATLAB files that contain text explanations, images as well as executable MATLAB code. Just load them from your MATLAB installation. You can also look at a webpage online or download a pdf. Both are automatically generated from the running live script and contain everything, input as well as output, including plots.
- 3D-geometry of a beam line, includes a simple OpenSCAD modeler: live script and pdf.
- Write your own beam optics code, define beam lines, calculate transfer matrices, and display trajectories: live script and pdf.
- Beamoptics in 2D, including beta functions, matching the tune, and a transition section: live script and pdf.
- Instead of repeating all used service functions at the end of each
script, I have collected them in the zip file
BeamOpticsSupportFiles.zip which
contains three subdirectories, one each for the 2D, 3D, and 4D
versions of the software. Unpack the zip file in the directory where
the live script resides. Here are the descriptions of the files in
the respective subdirectories.
- 2D support functions and as pdf. Include in live script with "addpath ./2D".
- 3D support functions and as pdf. Include in live script with "addpath ./3D".
- 4D support functions and as pdf. Include in live script with "addpath ./4D".
- Chromaticity of FODO cells: live script and pdf.
- Dispersion suppressor at the end of a 90-degree/cell FODO arc: live script and pdf.
- Match the phase advances (or tunes) in a FODO cell in both planes simultaneously: live script and pdf.
- Match the beta functions at a waist in a FODO lattice in both planes simultaneously: live script and pdf.
- Triplet beam line with small spot at the end: live script and pdf.
- Point-to-point focusing and the imaging equation for a lens: live script and pdf.
- Additional scripts:
- C-shaped dipole magnet, uses the PDE toolbox to define the geometry, boundary conditions, and material properties of a typical C-shaped dipole magnet. Then solves the model for the vector potential and post-processes the solution in order to obtain the field inside the gap: live script and pdf.
- The upper half of the C-magnet exploiting the up-down symmetry: live script and pdf.
- C-magnet with shims (only the upper half): live script and pdf.
- Quadrupole magnet (one quadrant only): live script and pdf.
- Super-conducting Dipole 1, defined by intersecting circles: live script and pdf.
- Super-conducting Dipole 2, defined by two circular segments: live script and pdf.
- Super-conducting Quadrupole, defined by four circular segments: live script and pdf.
- Pill-box explorer for TM-modes: live script and pdf.
- Large amplitude oscillations in longitudinal phase space, based on closed-form solution of the equations of motion for a mathematical pendulum: live script and pdf.
- Filamentation of a starting distribution to a matched distribution in longitudinal phase space: live script and pdf.
- Bunch tomography in longitudinal phase space: live script and pdf.
- Debunching and rebunching on a higher harmonic: live script and pdf.
- Bunch rotation in longitudinal phase space: live script and pdf.
- Bunch muncher simulation: live script and pdf.
- Rectangular TE-waveguide: live script and pdf.
- Circular TE-waveguide: live script and pdf.
- Circular TM-waveguide: live script and pdf.
- TEM-mode in a coaxial waveguide: live script and pdf.
- Pill-box cavity with beam pipe simulation: live script and pdf.
- Potential of an off-center beam in a circular beam pipe, find the position of the image charge that makes the beam pipe an equipotential surface. live script and pdf.
- Octagonal BPM and the field of a displaced beam: live script and pdf.
- One-to-one steering in a transfer line: live script and pdf.
- Orbit correction in a ring: live script and pdf.
- Van-der-Meer scans and beam-beam collisions: live script and pdf.
- Beam-beam collisions with disruption in CLIC: live script and pdf.
- Phase-space of small-signal FEL and the small-signal gain: live script and pdf.
- SASE free-electron laser simulation: live script and pdf.
- Free-electron laser oscillator simulation: live script and pdf.
- Phase-space plots and tracking in one dimensions: live script and pdf.
- Dynamic Aperture determined by tracking in two transverse planes: live script and pdf.
- Beam transport with space charge using an integrator for the Sacherer equations: live script and pdf.
- Dispersion Integral for Gaussian momentum distributions: live script and pdf.
- Bunch-lengthening simulation: live script and pdf.
- Vacuum calculations with a minimal version of the vaktrak algorithm: live script and pdf.