{ "cells": [ { "cell_type": "markdown", "id": "65e4769f-7a6d-44e9-a37d-24589657a64e", "metadata": {}, "source": [ "# Aladdin passive - LF20" ] }, { "cell_type": "markdown", "id": "0d1deb93-512c-4057-a832-27105c2841ed", "metadata": {}, "source": [ "Passive harmonic cavity case w/ LF20 Aladdin lattice:\n", "+ Fig. 5 (a) & 5 (b) of [1]\n", "+ Fig. 4 (a) of [2]\n", "\n", "[1]: Bosch, R. A., Kleman, K. J., & Bisognano, J. J. (2001). Robinson instabilities with a higher-harmonic cavity. \n", "Physical Review Special Topics-Accelerators and Beams, 4(7), 074401.\n", "\n", "[2]: Bosch, R. A. (2005). Instabilities driven by higher-order modes in a radio frequency system with a \n", "passive higher-harmonic cavity. Physical Review Special Topics-Accelerators and Beams, 8(8), 084401." ] }, { "cell_type": "markdown", "id": "957c34e5-85a8-4562-a518-df3e14fd566a", "metadata": {}, "source": [ "## Imports" ] }, { "cell_type": "code", "execution_count": 1, "id": "32bdd65c-465d-47fd-9211-6e7d5f19cd55", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:34:52.082984Z", "iopub.status.busy": "2026-06-30T13:34:52.082667Z", "iopub.status.idle": "2026-06-30T13:35:04.833123Z", "shell.execute_reply": "2026-06-30T13:35:04.832677Z" } }, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from mbtrack2 import CavityResonator\n", "from aladdin import aladdin\n", "from albums.scan import scan_psi_I0\n", "from albums import SystemState\n", "from albums import EquilibriumOptions, TheoryOptions\n", "from albums import DEFAULT_FLOWS" ] }, { "cell_type": "markdown", "id": "5b7e4e50-2f10-45c2-92a5-f73c2e134d5a", "metadata": {}, "source": [ "## Ring and cavity setup" ] }, { "cell_type": "code", "execution_count": 2, "id": "98c7ee36-3c25-416e-a380-0d7a92f56133", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:35:04.835754Z", "iopub.status.busy": "2026-06-30T13:35:04.835526Z", "iopub.status.idle": "2026-06-30T13:35:04.838492Z", "shell.execute_reply": "2026-06-30T13:35:04.837941Z" } }, "outputs": [], "source": [ "ring = aladdin(mode=\"LF20\", V_RF=50e3)\n", "\n", "MC = CavityResonator(ring, m=1, Rs=0.5e6, Q=8000, QL=8000, detune=100e3)\n", "MC.beta = 11\n", "MC.Vc = 50e3\n", "MC.theta = np.arccos(ring.U0/MC.Vc)\n", "\n", "HC = CavityResonator(ring, m=4, Rs=1.24e6, Q=20250, QL=20250, detune=100e3)" ] }, { "cell_type": "markdown", "id": "6715fa54-dae5-4d7a-ad1d-9b2681f5826a", "metadata": {}, "source": [ "# Benchmark" ] }, { "cell_type": "code", "execution_count": 3, "id": "cb7abe1d-12c8-43c4-8e44-a92ac0158c92", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:35:04.841214Z", "iopub.status.busy": "2026-06-30T13:35:04.840999Z", "iopub.status.idle": "2026-06-30T13:35:04.844393Z", "shell.execute_reply": "2026-06-30T13:35:04.844094Z" } }, "outputs": [], "source": [ "points = 50\n", "currents = np.linspace(0, 300e-3, points)\n", "psi_HC_vals = np.linspace(80, 90, points)\n", "method = \"Bosch\"\n", "flow = DEFAULT_FLOWS[method]\n", "flow_no_coupling = DEFAULT_FLOWS[f\"{method}_no_coupling\"]\n", "N_sigma = 20\n", "tau_boundary = ring.sigma_0*N_sigma\n", "\n", "eq_opts = EquilibriumOptions(tau_boundary=tau_boundary,\n", " passive_harmonic_cavity=True,\n", " auto_set_MC_theta=True,\n", " optimal_tunning=True)" ] }, { "cell_type": "markdown", "id": "4fdade42-a119-4efb-94a9-d672689e5ecb", "metadata": {}, "source": [ "## Passive harmonic cavity - Robinson instabilities without coupling " ] }, { "cell_type": "markdown", "id": "4d241667-52c3-473f-97fa-73b7c607a5c3", "metadata": {}, "source": [ "Fig. 5 (a) in [1]" ] }, { "cell_type": "code", "execution_count": 4, "id": "b34155ee-307e-46f7-b3c8-f1469e32bf01", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:35:04.846478Z", "iopub.status.busy": "2026-06-30T13:35:04.846388Z", "iopub.status.idle": "2026-06-30T13:35:18.275628Z", "shell.execute_reply": "2026-06-30T13:35:18.274905Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\r", "scan: 0%| | 0/2500 [00:00" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "result = scan_psi_I0(\n", " SystemState(ring, [MC, HC]),\n", " psi_HC_vals,\n", " currents,\n", " flow=flow_no_coupling,\n", " eq_opts=eq_opts,\n", " theory_opts=TheoryOptions(mode_coupling=False))\n", "\n", "result.plot(\"xi\")\n" ] }, { "cell_type": "markdown", "id": "09e04d49-b22c-44a5-a765-61a807dea965", "metadata": {}, "source": [ "## Passive harmonic cavity - Robinson instabilities with coupling" ] }, { "cell_type": "markdown", "id": "ca173c62-d3a6-4ac3-a6cc-3881cd361674", "metadata": {}, "source": [ "Fig. 5 (b) in [1]" ] }, { "cell_type": "code", "execution_count": 5, "id": "197d4808-1308-4baa-a111-426c57d256bf", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:35:18.277871Z", "iopub.status.busy": "2026-06-30T13:35:18.277489Z", "iopub.status.idle": "2026-06-30T13:35:35.644832Z", "shell.execute_reply": "2026-06-30T13:35:35.644281Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\r", "scan: 0%| | 0/2500 [00:00" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "result = scan_psi_I0(\n", " SystemState(ring, [MC, HC]),\n", " psi_HC_vals,\n", " currents,\n", " flow=flow,\n", " eq_opts=eq_opts,\n", " theory_opts=TheoryOptions(mode_coupling=True))\n", "\n", "result.plot(\"xi\")\n" ] }, { "cell_type": "markdown", "id": "1c4f74c6-697d-47ef-9656-446e88b71147", "metadata": {}, "source": [ "## Passive harmonic cavity - Robinson instabilities with coupling and HOM" ] }, { "cell_type": "markdown", "id": "821f679d-0b4a-4586-9583-3226cafbe61f", "metadata": {}, "source": [ "Fig. 4 (a) in [2]" ] }, { "cell_type": "code", "execution_count": 6, "id": "2464c268-fab2-4db5-be97-d864fbc52a27", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:35:35.648559Z", "iopub.status.busy": "2026-06-30T13:35:35.648237Z", "iopub.status.idle": "2026-06-30T13:35:53.028341Z", "shell.execute_reply": "2026-06-30T13:35:53.027875Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\r", "scan: 0%| | 0/2500 [00:00" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "result = scan_psi_I0(\n", " SystemState(ring, [MC, HC]),\n", " psi_HC_vals,\n", " currents,\n", " flow=flow,\n", " eq_opts=eq_opts,\n", " theory_opts=TheoryOptions(mode_coupling=True, f_HOM=1e9, Z_HOM=10e3))\n", "\n", "result.plot(\"xi\")\n" ] } ], "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 }