ElSeparator =========== This module describes the PASS electrostatic separator element **ElSeparator**, used to simulate the deflection of charged particles in a uniform transverse electric field. Electrostatic separators are widely used in beam injection and extraction systems, using a septum (cutting plate/wire) to divide the aperture into a field-free region (circulating beam in the ring) and a field region (injected or extracted beam), applying electric field deflection only to particles that cross the septum. The PASS electrostatic separator supports both **thin lens** (pure momentum kick) and **thick lens** (DKD exact parabolic trajectory) modes. The user can input deflection parameters via either field strength (``ex`` / ``ey``, V/m) or integrated field (``exl`` / ``eyl``, V), consistent with MAD-X definitions. **Code Location** - Source file: ``PASS/commands/element/elseparator.py`` - Class name: ``ElSeparator`` (inherits from ``Command``) - Registration name: ``elseparator`` - Key features: - Thin lens (``length = 0``): pure momentum translation, strictly symplectic - Thick lens (``length > 0``): DKD (Drift-Kick-Drift) 2nd-order symplectic integration, exact solution for uniform electric field - Two input methods: field strength (``ex`` / ``ey``) and integrated field (``exl`` / ``eyl``), with automatic mutual derivation - Septum position detection: automatically determines whether a particle is in the field-free region, field region, or striking the plate/wire - Supports ``tilt`` roll rotation about the :math:`s` axis (clockwise, consistent with MAD-X) - Supports aperture check Coordinate Convention --------------------- PASS uses the six-dimensional phase-space variables :math:`(x, p_x, y, p_y, z, \delta)`: .. list-table:: :header-rows: 1 :widths: 15 20 65 * - Variable - Symbol - Definition * - ``x`` - :math:`x` - Horizontal offset (relative to the reference orbit) * - ``px`` - :math:`p_x` - Normalized horizontal momentum, :math:`p_x = P_x / P_0` * - ``y`` - :math:`y` - Vertical offset * - ``py`` - :math:`p_y` - Normalized vertical momentum, :math:`p_y = P_y / P_0` * - ``z`` - :math:`\zeta` - Longitudinal coordinate, :math:`\zeta = s - \beta_0 c t` * - ``dp`` - :math:`\delta` - Relative momentum deviation, :math:`\delta = P / P_0 - 1` where :math:`P_0` is the reference particle momentum, :math:`\beta_0 = v_0 / c` is the reference particle normalized velocity. Physical Derivation -------------------- Electric Field Force and Normalized Kick ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The electrostatic separator produces a uniform transverse electric field :math:`E_x` or :math:`E_y` between the plates. A charged particle in the electric field experiences the force: .. math:: \vec{F} = q \vec{E} The particle traverses the separator of length :math:`L` with longitudinal velocity :math:`v = \beta_0 c`, with a residence time of :math:`t = L / (\beta_0 c)`. The transverse momentum change is: .. math:: \Delta P_x = q E_x \cdot t = \frac{q E_x L}{\beta_0 c} Normalizing to PASS coordinates (:math:`p_x = P_x / P_0`, :math:`P_0 = q_0 B\rho`, same species :math:`q = q_0`): .. math:: \Delta p_x = \frac{\Delta P_x}{P_0} = \frac{E_x L}{\beta_0 c \cdot B\rho} = \frac{\mathrm{exl}}{\beta_0 c \cdot B\rho} where :math:`\mathrm{exl} = E_x \cdot L` is the integrated electric field (unit: volts), and :math:`B\rho = P_0 / q_0` is the magnetic rigidity. Similarly: .. math:: \Delta p_y = \frac{\mathrm{eyl}}{\beta_0 c \cdot B\rho} Dimensional verification: :math:`[\mathrm{V}] / ([\mathrm{m/s}] \cdot [\mathrm{T \cdot m}]) = [\mathrm{J/C}] / [\mathrm{kg \cdot m / (C \cdot s)}] = 1` (dimensionless) ✓ Equivalence with Magnetic Dipole ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The deflection produced by an electric field on a particle with velocity :math:`\beta_0 c` is equivalent to a particle with magnetic rigidity :math:`B\rho` passing through a magnetic field :math:`B`. From :math:`\Delta p_x = E_x L / (\beta_0 c \cdot B\rho)` and the magnetic dipole kick :math:`\Delta p_x = B L / B\rho` being equivalent: .. math:: E_x = \beta_0 c \cdot B That is, an electric field of :math:`1\,\mathrm{MV/m}` at :math:`\beta_0 \approx 1` is equivalent to a magnetic field of :math:`B \approx 3.336\,\mathrm{mT}`. Same Deflection Angle but Different Energy Change ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The above equivalence refers only to the **same deflection angle**. Electric and magnetic fields differ fundamentally in energy conservation: - **Magnetic field does no work**: :math:`\vec{F} = q\vec{v}\times\vec{B}`, :math:`\vec{F} \perp \vec{v}`, the total particle momentum :math:`P` is unchanged; as :math:`p_x` increases, :math:`p_z` decreases (momentum redistribution), and :math:`\delta` is exactly unchanged. - **Electric field does work**: :math:`\vec{F} = q\vec{E}`, the particle has a transverse displacement :math:`\Delta x` within the plates, the electric field does work :math:`W = qE_x \cdot \Delta x \neq 0`, and the total particle energy increases, so :math:`\delta` changes. For a thick lens, the transverse displacement of the particle (DKD exact solution) is: .. math:: \Delta x = \frac{p_{x0} L}{p_z} + \frac{\Delta p_x \cdot L}{2 p_z} The :math:`\delta` change corresponding to the electric field work: .. math:: \Delta\delta = \frac{W}{P_0 c} = \frac{E_x \cdot \Delta x}{B\rho \cdot c} For a particle with :math:`p_{x0} = 0`, substituting :math:`\Delta x = \Delta p_x \cdot L / (2 p_z)` and :math:`\Delta p_x = E_x L / (\beta_0 c \cdot B\rho)`: .. math:: \Delta\delta = \frac{\Delta p_x^2}{2\beta_0} For :math:`\Delta p_x = 30\,\mathrm{mrad}`, :math:`\beta_0 \approx 1`, :math:`\Delta\delta \approx 4.5 \times 10^{-4}`, which is one to two orders of magnitude smaller than typical beam momentum spread (:math:`10^{-3} \sim 10^{-2}`). .. note:: In the PASS DKD implementation, the kick only updates :math:`p_x` / :math:`p_y`, not :math:`\delta`, i.e., the electric field work is ignored. This is a reasonable approximation: - **Magnitude is negligible**: :math:`\Delta\delta = O(\Delta p_x^2)`, on the order of :math:`10^{-4}` for deflection angles of tens of mrad - **Per-particle correct handling is costly**: :math:`\Delta x` depends on the initial :math:`p_{x0}`, which differs for each particle; correctly computing the work requires tracking displacement per particle within the DKD, turning a simple symplectic integrator into an iterative scheme - **Thin lens self-consistency**: When :math:`L = 0`, :math:`\Delta x = 0`, :math:`W = 0`, :math:`\Delta\delta = 0`; the thin lens ignoring energy change is naturally self-consistent Thin Lens Mode -------------- When ``length = 0``, the electrostatic separator is modeled as a thin lens: the particle position is unchanged, and only the momentum undergoes an instantaneous jump: .. math:: x \leftarrow x .. math:: p_x \leftarrow p_x + \frac{\mathrm{exl}}{\beta_0 c \cdot B\rho} .. math:: y \leftarrow y .. math:: p_y \leftarrow p_y + \frac{\mathrm{eyl}}{\beta_0 c \cdot B\rho} The Jacobian of this map is the identity matrix, which is strictly symplectic. The kick is computed directly from the integrated field :math:`\mathrm{exl}` / :math:`\mathrm{eyl}` without needing to know the plate length. Thick Lens Mode (DKD) --------------------- When ``length > 0``, Drift-Kick-Drift (DKD) 2nd-order symplectic integration is used: .. math:: \mathcal{M}_{\mathrm{DKD}}(L) = \mathrm{Drift}\!\left(\frac{L}{2}\right) \circ \mathrm{Kick}(L) \circ \mathrm{Drift}\!\left(\frac{L}{2}\right) where Kick is the thin lens kick (:math:`\Delta p_x = \mathrm{exl} / (\beta_0 c \cdot B\rho)`), and Drift is the exact drift map. Each ``_drift_exact_cpu`` call performs :math:`x \mathrel{+}= L \cdot p_x / p_z`. The DKD has three steps: the first drift uses the initial :math:`p_{x0}`, after the kick the second drift uses :math:`p_{x0} + \Delta p_x`. Combining: .. math:: \Delta x = \frac{p_{x0} L}{2 p_z} + \frac{(p_{x0} + \Delta p_x) L}{2 p_z} = \frac{p_{x0} L}{p_z} + \frac{\Delta p_x \cdot L}{2 p_z} DKD Is Exact for Uniform Electric Field ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Under a uniform electric field, the particle equation of motion is constant-acceleration motion. Let :math:`k = E_x / (\beta_0 c \cdot B\rho)` (constant), with :math:`p_z` approximately unchanged: .. math:: \frac{dp_x}{ds} = k .. math:: \frac{dx}{ds} = \frac{p_x}{p_z} Integrating gives a parabolic trajectory: .. math:: p_x(s) = p_{x0} + k \cdot s .. math:: x(s) = x_0 + \frac{p_{x0}}{p_z} s + \frac{k}{2 p_z} s^2 At :math:`s = L`, substituting :math:`\Delta p_x = k L`: .. math:: x(L) = x_0 + \frac{p_{x0} L}{p_z} + \frac{\Delta p_x \cdot L}{2 p_z} This is **exactly consistent** with the DKD result. This is not a coincidence—leapfrog (DKD) is exact for constant-acceleration motion, because the first half drift uses the initial :math:`p_x` and the second half uses the kicked :math:`p_{x0} + \Delta p_x`; the average exactly gives the parabola. .. note:: The above exactness assumes :math:`p_z \approx \mathrm{const}`. For typical deflection angles (tens of mrad), the :math:`p_z` change :math:`\Delta p_z \approx -\Delta p_x^2 / (2 p_z) \sim 10^{-4}` is negligible. Therefore, DKD does not need an additional ``model="exact"`` mode. Kick Consistency Between Thin Lens and Thick Lens -------------------------------------------------- The kick :math:`\Delta p_x` is **exactly the same** for both thin lens and thick lens, both computed from the integrated field :math:`\mathrm{exl}`. The difference is only in the position change: .. list-table:: :header-rows: 1 :widths: 20 40 40 * - - Thin lens (:math:`L = 0`) - Thick lens DKD (:math:`L > 0`) * - kick :math:`\Delta p_x` - :math:`\mathrm{exl} / (\beta_0 c \cdot B\rho)` - Same * - Position change :math:`\Delta x` - 0 - :math:`p_x L / p_z + \Delta p_x \cdot L / (2 p_z)` * - Septum detection - Single point (entrance position) - Entrance position classification For :math:`\Delta p_x = 30\,\mathrm{mrad}`, :math:`L = 0.5\,\mathrm{m}`, :math:`p_z \approx 1` (typical parameters), the position difference: .. math:: \frac{\Delta p_x \cdot L}{2 p_z} \approx \frac{0.03 \times 0.5}{2} = 7.5\,\mathrm{mm} This magnitude is not negligible in injection/extraction scenarios (septum gaps are typically on the order of mm), so the thick lens mode is recommended. Septum Logic ------------ The core physical characteristic of the electrostatic separator is that **not all particles experience the electric field**. The septum (cutting plate/wire) divides the aperture into: - **Field-free region**: the region where the circulating beam resides; particles are unaffected by the electric field and undergo pure drift - **Field region**: the region where the injected/extracted beam resides; particles are deflected by the electric field - **Plate/wire region** (within septum thickness): particles strike the cutting plate/wire and are marked as lost Determination Rules ~~~~~~~~~~~~~~~~~~~ The septum direction is directly determined by which field component is nonzero: - :math:`E_x \neq 0` (``exl`` nonzero): plates are vertical, the septum is a vertical line, and the :math:`x` coordinate is checked - :math:`E_y \neq 0` (``eyl`` nonzero): plates are horizontal, the septum is a horizontal line, and the :math:`y` coordinate is checked The sign of ``septum_x_position`` determines which side has the field—**the field is always on the side away from the beam center**: .. list-table:: :header-rows: 1 :widths: 25 25 25 25 * - septum_x_position - Field-free region (circulating beam) - Plate/wire region - Field region (deflected beam) * - :math:`> 0` - :math:`x \le s_x` - :math:`s_x < x \le s_x + t` - :math:`x > s_x + t` * - :math:`< 0` - :math:`x \ge s_x` - :math:`s_x - t \le x < s_x` - :math:`x < s_x - t` where :math:`s_x` is ``septum x position`` and :math:`t` is ``septum thickness``. The rules for ``septum y position`` are analogous, replacing :math:`x` with :math:`y`. .. raw:: html