torax.plotting package

Submodules

torax.plotting.plotruns module

torax.plotting.plotruns_lib module

Utilities for plotting outputs of Torax runs.

class torax.plotting.plotruns_lib.FigureProperties(rows, cols, axes, figure_size_factor=5.0, tick_fontsize=10, axes_fontsize=10, title_fontsize=16, default_legend_fontsize=10, colors=('r', 'b', 'g', 'm', 'y', 'c'))[source]

Bases: object

Dataclass for all figure related data.

Parameters:
property contains_spatial_plot_type: bool

Checks if any plot is a spatial plottype.

class torax.plotting.plotruns_lib.PlotData(ti, te, ne, ni, nimp, zimp, psi, psidot, j, johm, j_bootstrap, j_ecrh, generic_current_source, external_current_source, q, s, chi_i, chi_e, d_e, v_e, q_icrh_i, q_icrh_e, q_gen_i, q_gen_e, q_ecrh, q_alpha_i, q_alpha_e, q_ohmic, q_brems, q_cycl, q_ei, q_rad, Q_fusion, s_puff, s_generic, s_pellet, i_total, i_bootstrap, i_generic, i_ecrh, p_auxiliary, p_ohmic, p_alpha, p_sink, p_brems, p_cycl, p_rad, t, rho_cell_coord, rho_face_coord, te_volume_avg, ti_volume_avg, ne_volume_avg, ni_volume_avg, W_thermal_tot, q95)[source]

Bases: object

Dataclass for all plot related data.

ti

Ion temperature profile [\(\mathrm{keV}\)] on the cell grid.

te

Electron temperature profile [\(\mathrm{keV}\)] on the cell grid.

ne

Electron density profile [\(\mathrm{10^{20} m^{-3}}\)] on the cell grid.

ni

Main ion density profile [\(\mathrm{10^{20} m^{-3}}\)] on the cell grid. Corresponds to an bundled ion mixture if specified as such in the config.

nimp

Impurity density profile [\(\mathrm{10^{20} m^{-3}}\)] on the cell grid. Corresponds to an bundled ion mixture if specified as such in the config.

zimp

Average charge state of the impurity species [dimensionless] on the cell grid.

psi

Poloidal flux [\(\mathrm{Wb}\)] on the cell grid.

psidot

Time derivative of poloidal flux (loop voltage \(V_{loop}\)) [V] on the cell grid.

j

Total toroidal current density profile [\(\mathrm{MA/m^2}\)] on the cell grid.

johm

Ohmic current density profile [\(\mathrm{MA/m^2}\)] on the cell grid.

j_bootstrap

Bootstrap current density profile [\(\mathrm{MA/m^2}\)] on the cell grid.

j_ecrh

Electron cyclotron current density profile [\(\mathrm{MA/m^2}\)] on the cell grid.

generic_current_source

Generic external current source density profile [\(\mathrm{MA/m^2}\)] on the cell grid.

external_current_source

Total externally driven current source density profile [\(\mathrm{MA/m^2}\)] on the cell grid.

q

Safety factor (q-profile) [dimensionless] on the face grid.

s

Magnetic shear profile [dimensionless] on the face grid.

chi_i

Ion heat conductivity [\(\mathrm{m^2/s}\)] on the face grid.

chi_e

Electron heat conductivity [\(\mathrm{m^2/s}\)] on the face grid.

d_e

Electron particle diffusivity [\(\mathrm{m^2/s}\)] on the face grid.

v_e

Electron particle convection velocity [\(\mathrm{m/s}\)] on the face grid.

q_icrh_i

ICRH ion heating power density [\(\mathrm{MW/m^3}\)].

q_icrh_e

ICRH electron heating power density [\(\mathrm{MW/m^3}\)].

q_gen_i

Generic ion heating power density [\(\mathrm{MW/m^³}\)].

q_gen_e

Generic electron heating power density [\(\mathrm{MW/m^3}\)].

q_ecrh

Electron cyclotron heating power density [\(\mathrm{MW/m^3}\)].

q_alpha_i

Fusion alpha particle heating power density to ion [\(\mathrm{MW/m^3}\)].

q_alpha_e

Fusion alpha particle heating power density to electrons [\(\mathrm{MW/m^3}\)].

q_ohmic

Ohmic heating power density [\(\mathrm{MW/m^3}\)].

q_brems

Bremsstrahlung radiation power density [\(\mathrm{MW/m^3}\)].

q_cycl

