Skip to content

NcGeometry

dexter.NcGeometry(path: str, interp1d_type: Interp1DType, interp2d_type: Interp2DType)

Object describing the general geometry of a numerical equilibrium.

Stores relates scalars and arrays, and provides interpolation methods for converting between different variables and coordinate systems.

Related quantities are computed by interpolating over the data arrays.

Parameters:

  • path (str) –

    The path to the NetCDF file.

  • interp1d_type (Interp1DType) –

    The type of 1D Interpolation.

  • interp2d_type (Interp2DType) –

    The type of 2D Interpolation.

Example
NcGeometry creation
>>> geometry = dex.NcGeometry(path, "Cubic", "Bicubic")

Methods:

Attributes:

  • psi_state (FluxState) –

    The state of the toroidal flux coordinate.

  • psip_state (FluxState) –

    The state of the poloidal flux coordinate.

  • path (str) –

    The path of the netCDF file.

  • netcdf_version (NetCDFVersion) –

    The netCDF convention version (SemVer).

  • equilibrium_type (EquilibriumType) –

    The object's equilibrium's type.

  • interp1d_type (str) –

    The 1D Interpolation type.

  • interp2d_type (str) –

    The 2D Interpolation type.

  • baxis (float) –

    The magnetic field strength on the magnetic axis \(B_0\) in \([T]\).

  • raxis (float) –

    The horizontal position of the magnetic axis \(R_0\) in \([m]\).

  • zaxis (float) –

    The vertical position of the magnetic axis in \([m]\).

  • rgeo (float) –

    The geometrical axis (device major radius) in \([m]\).

  • rlast (float) –

    The value of the \(r\) coordinate at the last closed flux surface \(r_{LCFS}\), in \([m]\).

  • shape (ArrayShape) –

    The shape of the 2 dimensional data arrays, as in \((len(\psi/\psi_p), len(\theta))\).

  • psi_last (float) –

    The value of the last closed toroidal flux surface \(\psi_{LCFS}\) in Normalized Units.

  • psip_last (float) –

    The value of the last closed poloidal flux surface \(\psi_{p,LCFS}\) in Normalized Units.

  • psi_array (Array1) –

    The NetCDF \(\psi\) data.

  • psip_array (Array1) –

    The NetCDF \(\psi_p\) data.

  • theta_array (Array1) –

    The NetCDF \(\theta\) data.

  • r_array (Array1) –

    The NetCDF \(r\) data.

  • rlab_array (Array2) –

    The NetCDF \(R_{lab}\) data array.

  • zlab_array (Array2) –

    The NetCDF \(Z_{lab}\) data array.

  • jacobian_array (Array2) –

    The Jacobian \(J\) data array.

  • rlab_last (Array1) –

    the last \(R_{lab}\) values that correspond to the device’s last closed flux surface.

  • zlab_last (Array1) –

    the last \(Z_{lab}\) values that correspond to the device’s last closed flux surface.

dexter.NcGeometry.psi_state: FluxState property

The state of the toroidal flux coordinate.

dexter.NcGeometry.psip_state: FluxState property

The state of the poloidal flux coordinate.

dexter.NcGeometry.path: str property

The path of the netCDF file.

dexter.NcGeometry.netcdf_version: NetCDFVersion property

The netCDF convention version (SemVer).

dexter.NcGeometry.equilibrium_type: EquilibriumType property

The object's equilibrium's type.

dexter.NcGeometry.interp1d_type: str property

The 1D Interpolation type.

dexter.NcGeometry.interp2d_type: str property

The 2D Interpolation type.

dexter.NcGeometry.baxis: float property

The magnetic field strength on the magnetic axis \(B_0\) in \([T]\).

dexter.NcGeometry.raxis: float property

The horizontal position of the magnetic axis \(R_0\) in \([m]\).

dexter.NcGeometry.zaxis: float property

The vertical position of the magnetic axis in \([m]\).

dexter.NcGeometry.rgeo: float property

The geometrical axis (device major radius) in \([m]\).

dexter.NcGeometry.rlast: float property

The value of the \(r\) coordinate at the last closed flux surface \(r_{LCFS}\), in \([m]\).

dexter.NcGeometry.shape: ArrayShape property

The shape of the 2 dimensional data arrays, as in \((len(\psi/\psi_p), len(\theta))\).

If both coordinates are “good”, they are guaranteed to be of the same length.

