{ "cells": [ { "cell_type": "markdown", "id": "b424828b-a73b-4dd9-8729-6687c146f70f", "metadata": {}, "source": [ "# Aladdin active - LF20" ] }, { "cell_type": "markdown", "id": "6616e2ef-d7b2-4fa1-9261-f955c594aa33", "metadata": {}, "source": [ "Active harmonic cavity case w/ LF20 Aladin lattice:\n", "+ Fig. 11 (a) & 11 (b) of [1]\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." ] }, { "cell_type": "markdown", "id": "66e2ee87-025b-4232-8d85-9485b9697765", "metadata": {}, "source": [ "## Imports" ] }, { "cell_type": "code", "execution_count": 1, "id": "5515f551-1c60-4a0b-9f1c-d08083f191e1", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:35:55.046583Z", "iopub.status.busy": "2026-06-30T13:35:55.046346Z", "iopub.status.idle": "2026-06-30T13:36:07.633256Z", "shell.execute_reply": "2026-06-30T13:36:07.632547Z" } }, "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_HC_beta_I0_active\n", "from albums import SystemState\n", "from albums import EquilibriumOptions, TheoryOptions\n", "from albums import DEFAULT_FLOWS" ] }, { "cell_type": "markdown", "id": "5919d04c-d73b-4410-9e88-7b5d18e2beb2", "metadata": {}, "source": [ "## Ring and cavity setup" ] }, { "cell_type": "code", "execution_count": 2, "id": "8435e60a-b958-42dd-9457-a5fd7c0b4e92", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:36:07.635743Z", "iopub.status.busy": "2026-06-30T13:36:07.635511Z", "iopub.status.idle": "2026-06-30T13:36:07.639138Z", "shell.execute_reply": "2026-06-30T13:36:07.638566Z" } }, "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": "04796e3b-d372-407d-8519-4d6abc5d5c30", "metadata": {}, "source": [ "# Benchmark" ] }, { "cell_type": "code", "execution_count": 3, "id": "8b81d767-9769-4be0-ac88-63e542ebc6d7", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:36:07.640788Z", "iopub.status.busy": "2026-06-30T13:36:07.640588Z", "iopub.status.idle": "2026-06-30T13:36:07.643096Z", "shell.execute_reply": "2026-06-30T13:36:07.642846Z" } }, "outputs": [], "source": [ "points = 50\n", "currents = np.linspace(0, 300e-3, points)\n", "HC_beta_vals = np.linspace(0, 300, 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=False,\n", " auto_set_MC_theta=True,\n", " optimal_tunning=True,\n", " auto_set_for_xi=True,\n", " xi=1)" ] }, { "cell_type": "markdown", "id": "47d6090f-3f4f-4528-92a7-aa4ebcc3eca4", "metadata": {}, "source": [ "## Active harmonic cavity - Robinson instabilities without coupling" ] }, { "cell_type": "markdown", "id": "f3dc52b9-9486-49eb-b308-36a67c2e134e", "metadata": {}, "source": [ "Fig. 11 (a) in [1]" ] }, { "cell_type": "code", "execution_count": 4, "id": "45db7475-eec5-42ad-a9a9-b77e5c6e9896", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:36:07.644380Z", "iopub.status.busy": "2026-06-30T13:36:07.644298Z", "iopub.status.idle": "2026-06-30T13:36:13.188874Z", "shell.execute_reply": "2026-06-30T13:36:13.188314Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\r", "scan: 0%| | 0/2500 [00:00" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "result = scan_HC_beta_I0_active(\n", " SystemState(ring, [MC, HC]),\n", " HC_beta_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": "5977e949-d0ae-44fc-b33c-46f71508fc4b", "metadata": {}, "source": [ "## Active harmonic cavity - Robinson instabilities with coupling" ] }, { "cell_type": "markdown", "id": "e96d6b7f-81d1-4b07-80f0-f488a895db23", "metadata": {}, "source": [ "Fig. 11 (b) in [1]" ] }, { "cell_type": "code", "execution_count": 5, "id": "89d30466-0d73-438f-b691-54514113baf2", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:36:13.191591Z", "iopub.status.busy": "2026-06-30T13:36:13.191438Z", "iopub.status.idle": "2026-06-30T13:36:19.557874Z", "shell.execute_reply": "2026-06-30T13:36:19.557551Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\r", "scan: 0%| | 0/2500 [00:00" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "result = scan_HC_beta_I0_active(\n", " SystemState(ring, [MC, HC]),\n", " HC_beta_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": "code", "execution_count": null, "id": "440fad20-e2bc-43f5-a671-b7bb2de0eecb", "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 }