4. Hypnotoad classes

This section gives a brief overview of the classes defined by hypnotoad.

For illustration in the figures we use a connected double null equilibrium:

Connected double null grid

A coarse grid for a connected double null case. Thin gray lines are flux surfaces, the thick black line is the wall.

class hypnotoad.core.equilibrium.PsiContour

A piece of a flux surface (on the R-Z plane), i.e. a contour at constant poloidal magnetic flux function \(\psi\).

Contains a set of points lying on the contour. These will represent points belonging to the generated grid.

PsiContour

The points in an example PsiContour. This one is in the outer lower divertor leg.

class hypnotoad.core.equilibrium.FineContour

High-resolution representation of a contour of constant \(\psi\).

Each FineContour belongs to a PsiContour and provides a high resolution representation of the contour, which does not depend on the grid settings: points in a FineContour are uniformly spaced in poloidal distance along the contour; and the number of points is set by the finecontour_Nfine setting, which should be significantly higher than the number of points in the y-direction in any region of the grid.

The FineContour provides a robust calculation of the poloidal distance along a contour, and provides accurate interpolation functions so that points belonging to the parent PsiContour can be placed at specified poloidal locations along the contour.

FineContour

The points in an example FineContour (blue dots, each dot is a point on the FineContour). Also shown is the associated PsiContour (red crosses).

class hypnotoad.core.equilibrium.EquilibriumRegion

One part of the poloidal split of the equilibrium into distinct regions.

Inherits from PsiContour as it represents a line on the R-Z plane, normally a part of a separatrix). In diverted tokamak configurations one or both ends are at an X-point.

Contains the connections to other EquilibriumRegion objects of different radial segments of the region.

Used as the starting point to generate the PsiContours that eventually fill the region as part of MeshRegion objects.

EquilibriumRegion

The points in an example EquilibriumRegion. This one represents the outer core.

class hypnotoad.core.equilibrium.Equilibrium

The magnetic equilibrium and topology.

Provides functions (usually created by interpolating) that give the poloidal magnetic flux function \(\psi\), components of the magnetic field, etc. at any point.

Contains information about the topology (e.g. position of X-points), and the regions to be gridded (as an OrderedDict of EquilibriumRegion objects).

Developers, see Equilibrium implementations.

Equilibrium

An Equilibrium contains a set of EquilibriumRegion objects.

class hypnotoad.cases.tokamak.TokamakEquilibrium

Axisymmetric tokamak equilibrium

Implements Equilibrium.

Finds the central O-point of the equilibrium, and the X-points. Creates EquilibriumRegion objects for the core (separate outer and inner for double null configurations) and divertor legs.

class hypnotoad.core.mesh.MeshRegion

Collection of PsiContour objects representing a logically rectangular sub-region of the grid.

Each side of the MeshRegion is either a grid boundary or connects to one other MeshRegion. The MeshRegion includes points on the boundary, whose positions are shared with the boundary points of the neighbouring MeshRegion, if there is one.

Includes methods for calculating R-Z positions, magnetic field, and geometric quantities (for the standard BOUT++ locally field aligned coordinate system) on the points in the MeshRegion.

Developers, see MeshRegion notes.

MeshRegion

The points in an example MeshRegion. This one represents the inner core inside the separatrix.

class hypnotoad.core.mesh.Mesh

Collection of MeshRegion objects representing the entire grid.

Mesh

The Mesh is a collection of MeshRegion objects.

class hypnotoad.core.mesh.BoutMesh

Implementation of Mesh for BOUT++ grids.

Handles writing of the grid file in the format expected by BOUT++, including creation of global arrays collected from the sub-regions contained in the MeshRegion objects.

BoutMesh requires that the MeshRegion members fit together into a global logically-rectangular Mesh, with one of the topologies supported by BOUT++ (slab, limiter, single null, connected double null, or disconnected double null).