{ "cells": [ { "cell_type": "markdown", "id": "35d27b44", "metadata": {}, "source": [ "# 4.18 Eigenmode simulation with Ports\n", "\n", "Authors: Samarth Hawaldar, Arvind Mamgain\n", "\n", "Adapted from tutorial 4.16\n" ] }, { "cell_type": "markdown", "id": "b44bbf49", "metadata": {}, "source": [ "> 💡 **Using this tutorial without the Qt GUI**\n", "> \n", "> This tutorial uses the desktop `MetalGUI`. To follow along on Colab, Binder, JupyterHub, or any environment where Qt isn't available, **replace any `gui.rebuild()` / `gui.screenshot()` call with `qm.view(design)`** — it renders the design to a matplotlib `Figure` you can display inline or save with `fig.savefig(...)`.\n", "> \n", "> See [1.4 Headless quick view](../1-Overview/1.4-Headless-quick-view-%28no-Qt-GUI%29.ipynb) for a complete runnable walkthrough and [`docs/headless-usage.rst`](../../../docs/headless-usage.rst) for the full reference." ] }, { "cell_type": "markdown", "id": "abc2b76d", "metadata": {}, "source": [] }, { "cell_type": "code", "execution_count": null, "id": "0b0da17a", "metadata": {}, "outputs": [], "source": [ "# Import useful packages\n", "import qiskit_metal as metal\n", "from qiskit_metal import designs, draw\n", "from qiskit_metal import MetalGUI, Dict, open_docs\n", "\n", "# Packages for the simple design\n", "from qiskit_metal.qlibrary.tlines.meandered import RouteMeander\n", "from qiskit_metal.qlibrary.tlines.pathfinder import RoutePathfinder\n", "from qiskit_metal.qlibrary.terminations.launchpad_wb_driven import (\n", " LaunchpadWirebondDriven,\n", ")\n", "from qiskit_metal.qlibrary.terminations.open_to_ground import OpenToGround\n", "from qiskit_metal.qlibrary.couplers.coupled_line_tee import CoupledLineTee\n", "\n", "# Analysis\n", "from qiskit_metal.analyses.quantization import EPRanalysis" ] }, { "cell_type": "markdown", "id": "c6e244f8", "metadata": {}, "source": [ "## Set up the design" ] }, { "cell_type": "code", "execution_count": null, "id": "3983eac9", "metadata": {}, "outputs": [], "source": [ "# Set up chip dimensions\n", "design = designs.DesignPlanar()\n", "design._chips[\"main\"][\"size\"][\"size_x\"] = \"2mm\"\n", "design._chips[\"main\"][\"size\"][\"size_y\"] = \"2mm\"\n", "design._chips[\"main\"][\"size\"][\"size_z\"] = \"-280um\"\n", "# Resonator and feedline gap width (W) and center conductor width (S) from reference 2\n", "design.variables[\"cpw_width\"] = \"10 um\" # S from reference 2\n", "design.variables[\"cpw_gap\"] = \"6 um\" # W from reference 2\n", "\n", "\n", "design.overwrite_enabled = True\n", "\n", "hfss = design.renderers.hfss\n", "\n", "# Open GUI\n", "gui = MetalGUI(design)" ] }, { "cell_type": "markdown", "id": "055c0bef", "metadata": {}, "source": [ "## Define the geometry\n", "\n", "Here we will have a single feedline couple to a single CPW resonator.\n", "\n", "The lauchpad should be included in the driven model simulations.\n", "\n", "For that reason, we use the LaunchpadWirebondDriven component which has an extra pin for input/output" ] }, { "cell_type": "code", "execution_count": null, "id": "ef570ed8", "metadata": {}, "outputs": [], "source": [ "###################\n", "# Single feedline #\n", "###################\n", "\n", "# Driven Lauchpad 1\n", "x = \"-0.5mm\"\n", "y = \"0.5mm\"\n", "launch_options = dict(\n", " chip=\"main\", pos_x=x, pos_y=y, orientation=\"360\", lead_length=\"30um\"\n", ")\n", "LP1 = LaunchpadWirebondDriven(design, \"LP1\", options=launch_options)\n", "\n", "# Driven Launchpad 2\n", "x = \"0.5mm\"\n", "y = \"0.5mm\"\n", "launch_options = dict(\n", " chip=\"main\", pos_x=x, pos_y=y, orientation=\"180\", lead_length=\"30um\"\n", ")\n", "LP2 = LaunchpadWirebondDriven(design, \"LP2\", options=launch_options)\n", "\n", "# coupling resonator to feedline\n", "q_read = CoupledLineTee(\n", " design,\n", " \"Q_Read_T\",\n", " options=dict(\n", " pos_x=\"0.0mm\",\n", " pos_y=\"0.5mm\",\n", " orientation=\"0\",\n", " coupling_space=\"6um\",\n", " coupling_length=\"300um\",\n", " open_termination=False,\n", " ),\n", ")\n", "\n", "\n", "gui.rebuild()" ] }, { "cell_type": "code", "execution_count": null, "id": "239f2d12", "metadata": {}, "outputs": [], "source": [ "# Using path finder to connect the two launchpads\n", "TL_LP1_T = RoutePathfinder(\n", " design,\n", " \"TL_LP1_T\",\n", " options=dict(\n", " chip=\"main\",\n", " trace_width=\"10um\",\n", " trace_gap=\"6um\",\n", " fillet=\"99um\",\n", " hfss_wire_bonds=True,\n", " lead=dict(end_straight=\"0.1mm\"),\n", " pin_inputs=Dict(\n", " start_pin=Dict(component=\"LP1\", pin=\"tie\"),\n", " end_pin=Dict(component=\"Q_Read_T\", pin=\"prime_start\"),\n", " ),\n", " ),\n", ")\n", "\n", "TL_T_LP2 = RoutePathfinder(\n", " design,\n", " \"TL_T_LP2\",\n", " options=dict(\n", " chip=\"main\",\n", " trace_width=\"10um\",\n", " trace_gap=\"6um\",\n", " fillet=\"99um\",\n", " hfss_wire_bonds=True,\n", " lead=dict(end_straight=\"0.1mm\"),\n", " pin_inputs=Dict(\n", " start_pin=Dict(component=\"Q_Read_T\", pin=\"prime_end\"),\n", " end_pin=Dict(component=\"LP2\", pin=\"tie\"),\n", " ),\n", " ),\n", ")\n", "# # Rebuild the GUI" ] }, { "cell_type": "code", "execution_count": null, "id": "92b1570a", "metadata": {}, "outputs": [], "source": [ "######################\n", "# lambda/4 resonator #\n", "######################\n", "\n", "# First we define the two end-points\n", "otg = OpenToGround(\n", " design,\n", " \"otg\",\n", " options=dict(chip=\"main\", pos_x=\"0.0mm\", pos_y=\"-0.7mm\", orientation=\"-90\"),\n", ")\n", "\n", "# Use RouteMeander to fix the total length of the resonator\n", "rt_meander = RouteMeander(\n", " design,\n", " \"meander\",\n", " Dict(\n", " trace_width=\"10um\",\n", " trace_gap=\"6um\",\n", " total_length=\"3.7mm\",\n", " hfss_wire_bonds=True,\n", " fillet=\"99 um\",\n", " lead=dict(start_straight=\"250um\"),\n", " pin_inputs=Dict(\n", " start_pin=Dict(component=\"otg\", pin=\"open\"),\n", " end_pin=Dict(component=\"Q_Read_T\", pin=\"second_end\"),\n", " ),\n", " ),\n", ")\n", "\n", "# rebuild the GUI\n", "gui.rebuild()" ] }, { "cell_type": "code", "execution_count": null, "id": "9956dd38", "metadata": {}, "outputs": [], "source": [ "gui.autoscale()\n", "gui.screenshot()" ] }, { "cell_type": "markdown", "id": "7070c19a", "metadata": {}, "source": [ "## Perfoming Eigenmode Simulation" ] }, { "cell_type": "code", "execution_count": null, "id": "5691146b", "metadata": {}, "outputs": [], "source": [ "from qiskit_metal.analyses.quantization import EPRanalysis\n", "\n", "eig_qb = EPRanalysis(design, \"hfss\")\n", "hfss = eig_qb.sim.renderer\n", "hfss.start()" ] }, { "cell_type": "code", "execution_count": null, "id": "4cfc6a55", "metadata": {}, "outputs": [], "source": [ "em_p = eig_qb.sim.setup\n", "em_p.name = \"HangerReso\"\n", "em_p.min_freq_ghz = 1\n", "em_p.n_modes = 1\n", "em_p.max_passes = 15\n", "em_p.max_delta_f = 0.1\n", "em_p.min_converged = 2\n", "em_p.basis_order = 2\n", "# Design variables can also be added in for direct simulation sweeps.\n", "em_p.vars = Dict({\"Lj\": \"0nH\", \"Cj\": \"0 fF\"})" ] }, { "cell_type": "code", "execution_count": null, "id": "bf6b16cf", "metadata": {}, "outputs": [], "source": [ "eig_qb.sim._render(\n", " name=\"HangerReso\",\n", " selection=[],\n", " solution_type=\"eigenmode\",\n", " vars_to_initialize=em_p.vars,\n", " open_pins=[],\n", " port_list=[(\"LP1\", \"in\", \"50\"), (\"LP2\", \"in\", \"50\")],\n", " box_plus_buffer=False,\n", ")" ] }, { "cell_type": "code", "execution_count": null, "id": "cb9ff9d6", "metadata": {}, "outputs": [], "source": [ "eig_qb.sim._analyze()" ] }, { "cell_type": "code", "execution_count": null, "id": "cc603fb5-0225-423d-840b-a3d69800e5c3", "metadata": {}, "outputs": [], "source": [ "eig_qb.sim.plot_convergences()" ] }, { "cell_type": "code", "execution_count": null, "id": "743ea460-d3f6-4e9a-b832-0ebc5c76a439", "metadata": {}, "outputs": [], "source": [ "# eig_qb.sim.save_screenshot() #optional" ] }, { "cell_type": "code", "execution_count": null, "id": "0f91c976", "metadata": {}, "outputs": [], "source": [ "eig_qb.get_frequencies()" ] }, { "cell_type": "code", "execution_count": null, "id": "d8d20499", "metadata": {}, "outputs": [], "source": [ "hfss.close()" ] }, { "cell_type": "code", "execution_count": null, "id": "8e116383", "metadata": {}, "outputs": [], "source": [ "# Data obtained during testing\n", "# Data ANSYS:\n", "# Mesh Size = 50um, Q = 18875, f = 7.3167\n", "# Mesh Size = 15um, Q = 4269, f = 7.3031\n", "# Mesh Size = 7um, Q = 14943, f = 7.3316\n", "# Data COMSOL:\n", "# Mesh = Normal, Q = 18858, f = 7.1315\n", "# Mesh = Fine, Q = 18584, f = 7.1176\n", "# Mesh = Finer, Q = 17042, f = 7.1426\n", "# Mesh = Extra Fine, Q = 16986, f = 7.2079\n", "# Mesh = Extremely Fine, Q = 14591, f = 7.2092" ] } ], "metadata": { "interpreter": { "hash": "02a7f130499a2b83a6c839d5429524d9237546653577440f6602b9b30b8b4215" }, "kernelspec": { "display_name": "pas_p310_ker", "language": "python", "name": "pas_p310_ker" }, "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.10.4" }, "latex_envs": { "LaTeX_envs_menu_present": true, "autoclose": false, "autocomplete": true, "bibliofile": "biblio.bib", "cite_by": "apalike", "current_citInitial": 1, "eqLabelWithNumbers": true, "eqNumInitial": 1, "hotkeys": { "equation": "Ctrl-E", "itemize": "Ctrl-I" }, "labels_anchors": false, "latex_user_defs": false, "report_style_numbering": false, "user_envs_cfg": false }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 5 }