{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 7 - MHD equilibria\n", "\n", "This tutorial provides access to the Struphy MHD equilibrium interface. We shall plot some available equilibria, in particular:\n", "\n", "* `ScrewPinch`\n", "* `AdhocTorus`\n", "* `EQDSKequilibrium`\n", "* `GVECequilibrium`\n", "* `DESCequilibrium`\n", "\n", "The first three are sub-classes of `CartesianMHDequilibrium`, where the developer has to provide Cartesian components of equilibrium variables like $\\mathbf B(x, y, z)$ and $\\mathbf J(x, y, z)$. Such equilibria work with any of the available `Struphy domains`, and the user has to specify the particular domain (mapping) he intends to use.\n", "\n", "The last two are sub-classes of `LogicalMHDequilibrium`, where the developer has to provide the covariant components $\\hat{\\mathbf B}^1(\\eta_1, \\eta_2, \\eta_3)$, $\\hat{\\mathbf J}^1(\\eta_1, \\eta_2, \\eta_3)$, as well as the mapping to Cartesian coordinates. These equilibria work only with the provided mapping, hence the mapping cannot be set by the user." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "\n", "from struphy import equils\n", "from struphy import domains" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## ScrewPinch" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mhd_equil = equils.ScrewPinch(R0=1.0)\n", "mhd_equil.domain = domains.HollowCylinder(a1=1e-8, a2=1, Lz=2 * np.pi)\n", "mhd_equil.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## AdHocTorus" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mhd_equil = equils.AdhocTorus()\n", "mhd_equil.domain = domains.HollowTorus(a1=1e-8, tor_period=1)\n", "mhd_equil.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## EQDSK" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mhd_equil = equils.EQDSKequilibrium()\n", "mhd_equil.domain = domains.Tokamak(equilibrium=mhd_equil)\n", "mhd_equil.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## GVEC" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mhd_equil = equils.GVECequilibrium(use_nfp=False)\n", "mhd_equil.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## DESC" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%capture\n", "mhd_equil = equils.DESCequilibrium(use_nfp=False)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "mhd_equil.show()" ] } ], "metadata": { "kernelspec": { "display_name": "env (3.12.3)", "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": 4 }