{ "cells": [ { "cell_type": "markdown", "id": "bd718012-f88c-43b9-8474-4aaafb0846e2", "metadata": {}, "source": [ "# Aladdin active" ] }, { "cell_type": "markdown", "id": "5d789e2f-eb69-4537-a277-d16d65e17518", "metadata": {}, "source": [ "Active harmonic cavity case w/ standard Aladdin lattice:\n", "+ Fig. 8 (a) & 8 (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": "f9b22f52-0d75-49a7-bb5b-50fd212ad61f", "metadata": {}, "source": [ "## Imports" ] }, { "cell_type": "code", "execution_count": 1, "id": "97119c55-d1e6-4de3-aa44-a62737de8541", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:34:26.063783Z", "iopub.status.busy": "2026-06-30T13:34:26.063565Z", "iopub.status.idle": "2026-06-30T13:34:38.636068Z", "shell.execute_reply": "2026-06-30T13:34:38.635454Z" } }, "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": "90d4628a-da53-46f3-9dee-f5bc4e9bdd80", "metadata": {}, "source": [ "## Ring and cavity setup" ] }, { "cell_type": "code", "execution_count": 2, "id": "397457bf-49c7-432b-b33f-18bfc77bebb3", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:34:38.638052Z", "iopub.status.busy": "2026-06-30T13:34:38.637766Z", "iopub.status.idle": "2026-06-30T13:34:38.641008Z", "shell.execute_reply": "2026-06-30T13:34:38.640651Z" } }, "outputs": [], "source": [ "ring = aladdin(mode=\"standard\", V_RF=90e3)\n", "\n", "MC = CavityResonator(ring, m=1, Rs=0.5e6, Q=8000, QL=8000, detune=100e3)\n", "MC.beta = 11\n", "MC.Vc = 90e3\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": "3a645ef7-4761-481c-8e9a-e0c074982b91", "metadata": {}, "source": [ "# Benchmark" ] }, { "cell_type": "code", "execution_count": 3, "id": "1abcf995-df57-47ed-8431-191062ae5498", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:34:38.642352Z", "iopub.status.busy": "2026-06-30T13:34:38.642235Z", "iopub.status.idle": "2026-06-30T13:34:38.644613Z", "shell.execute_reply": "2026-06-30T13:34:38.644285Z" } }, "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": "719999ce-324f-4e29-8dd7-22efc23120a9", "metadata": {}, "source": [ "## Active harmonic cavity - Robinson instabilities without coupling" ] }, { "cell_type": "markdown", "id": "2bef9a18-0136-48df-84a4-cb2349659c13", "metadata": {}, "source": [ "Fig. 8 (a) in [1]" ] }, { "cell_type": "code", "execution_count": 4, "id": "d8d73721-b856-4bc8-b193-bf4d197250e7", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:34:38.645889Z", "iopub.status.busy": "2026-06-30T13:34:38.645773Z", "iopub.status.idle": "2026-06-30T13:34:43.609168Z", "shell.execute_reply": "2026-06-30T13:34:43.608630Z" } }, "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": "cd911a16-a631-444f-8fbd-ebd13ec93b34", "metadata": {}, "source": [ "## Active harmonic cavity - Robinson instabilities with coupling" ] }, { "cell_type": "markdown", "id": "659c1e6f-667d-4d3a-9f04-f6d151c24a25", "metadata": {}, "source": [ "Fig. 8 (b) in [1]" ] }, { "cell_type": "code", "execution_count": 5, "id": "009cae63-7114-47a6-b236-4fd439630eb3", "metadata": { "execution": { "iopub.execute_input": "2026-06-30T13:34:43.611615Z", "iopub.status.busy": "2026-06-30T13:34:43.611520Z", "iopub.status.idle": "2026-06-30T13:34:50.069136Z", "shell.execute_reply": "2026-06-30T13:34:50.068565Z" } }, "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": "eda41675-f826-4af8-b712-f56b0be70f12", "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 }