dexter.NcGeometry.psi_last: float property

The value of the last closed toroidal flux surface \(\psi_{LCFS}\) in Normalized Units.

dexter.NcGeometry.psip_last: float property

The value of the last closed poloidal flux surface \(\psi_{p,LCFS}\) in Normalized Units.

dexter.NcGeometry.psi_array: Array1 property

The NetCDF \(\psi\) data.

dexter.NcGeometry.psip_array: Array1 property

The NetCDF \(\psi_p\) data.

dexter.NcGeometry.theta_array: Array1 property

The NetCDF \(\theta\) data.

dexter.NcGeometry.r_array: Array1 property

The NetCDF \(r\) data.

dexter.NcGeometry.rlab_array: Array2 property

The NetCDF \(R_{lab}\) data array.

dexter.NcGeometry.zlab_array: Array2 property

The NetCDF \(Z_{lab}\) data array.

dexter.NcGeometry.jacobian_array: Array2 property

The Jacobian \(J\) data array.

dexter.NcGeometry.rlab_last: Array1 property

the last \(R_{lab}\) values that correspond to the device’s last closed flux surface.

dexter.NcGeometry.zlab_last: Array1 property

the last \(Z_{lab}\) values that correspond to the device’s last closed flux surface.

dexter.NcGeometry.plot_flux_surfaces(number: int = 20, show: bool = True) -> Canvas

Plots the flux surfaces in the \(R-Z\) frame.

Parameters:

  • number (int, default: 20 ) –

    The number of flux surfaces to (try to) plot. Defaults to 20.

  • show (bool, default: True ) –

    Whether or not to call plt.show(). Defaults to True.

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.NcGeometry.plot_jacobian(levels: int = 20, show: bool = True) -> Canvas

Plots the Jacobian \(J(R, Z)\)

Parameters:

  • levels (int, default: 20 ) –

    The number of contour levels. Defaults to 20.

  • show (bool, default: True ) –

    Whether or not to call plt.show(). Defaults to True.

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.NcGeometry.r_of_psi(psi: ArrayLike) -> NDArray

The \(r(\psi)\) value in \([m]\).

Parameters:

  • psi (ArrayLike) –

    The toroidal flux \(\psi\) in Normalized Units.

dexter.NcGeometry.r_of_psip(psip: ArrayLike) -> NDArray

The \(r(\psi_p)\) value in \([m]\).

Parameters:

  • psip (ArrayLike) –

    The poloidal flux \(\psi_p\) in Normalized Units.

dexter.NcGeometry.psi_of_r(r: ArrayLike) -> NDArray

The \(\psi(r)\) value in Normalized Units.

Parameters:

  • r (ArrayLike) –

    The radial distance \(r\) in \([m]\).

dexter.NcGeometry.psip_of_r(r: ArrayLike) -> NDArray

The \(\psi_p(r)\) value in Normalized Units.

Parameters:

  • r (ArrayLike) –

    The radial distance \(r\) in \([m]\).

dexter.NcGeometry.plot_r_of_psi(points: int = 1000, data: bool = False, show: bool = True) -> Canvas

