{ "cells": [ { "cell_type": "markdown", "id": "d5aedeab-323c-4791-bb44-2625342477ff", "metadata": {}, "source": [ "# Instabilities in single RF systems" ] }, { "cell_type": "markdown", "id": "82be0aeb-f17e-4447-931f-d8fddf4e6844", "metadata": {}, "source": [ "## Imports" ] }, { "cell_type": "code", "execution_count": 1, "id": "48122ee5-9cfa-4837-9705-e116674e9ebe", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:12:10.742484Z", "iopub.status.busy": "2026-06-30T13:12:10.742197Z", "iopub.status.idle": "2026-06-30T13:12:23.241618Z", "shell.execute_reply": "2026-06-30T13:12:23.241116Z" } }, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from mbtrack2 import CavityResonator\n", "from albums import scan_MC_psi_I0\n", "from albums import SystemState\n", "from albums import EquilibriumOptions, TheoryOptions\n", "from albums import (Flow, AlvesEquilibrium, ZeroFrequency, RobinsonCoupling,\n", " HOMCoupledBunch, PTBLHe)\n", "from albums import DEFAULT_FLOWS" ] }, { "cell_type": "markdown", "id": "e45865b6-24b9-4187-958d-a7ed7773a639", "metadata": {}, "source": [ "## Ring and cavity setup" ] }, { "cell_type": "code", "execution_count": 2, "id": "e29b458c-8a0b-4d1d-b2a4-805e16f589db", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:12:23.244368Z", "iopub.status.busy": "2026-06-30T13:12:23.243918Z", "iopub.status.idle": "2026-06-30T13:12:23.247928Z", "shell.execute_reply": "2026-06-30T13:12:23.247626Z" } }, "outputs": [], "source": [ "from mbtrack2 import Synchrotron, Electron\n", "from mbtrack2 import Optics\n", "\n", "def SOLEIL_II(V_RF=1.7e6):\n", " \"\"\"\n", " SOLEIL II lattice v2366 w/ RF parameters from November 2023 RF budget.\n", "\n", " Parameters\n", " ----------\n", " V_RF : float, optional\n", " Total RF voltage in [V]. \n", " The default is 1.7e6.\n", " \n", " Returns\n", " -------\n", " ring : Synchrotron object\n", " TDR lattice v2366_v3.\n", "\n", " \"\"\"\n", " L = 353.97\n", " E0 = 2.75e9\n", " particle = Electron()\n", " ac = 1.05751e-04\n", " tune = np.array([54.2, 18.3])\n", " chro = np.array([1.6, 1.6])\n", " beta = np.array([3.288, 4.003])\n", " alpha = np.array([0, 0])\n", " dispersion = np.array([0, 0, 0, 0])\n", " h = 416\n", " particle = Electron()\n", " mcf_order = np.array([-0.00192226, 0.00061511, 0.00010695])\n", " U0 = 469e3\n", " tau = np.array([7.64e-3, 13.83e-3, 11.64e-3])\n", " sigma_delta = 9.063e-4\n", " emit = np.array([83.7e-12, 83.7e-12*0.01])\n", " \n", " optics = Optics(local_beta=beta, local_alpha=alpha, \n", " local_dispersion=dispersion)\n", " ring = Synchrotron(h, optics, particle, L=L, E0=E0, ac=ac, U0=U0, tau=tau,\n", " emit=emit, tune=tune, sigma_delta=sigma_delta, chro=chro, \n", " mcf_order=mcf_order)\n", " \n", " tuneS = ring.synchrotron_tune(V_RF)\n", " ring.sigma_0 = (ring.sigma_delta * np.abs(ring.eta()) \n", " / (tuneS * 2 * np.pi * ring. f0))\n", " ring.get_longitudinal_twiss(V_RF)\n", " \n", " return ring" ] }, { "cell_type": "code", "execution_count": 3, "id": "a54a3188-16f3-40d4-b614-3913d87ea884", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:12:23.249312Z", "iopub.status.busy": "2026-06-30T13:12:23.249082Z", "iopub.status.idle": "2026-06-30T13:12:23.251722Z", "shell.execute_reply": "2026-06-30T13:12:23.251443Z" } }, "outputs": [], "source": [ "ring = SOLEIL_II(V_RF=1.7e6)\n", "\n", "I0 = 1.1\n", "MC = CavityResonator(ring, m=1, Rs=5e6, Q=35.7e3, QL=6e3, detune=1e6, Ncav=4)\n", "MC.Vc = 1.7e6\n", "MC.theta = np.arccos(ring.U0/MC.Vc)\n", "MC.set_optimal_detune(I0)\n", "MC.set_generator(I0)\n", "\n", "# HC is there just to be able to use scan functions but with RS=1ohm does nothing\n", "HC = CavityResonator(ring, m=4, Rs=1, Q=31e3, QL=31e3, detune=1e6, Ncav=2)\n", "HC.Vg = 0\n", "HC.theta_g = 0" ] }, { "cell_type": "markdown", "id": "4e4e2b4e-75da-44e4-8f92-8c1652d98673", "metadata": {}, "source": [ "# Main cavity tuning vs beam current scan" ] }, { "cell_type": "markdown", "id": "96ff4e64-126a-4424-9637-d9eb0ce8fc9d", "metadata": {}, "source": [ "In the case of a single RF system, the positive tuning side is Robinson unstable (AC Robinson) while for high beam current the negative tuning side is succeptible to zero-frequency instability (DC Robinson or equilibirum phase instability)." ] }, { "cell_type": "markdown", "id": "71c17a31-c40b-4b38-b3fe-26b3539a0957", "metadata": {}, "source": [ "## Case with synchrotron longitudinal damping" ] }, { "cell_type": "code", "execution_count": 4, "id": "29621b69-f1f1-4a5c-b88c-96683c35dff5", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:12:23.253009Z", "iopub.status.busy": "2026-06-30T13:12:23.252887Z", "iopub.status.idle": "2026-06-30T13:14:35.434769Z", "shell.execute_reply": "2026-06-30T13:14:35.434372Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\r", "scan: 0%| | 0/2500 [00:00" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "psi_MC_vals = np.linspace(-80, 80, 50)\n", "I0_vals = np.linspace(1e-3, 1.5, 50)\n", "\n", "eq_opts = EquilibriumOptions(auto_set_MC_theta=False,\n", " optimal_tunning=False)\n", "\n", "result = scan_MC_psi_I0(\n", " SystemState(ring, [MC, HC]),\n", " psi_MC_vals,\n", " I0_vals,\n", " flow=DEFAULT_FLOWS[\"Alves\"],\n", " eq_opts=eq_opts)\n", "\n", "result.plot(\"xi\")\n" ] }, { "cell_type": "markdown", "id": "6fb4b0b3-01ea-48a7-8518-0d51448063ad", "metadata": {}, "source": [ "## Case without synchrotron longitudinal damping" ] }, { "cell_type": "markdown", "id": "14cf93fd-05e6-4f42-b220-a19e54b91fca", "metadata": {}, "source": [ "Without synchrotron damping, the \"textbook\" picture is obtained.\n", "\n", "See Fig.7 of [1] for example.\n", "\n", "[1]: Pedersen, F. (1994). Multibunch instabilities. In Frontiers of Particle Beams: Factories with e+ e− Rings (pp. 269-292). Springer, Berlin, Heidelberg." ] }, { "cell_type": "code", "execution_count": 5, "id": "8a5e7201-4124-4fcb-89e5-4a787ac008f1", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:14:35.437300Z", "iopub.status.busy": "2026-06-30T13:14:35.437047Z", "iopub.status.idle": "2026-06-30T13:14:52.189339Z", "shell.execute_reply": "2026-06-30T13:14:52.188963Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\r", "scan: 0%| | 0/2500 [00:00" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "ring.tau[2] = 100 # Long damping time\n", "\n", "psi_MC_vals = np.linspace(-80, 80, 50)\n", "I0_vals = np.linspace(1e-3, 1.5, 50)\n", "\n", "eq_opts = EquilibriumOptions(auto_set_MC_theta=False,\n", " optimal_tunning=False)\n", "\n", "# Without synchrotron damping, make a custom flow with only ZeroFrequency and\n", "# use RobinsonCoupling to avoid a 'false positive' PTBL because of no synchrotron \n", "# longitudinal damping.\n", "flow_he = Flow(AlvesEquilibrium(),\n", " [ZeroFrequency(), RobinsonCoupling()],\n", " name=\"Alves\")\n", "\n", "result = scan_MC_psi_I0(\n", " SystemState(ring, [MC, HC]),\n", " psi_MC_vals,\n", " I0_vals,\n", " flow=flow_he,\n", " eq_opts=eq_opts)\n", "\n", "result.plot(\"xi\")\n" ] }, { "cell_type": "code", "execution_count": null, "id": "9f2a300b-6247-4a04-9985-8c837720d00c", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.3" } }, "nbformat": 4, "nbformat_minor": 5 }