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:
- 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.
- class hypnotoad.core.equilibrium.FineContour
High-resolution representation of a contour of constant \(\psi\).
Each
FineContour
belongs to aPsiContour
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 thefinecontour_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 parentPsiContour
can be placed at specified poloidal locations along the contour.
- 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 ofMeshRegion
objects.
- 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
ofEquilibriumRegion
objects).Developers, see Equilibrium implementations.
- 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 otherMeshRegion
. TheMeshRegion
includes points on the boundary, whose positions are shared with the boundary points of the neighbouringMeshRegion
, 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.
- class hypnotoad.core.mesh.Mesh
Collection of MeshRegion objects representing the entire grid.
- 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).