Cyclotron radiation power density [\(\mathrm{MW/m^3}\)].

q_ei

Ion-electron heat exchange power density [\(\mathrm{MW/m^3}\)]. Positive values denote ion heating, and negative values denote ion cooling (electron heating).

q_rad

Impurity radiation power density [\(\mathrm{MW/m^3}\)].

Q_fusion

Fusion power gain (dimensionless).

s_puff

Gas puff particle source density [\(\mathrm{10^{20} m^{-3} s^{-1}}\)].

s_generic

Generic particle source density [\(\mathrm{10^{20} m^{-3} s^{-1}}\)].

s_pellet

Pellet particle source density [\(\mathrm{10^{20} m^{-3} s^{-1}}\)].

i_total

Total plasma current [\(\mathrm{MA}\)].

i_bootstrap

Total bootstrap current [\(\mathrm{MA}\)].

i_generic

Total generic current source [\(\mathrm{MA}\)].

i_ecrh

Total electron cyclotron current [\(\mathrm{MA}\)].

p_auxiliary

Total auxiliary heating power [\(\mathrm{MW}\)].

p_ohmic

Total Ohmic heating power [\(\mathrm{MW}\)].

p_alpha

Total fusion alpha heating power [\(\mathrm{MW}\)].

p_sink

Total electron heating sink [\(\mathrm{MW}\)].

p_brems

Total bremsstrahlung radiation power loss [\(\mathrm{MW}\)].

p_cycl

Total cyclotron radiation power loss [\(\mathrm{MW}\)].

p_rad

Total impurity radiation power loss [\(\mathrm{MW}\)].

t

Simulation time [\(\mathrm{s}\)].

rho_cell_coord

Normalized toroidal flux coordinate on the cell grid.

rho_face_coord

Normalized toroidal flux coordinate on the face grid.

te_volume_avg

Volume-averaged electron temperature [\(\mathrm{keV}\)].

ti_volume_avg

Volume-averaged ion temperature [\(\mathrm{keV}\)].

ne_volume_avg

Volume-averaged electron density [\(\mathrm{10^{20} m^{-3}}\)].

ni_volume_avg

Volume-averaged ion density [\(\mathrm{10^{20} m^{-3}}\)].

W_thermal_tot

Total thermal stored energy [\(\mathrm{MJ}\)].

q95

Safety factor at 95% of the normalized poloidal flux.

Parameters:
class torax.plotting.plotruns_lib.PlotProperties(attrs, labels, ylabel, legend_fontsize=None, upper_percentile=100.0, lower_percentile=0.0, include_first_timepoint=True, ylim_min_zero=True, plot_type=PlotType.SPATIAL, suppress_zero_values=False)[source]

Bases: object

Dataclass for individual plot properties.

Parameters:
class torax.plotting.plotruns_lib.PlotType(value)[source]

Bases: Enum

Enum for plot types.

SPATIAL: Spatial plots, e.g., 1D profiles as a function of toroidal flux coordinate. Plots change with time, and are modified by the slider. TIME_SERIES: Time series plots. 0D profiles plotting as a function of time. These plots are not modified by the slider.

torax.plotting.plotruns_lib.create_figure(plot_config)[source]

Creates the figure and axes.

Parameters:

plot_config (FigureProperties)

torax.plotting.plotruns_lib.create_slider(ax, plotdata1, plotdata2=None)[source]

Create a slider tool for the plot.

Parameters:
Return type:

Slider

torax.plotting.plotruns_lib.format_plots(plot_config, plotdata1, plotdata2, axes)[source]

Sets up plot formatting.

Parameters:
torax.plotting.plotruns_lib.get_lines(plot_config, plotdata, axes, comp_plot=False)[source]

Gets lines for all plots.

Parameters:
torax.plotting.plotruns_lib.get_rho(plotdata, data_attr)[source]

Gets the correct rho coordinate for the data.

Parameters:
Return type:

ndarray

torax.plotting.plotruns_lib.load_data(filename)[source]

Loads an xr.Dataset from a file, handling potential coordinate name changes.

Parameters:

filename (str)

Return type:

PlotData

torax.plotting.plotruns_lib.plot_run(plot_config, outfile, outfile2=None)[source]

Plots a single run or comparison of two runs.

Parameters:

torax.plotting.plotruns_lib_test module

Unit tests for torax.plotting.plotruns_lib.

class torax.plotting.plotruns_lib_test.PlotrunsLibTest(*args, **kwargs)[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

Module contents

This package contains functionality related to plotting.