10. Plotting and other utilities

10.1. hypnotoad-plot-equilibrum

Plot the equilibrium stored in a geqdsk file

usage: hypnotoad-plot-equilibrium [-h] [--wall] [--wall-width WALL_WIDTH]
                                  [--separatrix] [--separate-separatrices]
                                  [--separatrix-color [SEPARATRIX_COLOR ...]]
                                  [--psi-labels] [--n-points N_POINTS]
                                  [--n-contours N_CONTOURS] [--color-contours]
                                  [--highlight-region HIGHLIGHT_REGION HIGHLIGHT_REGION]
                                  [--highlight-color HIGHLIGHT_COLOR]
                                  [--no-show] [--output OUTPUT]
                                  equilibrium_file

Positional Arguments

equilibrium_file

Path to equilibrium file in geqdsk format

Named Arguments

--wall

Plot the wall contour if present

Default: True

--wall-width

Width of the wall contour and separatrix contour

Default: 2.0

--separatrix

Plot the separatrix. Note that for a disconnected double-null equilibrium, the thing plotted by default is not really the separatrix, as around the core the contour is a weighted average of the two separatrices constructed so that it joins the two X-points, while in the divertor legs it is the separatrix connected to the nearest X-point.

Default: True

--separate-separatrices

Plot the two separatrices separately for a disconnected double-null equilibrium.

Default: False

--separatrix-color

Color (or list of colors) for the separatrix contour(s)

Default: “blue”

--psi-labels

Label psi contours

Default: False

--n-points

Number points to use for interpolated array of psi values

Default: 100

--n-contours

Number of psi contours to plot

Default: 40

--color-contours

Color psi contours

Default: False

--highlight-region

Highlight a region between the two values of normalised psi given by the arguments to this flag.

--highlight-color

Color to use for region highlighted by –hilight-region

Default: “orange”

--no-show

Do not show plot in interactive window

Default: True

--output

Name for output file. Suffix determines file format

10.2. hypnotoad-plot-grid-cells

Script to plot grid cells for a BOUT++ grid, using the corner positions saved by hypnotoad.

The CELL_CENTRE positions are shown in the plot as black dots, the cells are shown by joining the corners with black lines. The branch cuts (if shown) are thick red lines.

usage: hypnotoad-plot-grid-cells [-h] [--mxg [MXG]] [--branch-cuts]
                                 [--separatrix] [--targets]
                                 [--save-as SAVE_AS] [--no-show]
                                 gridfile

Positional Arguments

gridfile

Path to the grid file to plot grid cells from

Named Arguments

--mxg

Number of boundary cells at x-boundaries (default 2)

Default: 2

--branch-cuts

Highlight the branch cuts?

Default: False

--separatrix

Highlight the separatrix/separatrices?

Default: False

--targets

Highlight the targets?

Default: False

--save-as

Filename to save plot to, suffix gives type of file

--no-show

Skip showing the plot in a window?

Default: False

10.3. hypnotoad-get-flux-surfaces

Script to get flux surfaces from the equilibrium in a geqdsk file, using hypnotoad.

Flux surfaces are saved as a dimension (N,2) array where N is the number of points used to represent the flux surface. N will vary depending which region (core, SOL, PFR, etc.) the surface belongs to. All flux surfaces are saved into the flux surfaces group in the output file. The wall contour is also saved, as the variable wall in the root group.

Options that can be set in the input file to control outputs of this script:

  • finecontour_Nfine - number of points on each flux surface will be 1, 2 or 3 times this.

  • number_of_processors - this many processors will be used to parallelise some computations

  • nx_core - Number of radial points in the core

  • nx_inter_sep - Number of radial points in the inter-separatrix region

  • nx_pf - Number of radial points in the PF region Note: Currently can’t be varied due to BOUT++ limitations

  • nx_sol - Number of radial points in the SOL

  • nx_sol_inner - Number of radial points in the outer SOL. Note: Currently can’t be varied due to BOUT++ limitations

  • nx_sol_outer - Number of radial points in the inner SOL. Note: Currently can’t be varied due to BOUT++ limitations

  • psinorm_core - Normalised psi of the inner radial (core) boundary

  • psinorm_sol - Normalised psi of the outer radial (SOL) boundary

  • psinorm_sol_inner - Normalised psi of the outer radial boundary in the inner SOL

  • psinorm_pf - Normalised psi of the inner radial boundary in the PFR

  • psinorm_pf_lower - Normalised psi of the inner radial boundary in the lower PFR

  • psinorm_pf_upper - Normalised psi of the inner radial boundary in the upper PFR

  • psi_core - Unnormalised poloidal flux value at the core boundary, used in mesh generation. Overrides psinorm_core if this value is given, if the option is none, then calculated from psinorm_core

  • psi_sol - Unnormalised poloidal flux value at the SOL boundary, used in mesh generation. Overrides psinorm_sol if this value is given, if the option is none, then calculated from psinorm_sol

  • psi_sol_inner - Unnormalised poloidal flux value at the inner SOL boundary, used in mesh generation. Overrides psinorm_sol_inner if this value is given, if the option is none, then calculated from psinorm_sol_inner

  • psi_pf_lower - Unnormalised poloidal flux value at the lower PFR boundary, used in mesh generation. Overrides psinorm_pf_lower if this value is given, if the option is none, then calculated from psinorm_pf_lower

  • psi_pf_upper - Unnormalised poloidal flux value at the upper PFR boundary, used in mesh generation. Overrides psinorm_pf_upper if this value is given, if the option is none, then calculated from psinorm_pf_upper

  • psi_spacing_separatrix_multiplier - Factor modifying radial spacing at separatrics: <1 to make points closer, >1 to make points further apart

usage: hypnotoad-get-flux-surfaces [-h] [-o OUTPUT] [-p] [-s SAVE_PLOT]
                                   geqdsk settings

Positional Arguments

geqdsk

geqdsk file - contains magnetic equilibrium data

settings

YAML file with settings controlling generated flux surfaces

Named Arguments

-o, --output

Filename for flux surfaces output.

Default: “flux_surfaces.nc”

-p, --plot

Make a plot of the flux surfaces that are being written.

Default: False

-s, --save-plot

File name for a plot of the flux surfaces that are being written.