pyrokinetics.equilibrium.flux_surface.FluxSurface#
- class pyrokinetics.equilibrium.flux_surface.FluxSurface(R, Z, B_poloidal, R_major, r_minor, Z_mid, F, FF_prime, p, q, magnetic_shear, shafranov_shift, midplane_shift, pressure_gradient, psi_gradient, a_minor)[source]#
Bases:
DatasetWrapperInformation about a single flux surface of a tokamak plasma equilibrium. Users are not expected to initialise
FluxSurfaceobjects directly, but instead should generate them fromEquilibriumobjects.FluxSurfaceis used as an intermediate object when generatingLocalGeometryobjects from global plasma equilibria. For more information, see the ‘Notes’ section forEquilibrium.- Parameters:
R (
ArrayLike,units [meter]) – 1D grid of major radius coordinates describing the path of the flux surface. The endpoints should be repead.Z (
ArrayLike,units [meter]) – 1D grid of tokamak Z-coordinates describing the path of the flux surface. This is usually the height above the plasma midplane, but Z=0 may be set at any reference point. Should have same length asR, and the endpoints should be repeated.B_poloidal (
ArrayLike,units [tesla]) – 1D grid of the magnitude of the poloidal magnetic field following the path described by R and Z. Should have the same length asR.R_major (
float,units [meter]) – The major radius position of the center of each flux surface. This should be given by the mean of the maximum and minimum major radii of the flux surface.r_minor (
float,units [meter]) – The minor radius of the flux surface. This should be half of the difference between the maximum and minimum major radii of the flux surface.Z_mid (
float,units [meter]) – The z-midpoint of the flux surface. This should be the mean of the maximum and minimum z-positions of the flux surface.F (
float,units [meter * tesla]) – The poloidal current function.FF_prime (
float,units [meter**2 * tesla**2 / weber]) – 1D grid defining the poloidal current functionfmultiplied by its derivative with respect topsi. Should have the same length aspsi.p (
float,units [pascal]) – Plasma pressure.q (
float,units [dimensionless]) – The safety factor.magnetic_shear (
float,units [dimensionless]) – Defined as \(\frac{r}{q}\frac{dq}{dr}\), where \(r\) is the minor radius and \(q\) is the safety factor.shafranov_shift (
float,units [dimensionless]) – The derivative ofR_majorwith respect tor_minormidplane_shift (
float,units [dimensionless]) – The derivative ofZ_midwith respect tor_minorpressure_gradient (
float,units [pascal / meter]) – The derivative of pressure with respect tor_minor.psi_gradient (
float,units [weber / meter]) – The derivative of the poloidal magnetic flux function \(\psi\) with respect tor_minor.a_minor (
float,units [meter]) – The minor radius of the last closed flux surface (LCFS). Though not necessarily applicable to this flux surface, a_minor is often used as a reference length in gyrokinetic simulations.
- data#
The internal representation of the
FluxSurfaceobject. The function__getitem__redirects indexing lookups here, but the Dataset itself may be accessed directly by the user if they wish to perform more complex actions.- Type:
See also
EquilibriumObject representing a global equilibrium.
- __init__(R, Z, B_poloidal, R_major, r_minor, Z_mid, F, FF_prime, p, q, magnetic_shear, shafranov_shift, midplane_shift, pressure_gradient, psi_gradient, a_minor)[source]#
Methods
__init__(R, Z, B_poloidal, R_major, r_minor, ...)from_netcdf(path, *args[, ...])Initialise self.data from a netCDF file.
plot(quantity[, ax, show, x_label, y_label])Plot a quantity defined on the \(\theta\) grid.
plot_path([ax, aspect, show, x_label, y_label])Plot the path of the flux surface in \((R, Z)\) coordinates.
to_netcdf(*args, **kwargs)Writes self.data to disk.
Attributes
attrsRedirects to underlying Xarray Dataset attrs.
coordsRedirects to underlying Xarray Dataset coords.
Property for managing the underlying Xarray Dataset.
data_varsRedirects to underlying Xarray Dataset data_vars.
dimsRedirects to underlying Xarray Dataset dims.
sizesRedirects to underlying Xarray Dataset sizes.
- plot(quantity, ax=None, show=False, x_label=None, y_label=None, **kwargs)[source]#
Plot a quantity defined on the \(\theta\) grid. These include
R,Z, andB_poloidal.- Parameters:
quantity (
str) – Name of the quantity to plot. Must be defined over the gridtheta.ax (
Optional[plt.Axes]) – Axes object on which to plot. If not provided, a new figure is created.show (
bool, defaultFalse) – Immediately show Figure after creation.x_label (
Optional[str], defaultNone) – Overwrite the default x label. Set to an empty string""to disable.y_label (
Optional[str], defaultNone) – Overwrite the default y label. Set to an empty string""to disable.**kwargs – Additional arguments to pass to Matplotlib’s
plotcall.
- Returns:
The Axes object created after plotting.
- Return type:
plt.Axes- Raises:
ValueError – If
quantityis not a quantity defined over the \(\theta\) grid, or is not the name of a FluxSurface quantity.
- plot_path(ax=None, aspect=False, show=False, x_label=None, y_label=None, **kwargs)[source]#
Plot the path of the flux surface in \((R, Z)\) coordinates.
- Parameters:
ax (
Optional[plt.Axes]) – Axes object on which to plot. If not provided, a new figure is created.aspect (
bool, defaultFalse) – If True, ensures the axes have the correct aspect ratio. If the user supplies their ownax, has no effect.show (
bool, defaultFalse) – Immediately show Figure after creation.x_label (
Optional[str], defaultNone) – Overwrite the default x label. Set to an empty string""to disable.y_label (
Optional[str], defaultNone) – Overwrite the default y label. Set to an empty string""to disable.**kwargs – Additional arguments to pass to Matplotlib’s
plotcall.
- Returns:
The Axes object created after plotting.
- Return type:
plt.Axes