Optimised stellarators poster
A three-column A0 landscape poster on optimised stellarators, from the equilibria that
DESC <https://desc-docs.readthedocs.io/>_ ships: W7-X, the precise quasi-axisymmetric and
quasi-helical configurations, NCSX, HELIOTRON, ESTELL and the tokamak DSHAPE.
plasma-plots <https://max-models.github.io/plasma-plots/>_ evaluates them (from_desc) and
draws W7-X in 3-D (|B| cut open, with PyVista), the poloidal planes of
the others, |B| on the boundary in PEST angles and W7-X’s profiles. It needs
pip install desc-opt and PyVista.
Python source
Section titled “Python source”"""Optimised stellarators poster.
A three-column A0 landscape poster on optimised stellarators, from the equilibria that`DESC <https://desc-docs.readthedocs.io/>`_ ships: W7-X, the precise quasi-axisymmetric andquasi-helical configurations, NCSX, HELIOTRON, ESTELL and the tokamak DSHAPE.`plasma-plots <https://max-models.github.io/plasma-plots/>`_ evaluates them (``from_desc``) anddraws W7-X in 3-D (``|B|`` cut open, with PyVista), the poloidal planes ofthe others, ``|B|`` on the boundary in PEST angles and W7-X's profiles. It needs``pip install desc-opt`` and PyVista."""
import warningsfrom pathlib import Path
import desc.examplesimport matplotlib.pyplot as pltimport numpy as npimport plasma_plotsimport pyvista as pvfrom plasma_plots import save_figure
from plasma_posters import Poster, preview
HERE = Path(__file__).resolve().parentwarnings.filterwarnings("ignore", module="desc") # DESC's notes on JAX and resolutionspv.OFF_SCREEN = True # the 3-D views are rendered without a window
def example(name): """One of DESC's example equilibria.""" with warnings.catch_warnings(): warnings.simplefilter("ignore") return desc.examples.get(name)
# --- W7-X in 3-D: |B| cut open; its profiles -------------------------------w7x = example("W7-X")torus = plasma_plots.from_desc( w7x, "|B|", rho=9, theta=48, zeta=np.linspace(0, 2 * np.pi, 32 * w7x.NFP, endpoint=False),)
def render(plotter, path, zoom=1.2): """A PNG of a PyVista scene, seen from above at an angle.""" plotter.camera_position = "iso" plotter.reset_camera() plotter.camera.zoom(zoom) plasma_plots.scene(plotter, window_size=[1000, 700]).save_png(path) plotter.close()
render( torus["|B|"].plasma.plot.slices_3d( cuts={"rho": [0.5], "zeta": [0.0, np.pi / 2, np.pi]} ), HERE / "desc_w7x_3d.png", zoom=1.7,)
profiles = plasma_plots.from_desc(w7x, ["iota", "D_Mercier"], rho=17, theta=8, zeta=4)with plasma_plots.figure(1, 2, figsize=(7, 3)) as fig: profiles.iota.plasma.plot.lineout(rationals=4, ax=fig[0]) profiles.D_Mercier.sel(rho=slice(0.1, None)).plasma.plot.lineout(ax=fig[1])save_figure(fig, HERE / "desc_w7x_profiles", formats=("pdf",))
# --- DESC's example library at zeta = 0 -------------------------------------------------------gallery = ["precise_QA", "precise_QH", "NCSX", "HELIOTRON", "ESTELL", "DSHAPE"]with plasma_plots.figure(3, 2, figsize=(7, 10)) as fig: for ax, name in zip(fig, gallery, strict=True): plane = plasma_plots.from_desc( example(name), ["|B|", "theta_PEST"], rho=9, theta=64, zeta=[0.0] ) plane["|B|"].plasma.plot.slice( coords="physical", plane="RZ", zeta=0.0, title=name, overlays={"coordinate_lines": {"rho": 4, "theta_P": 8}}, ax=ax, )save_figure(fig, HERE / "desc_gallery", formats=("pdf",))
# --- quasi-symmetry: |B| on the boundary in PEST angles ---------------------------------------with plasma_plots.figure(2, 1, figsize=(6, 6.5)) as fig: for ax, name in zip(fig, ["precise_QA", "precise_QH"], strict=True): surface = plasma_plots.from_desc( example(name), "|B|", rho=[0.5, 1.0], theta=64, zeta=64, sfl="pest" ) surface["|B|"].plasma.plot.slice( x="zeta", y="theta_P", rho=1.0, levels=12, title=name, ax=ax )save_figure(fig, HERE / "desc_quasisymmetry", formats=("pdf",))plt.close("all")
# --- the poster -------------------------------------------------------------------------------poster = Poster( "Optimised stellarators from DESC", authors="Max Lindqvist", institute="Max Planck Institute for Plasma Physics", orientation="landscape", columns=3,)poster.block( "Optimised stellarators", r""" A stellarator confines a plasma with twisted coils alone, without a plasma current. Its shape is chosen by optimisation: W7-X for small neoclassical transport, the precise configurations for quasi-symmetry, in which $|B|$ depends on one helical angle only. """,)poster.figure( "W7-X", "desc_w7x_3d.png", caption=r"$|B|$ on the flux surface $\rho = 0.5$, cut open at three toroidal angles.",)poster.figure( "DESC's example library", "desc_gallery.pdf", caption=r"$|B|$ on the poloidal plane $\zeta = 0$.", column=1,)poster.figure( "Quasi-symmetry", "desc_quasisymmetry.pdf", caption="$|B|$ on the boundary in PEST angles: its contours follow one direction.", column=2,)poster.figure( "W7-X profiles", "desc_w7x_profiles.pdf", caption=r"The rotational transform with its rationals, and the Mercier criterion.",)pdf = poster.build(HERE / "desc_poster.pdf")
# the poster, as the docs show itfig, ax = plt.subplots(figsize=(8.5, 6))ax.imshow(plt.imread(preview(pdf)))ax.set_axis_off()