Plots \(r(\psi)\), where \(r\) is in \([m]\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(r(\psi)\). Defaults to 1000.

  • data (bool, default: False ) –

    Whether or not to plot the data array points (numerical equilibria only). Defaults to False.

  • show (bool, default: True ) –

    Whether or not to call plt.show(). Defaults to True.

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.NcGeometry.plot_r_of_psip(points: int = 1000, data: bool = False, show: bool = True) -> Canvas

Plots \(r(\psi_p)\), where \(r\) is in \([m]\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(r(\psi_p)\). Defaults to 1000.

  • data (bool, default: False ) –

    Whether or not to plot the data array points (numerical equilibria only). Defaults to False.

  • show (bool, default: True ) –

    Whether or not to call plt.show(). Defaults to True.

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.NcGeometry.plot_psi_of_r(points: int = 1000, data: bool = False, show: bool = True) -> Canvas

Plots \(\psi(r)\), where \(r\) is in \([m]\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(\psi(r)\). Defaults to 1000.

  • data (bool, default: False ) –

    Whether or not to plot the data array points (numerical equilibria only). Defaults to False.

  • show (bool, default: True ) –

    Whether or not to call plt.show(). Defaults to True.

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.NcGeometry.plot_psip_of_r(points: int = 1000, data: bool = False, show: bool = True) -> Canvas

Plots \(\psi_p(r)\), where \(r\) is in \([m]\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(\psi_p(r)\). Defaults to 1000.

  • data (bool, default: False ) –

    Whether or not to plot the data array points (numerical equilibria only). Defaults to False.

  • show (bool, default: True ) –

    Whether or not to call plt.show(). Defaults to True.

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.NcGeometry.plot_last(show: bool = True) -> Canvas

Plots the device's Last Closed Flux Surface (LCFS) in the \(R, Z\) frame.

Parameters:

  • show (bool, default: True ) –

    Whether or not to call plt.show(). Defaults to True.

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.NcGeometry.psip_of_psi(psi: ArrayLike) -> NDArray

The \(\psi_p(\psi)\) value in Normalized Units.

Parameters:

  • psi (ArrayLike) –

    The toroidal flux \(\psi\) in Normalized Units.

dexter.NcGeometry.psi_of_psip(psip: ArrayLike) -> NDArray

The \(\psi(\psi_p)\) value in Normalized Units.

Parameters:

  • psip (ArrayLike) –

    The poloidal flux \(\psi_p\) in Normalized Units.

dexter.NcGeometry.plot_psip_of_psi(points: int = 1000, data: bool = False, show: bool = True) -> Canvas

Plots \(\psi(\psi_p)\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(\psi_p(\psi)\). Defaults to 1000.

  • data (bool, default: False ) –

    Whether or not to plot the data array points (numerical equilibria only). Defaults to False.

  • show (bool, default: True ) –

    Whether or not to call plt.show(). Defaults to True.

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.NcGeometry.plot_psi_of_psip(points: int = 1000, data: bool = False, show: bool = True) -> Canvas

Plots \(\psi(\psi_p)\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(\psi(\psi_p)\). Defaults to 1000.

  • data (bool, default: False ) –

    Whether or not to plot the data array points (numerical equilibria only). Defaults to False.

  • show (bool, default: True ) –

    Whether or not to call plt.show(). Defaults to True.

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.NcGeometry.rlab_of_psi(psi: ArrayLike, theta: ArrayLike) -> NDArray

The \(R_{lab}(\psi, \theta)\) value in \([m]\).

Parameters:

  • psi (ArrayLike) –

    The toroidal flux \(\psi\) in Normalized Units.

  • theta (ArrayLike) –

    The \(\theta\) angle in \([rads]\).

dexter.NcGeometry.rlab_of_psip(psip: ArrayLike, theta: ArrayLike) -> NDArray

The \(R_{lab}(\psi_p, \theta)\) value in \([m]\).

Parameters:

  • psip (ArrayLike) –

    The poloidal flux \(\psi_p\) in Normalized Units.

  • theta (ArrayLike) –

    The \(\theta\) angle in \([rads]\).

dexter.NcGeometry.zlab_of_psi(psi: ArrayLike, theta: ArrayLike) -> NDArray

The \(Z_{lab}(\psi, \theta)\) value in \([m]\).

Parameters:

  • psi (ArrayLike) –

    The toroidal flux \(\psi\) in Normalized Units.

  • theta (ArrayLike) –

    The \(\theta\) angle in \([rads]\).

dexter.NcGeometry.zlab_of_psip(psip: ArrayLike, theta: ArrayLike) -> NDArray

The \(Z_{lab}(\psi_p, \theta)\) value in \([m]\).

Parameters:

  • psip (ArrayLike) –

    The poloidal flux \(\psi_p\) in Normalized Units.

  • theta (ArrayLike) –

    The \(\theta\) angle in \([rads]\).

dexter.NcGeometry.jacobian_of_psi(psi: ArrayLike, theta: ArrayLike) -> NDArray

The \(J(\psi, \theta)\) value in \([m]\).

Parameters:

  • psi (ArrayLike) –

    The toroidal flux \(\psi\) in Normalized Units.

  • theta (ArrayLike) –

    The \(\theta\) angle in \([rads]\).

dexter.NcGeometry.jacobian_of_psip(psip: ArrayLike, theta: ArrayLike) -> NDArray

The \(J(\psi_p, \theta)\) value in \([m]\).

Parameters:

  • psip (ArrayLike) –

    The poloidal flux \(\psi_p\) in Normalized Units.

  • theta (ArrayLike) –

    The \(\theta\) angle in \([rads]\).