Created
October 14, 2023 05:20
-
-
Save loganbvh/cc5453195153f7b5831ea95174b4091f to your computer and use it in GitHub Desktop.
superscreen-demo.ipynb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"provenance": [], | |
"authorship_tag": "ABX9TyPVHwkJ1r8APnwzQCovDaRA", | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/loganbvh/cc5453195153f7b5831ea95174b4091f/superscreen-demo.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"id": "03JWnsIHnHkz" | |
}, | |
"outputs": [], | |
"source": [ | |
"%pip install --quiet superscreen" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"%config InlineBackend.figure_formats = {\"retina\", \"png\"}\n", | |
"%matplotlib inline\n", | |
"\n", | |
"import superscreen as sc\n", | |
"from superscreen.geometry import box" | |
], | |
"metadata": { | |
"id": "enLEAMbfnJY0" | |
}, | |
"execution_count": 2, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"sc.version_table()" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 275 | |
}, | |
"id": "yo89z9gSnc28", | |
"outputId": "cbfdc2e8-c0c9-4e69-d73d-a2cdee772caa" | |
}, | |
"execution_count": 3, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
], | |
"text/html": [ | |
"<table><tr><th>Software</th><th>Version</th></tr><tr><td>SuperScreen</td><td>0.10.4</td></tr><tr><td>Numpy</td><td>1.23.5</td></tr><tr><td>Numba</td><td>0.56.4</td></tr><tr><td>SciPy</td><td>1.11.3</td></tr><tr><td>matplotlib</td><td>3.7.1</td></tr><tr><td>IPython</td><td>7.34.0</td></tr><tr><td>Python</td><td>3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]</td></tr><tr><td>OS</td><td>posix [linux]</td></tr><tr><td>Number of CPUs</td><td>Physical: 1, Logical: 2</td></tr><tr><td>BLAS Info</td><td>OPENBLAS</td></tr><tr><td colspan='2'>Sat Oct 14 05:17:56 2023 UTC</td></tr></table>" | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 3 | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"length_units = \"um\"\n", | |
"# Material parameters\n", | |
"london_lambda = 5\n", | |
"d = 0.2\n", | |
"layers = [sc.Layer(\"base\", london_lambda=london_lambda, thickness=d, z0=0)]\n", | |
"\n", | |
"# Device geometry\n", | |
"total_width = 5000\n", | |
"total_length = 5000\n", | |
"\n", | |
"films = [sc.Polygon(\"film\", layer=\"base\", points=box(total_width, total_length))]" | |
], | |
"metadata": { | |
"id": "VX5XGcGxnSDo" | |
}, | |
"execution_count": 4, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"device = sc.Device(\n", | |
" \"pure_square\",\n", | |
" layers=layers,\n", | |
" films=films,\n", | |
" length_units=length_units,\n", | |
")" | |
], | |
"metadata": { | |
"id": "LkQkT1RAnS3r" | |
}, | |
"execution_count": 5, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"device.make_mesh(max_edge_length=100)\n", | |
"fig, ax = device.plot_mesh(show_sites=False)\n", | |
"_ = device.plot_polygons(ax=ax, color=\"k\")" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 508 | |
}, | |
"id": "3RjdeUO4nS64", | |
"outputId": "98296ca2-2bb7-4be1-a48b-42baf9db1689" | |
}, | |
"execution_count": 6, | |
"outputs": [ | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/plain": [ | |
"<Figure size 640x480 with 1 Axes>" | |
], |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment