Equilibirum
Note
Interpolation methods and stored data attributes are direct re-exports from the underlying Rust objects.
dexter.Geometry
Object describing the geometry of the device.
Stores relates scalars and arrays, and provides interpolation methods for converting between different variables and coordinate systems.
Attributes:
-
path(str) –The path of the netCDF file.
-
typ1d(Interp1DType) –The 1D Interpolation type.
-
typ2d(Interp2DType) –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 \(R0\) in \([m]\).
-
zaxis(float) –The vertical position of the magnetic axis in \([m]\).
-
rgeo(float) –The geometrical axis (device major radius) in \([m]\).
-
psip_wall(float) –The poloidal flux value at the wall \(\psi_{p,wall}\) in Normalized Units.
-
psi_wall(float) –The toroidal flux value at the wall \(\psi_{wall}\) in Normalized Units.
-
r_wall(float) –The device's minor radius \(r_{wall}\) in \([m]\).
-
shape(NDArrayShape) –The shape of the 2 dimensinal data arrays, as in \((len(\psi_p), len(\theta_B))\).
-
theta_data(NDArray1D) –The \(\theta_B\) data array.
-
psip_data(NDArray1D) –The \(\psi_p\) data array.
-
psi_data(NDArray1D) –The \(\psi\) data array.
-
r_data(NDArray1D) –The \(r(\psi_p)\) data array.
-
rlab_data(NDArray2D) –The \(R_{lab}(\psi_p, \theta_B)\) data array.
-
zlab_data(NDArray2D) –The \(Z_{lab}(\psi_p, \theta_B)\) data array.
Methods:
-
__init__–Constructs a
Geometry. -
r–The \(r(\psi_p)\) value in \([m]\).
-
psip–The \(\psi_p(r)\) value in Normalized Units.
-
rlab–The \(R_{lab}(\psi_p, \theta_B)\) value in \([m]\).
-
zlab–The \(Z_{lab}(\psi_p, \theta_B)\) value in \([m]\).
dexter.Geometry.__init__(path: str, typ1d: Interp1DType, typ2d: Interp2DType)
Constructs a Geometry.
Parameters:
-
path(str) –The path to the NetCDF file.
-
typ1d(Interp1DType) –The type of 1D Interpolation.
-
typ2d(Interp2DType) –The type of 2D Interpolation.
dexter.Geometry.r(psip: float) -> float
The \(r(\psi_p)\) value in \([m]\).
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
dexter.Geometry.psip(r: float) -> float
The \(\psi_p(r)\) value in Normalized Units.
Parameters:
-
r(float) –The distance from the (geometrical) magnetic axis \(r\) in \([m]\).
dexter.Geometry.rlab(psip: float, theta: float) -> float
The \(R_{lab}(\psi_p, \theta_B)\) value in \([m]\).
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The \(\theta_B\) angle in \([rads]\).
dexter.Geometry.zlab(psip: float, theta: float) -> float
The \(Z_{lab}(\psi_p, \theta_B)\) value in \([m]\).
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The \(\theta_B\) angle in \([rads]\).
dexter.Qfactor
q-factor from a NetCDF file.
Provides methods for calculating \(q(\psi_p)\), \(\psi(\psi_p)\) and \(d\psi/d\psi_p\).
Attributes:
-
path(str) –The path to the NetCDF file.
-
typ(Interp1DType) –The 1D Interpolation type.
-
psip_wall(float) –The poloidal flux value at the wall \(\psi_{p,wall}\) in Normalized Units.
-
psi_wall(float) –The toroidal flux value at the wall \(\psi_{wall}\) in Normalized Units.
-
psip_data(NDArray1D) –The NetCDF \(\psi_p\) data used to construct the \(q(\psi_p)\) and \(\psi(\psi_p)\) splines.
-
q_data(NDArray1D) –The NetCDF \(q\) data used to construct the \(q(\psi_p)\) spline.
-
psi_data(NDArray1D) –The NetCDF \(\psi\) data used to construct the \(\psi(\psi_p)\) spline.
Methods:
-
__init__–Constructs a
Qfactor. -
q–The \(q(\psi_p)\) value.
-
psi–The \(\psi(\psi_p)\) value.
-
dpsi_dpsip–The \(q(\psi_p)\) value, as calculated from \(d\psi/d\psi_p\) by interpolation
dexter.Qfactor.__init__(path: str, typ: Interp1DType) -> None
Constructs a Qfactor.
Parameters:
-
path(str) –The path to the NetCDF file.
-
typ(Interp1DType) –The 1D Interpolation type.
dexter.Qfactor.q(psip: float) -> float
The \(q(\psi_p)\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
dexter.Qfactor.psi(psip: float) -> float
The \(\psi(\psi_p)\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
dexter.Qfactor.dpsi_dpsip(psip: float) -> float
The \(q(\psi_p)\) value, as calculated from \(d\psi/d\psi_p\) by interpolation with the \(\psi(\psi_p)\) spline.
It's a good check that the values coincide with Qfactor.q(psip).
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
dexter.Currents
Plasma reconstructed from a NetCDF file.
Provides methods for calculating \(g(\psi_p)\), \(I(\psi_p)\), \(dg/d\psi_p\) and \(dI/d\psi_p\).
Attributes:
-
path(str) –The path to the NetCDF file.
-
typ(Interp1DType) –The 1D Interpolation type.
-
psip_wall(float) –The poloidal flux value at the wall \(\psi_{p,wall}\) in Normalized Units.
-
psi_wall–The toroidal flux value at the wall \(\psi_{wall}\) in Normalized Units.
-
psip_data(NDArray1D) –The NetCDF \(\psi_p\) data used to construct the \(q(\psi_p)\) and \(\psi(\psi_p)\) splines.
-
g_data(NDArray1D) –The NetCDF \(g\) data used to construct the \(g(\psi_p)\) spline.
-
i_data(NDArray1D) –The NetCDF \(I\) data used to construct the \(I(\psi_p)\) spline.
Methods:
-
__init__–Constructs a
Currents. -
g–The \(g(\psi_p)\) value.
-
i–The \(I(\psi_p)\) value.
-
dg_dpsip–The \(dg(\psi_p)/d\psi_p\) value.
-
di_dpsip–The \(dI(\psi_p)/d\psi_p\) value.
dexter.Currents.__init__(path: str, typ: Interp1DType) -> None
Constructs a Currents.
Parameters:
-
path(str) –The path to the NetCDF file.
-
typ(Interp1DType) –The 1D Interpolation type.
dexter.Currents.g(psip: float) -> float
The \(g(\psi_p)\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
dexter.Currents.i(psip: float) -> float
The \(I(\psi_p)\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
dexter.Currents.dg_dpsip(psip: float) -> float
The \(dg(\psi_p)/d\psi_p\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
dexter.Currents.di_dpsip(psip: float) -> float
The \(dI(\psi_p)/d\psi_p\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
dexter.Bfield
Magnetic field from a NetCDF file.
Provides methods for calculating \(B(\psi_p, \theta_B)\), and its derivatives.
Attributes:
-
path(str) –The path to the NetCDF file.
-
typ(Interp2DType) –The 2D Interpolation type.
-
psip_wall(float) –The poloidal flux value at the wall \(\psi_{p,wall}\) in Normalized Units.
-
psip_data(NDArray1D) –The NetCDF \(\psi_p\) data used to construct the \(B(\psi_p, \theta_B)\) spline.
-
theta_data(NDArray1D) –The NetCDF \(\theta_B\) data used to construct the \(B(\psi_p, \theta_B)\) spline.
-
b_data(NDArray2D) –The NetCDF \(B\) data used to construct the \(B(\psi_p, \theta_B)\) spline.
-
db_dpsip_data(NDArray2D) –The \(dB/d\psi_p\) values evaluated at the \((\psi_p, \theta_B)\) data points, through interpolation.
-
db_dtheta_data(NDArray2D) –The \(dB/d\theta_B\) values evaluated at the \((\psi_p, \theta_B)\) data points, through interpolation.
Methods:
-
__init__–Constructs a
Bfield. -
b–The \(B(\psi_p, \theta_B)\) value.
-
db_dpsip–The \(dB/d\psi_p\) value.
-
db_dtheta–The \(dB/d\theta_B\) value.
-
d2b_dpsip2–The \(d^2B/d\psi_p^2\) value.
-
d2b_dtheta2–The \(d^2B/d\theta_B^2\) value.
-
d2b_dpsip_dtheta–The \(d^2B/d\psi_p d\theta_B\) value.
dexter.Bfield.__init__(path: str, typ: Interp2DType) -> None
Constructs a Bfield.
Parameters:
-
path(str) –The path to the NetCDF file.
-
typ(Interp2DType) –The 2D Interpolation type.
dexter.Bfield.b(psip: float, theta: float) -> float
The \(B(\psi_p, \theta_B)\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The angle \(\theta\) in \([rads]\).
dexter.Bfield.db_dpsip(psip: float, theta: float) -> float
The \(dB/d\psi_p\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The angle \(\theta\) in \([rads]\).
dexter.Bfield.db_dtheta(psip: float, theta: float) -> float
The \(dB/d\theta_B\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The angle \(\theta\) in \([rads]\).
dexter.Bfield.d2b_dpsip2(psip: float, theta: float) -> float
The \(d^2B/d\psi_p^2\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The angle \(\theta\) in \([rads]\).
dexter.Bfield.d2b_dtheta2(psip: float, theta: float) -> float
The \(d^2B/d\theta_B^2\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The angle \(\theta\) in \([rads]\).
dexter.Bfield.d2b_dpsip_dtheta(psip: float, theta: float) -> float
The \(d^2B/d\psi_p d\theta_B\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The angle \(\theta\) in \([rads]\).
dexter.Harmonic
A single Harmonic from a NetCDF file.
A Harmonic has the form:
where \(m, n\) are integers.
Attributes:
-
path(str) –The path to the NetCDF file.
-
typ(Interp1DType) –The 1D Interpolation type.
-
psip_wall(float) –The poloidal flux value at the wall \(\psi_{p,wall}\) in Normalized Units.
-
m(int) –The \(\theta\) frequency mode number.
-
n(int) –The \(\zeta\) frequency mode number.
-
phase_average(float) –The average_value of the phase data array.
-
psip_data(NDArray1D) –The NetCDF \(\psi_p\) data used to construct the \(\alpha(\psi_p)\) and \(\phi(\psi_p)\) splines.
-
a_data(NDArray1D) –The NetCDF \(\alpha\) data used to construct the \(\alpha(\psi_p)\) spline.
-
phase_data(NDArray1D) –The NetCDF \(\phi\) data used to construct the \(\phi(\psi_p)\) spline.
Methods:
-
__init__–Constructs a
Harmonic. -
h–The \(h(\psi_p, \theta_B, \zeta)\) value.
-
dh_dpsip–The \(dh/d\psi_p\) value.
-
dh_dtheta–The \(dh/d\theta_B\) value.
-
dh_dzeta–The \(dh/d\zeta\) value.
-
dh_dt–The \(dh/dt\) value.
-
a–The amplitude \(\alpha(\psi_p)\) value.
-
da_dpsip–The harmonic's amplitude \(d\alpha/d\psi_p\) value.
-
phase–The harmonic's phase \(\phi(\psi_p)\) value.
dexter.Harmonic.__init__(path: str, typ: Interp1DType, m: int, n: int) -> None
Constructs a Harmonic.
Parameters:
-
path(str) –The path to the NetCDF file.
-
typ(Interp1DType) –The 1D Interpolation type.
-
m(int) –The
θfrequency mode number. -
n(int) –The
ζfrequency mode number.
dexter.Harmonic.h(psip: float, theta: float, zeta: float) -> float
The \(h(\psi_p, \theta_B, \zeta)\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The angle \(\theta\) in \([rads]\).
-
zeta(float) –The angle \(\zeta\) in \([rads]\).
dexter.Harmonic.dh_dpsip(psip: float, theta: float, zeta: float) -> float
The \(dh/d\psi_p\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The angle \(\theta\) in \([rads]\).
-
zeta(float) –The angle \(\zeta\) in \([rads]\).
dexter.Harmonic.dh_dtheta(psip: float, theta: float, zeta: float) -> float
The \(dh/d\theta_B\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The angle \(\theta\) in \([rads]\).
-
zeta(float) –The angle \(\zeta\) in \([rads]\).
dexter.Harmonic.dh_dzeta(psip: float, theta: float, zeta: float) -> float
The \(dh/d\zeta\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The angle \(\theta\) in \([rads]\).
-
zeta(float) –The angle \(\zeta\) in \([rads]\).
dexter.Harmonic.dh_dt(psip: float, theta: float, zeta: float) -> float
The \(dh/dt\) value.
This method always returs 0 at the moment.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The angle \(\theta\) in \([rads]\).
-
zeta(float) –The angle \(\zeta\) in \([rads]\).
dexter.Harmonic.a(psip: float) -> float
The amplitude \(\alpha(\psi_p)\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
dexter.Harmonic.da_dpsip(psip: float) -> float
The harmonic's amplitude \(d\alpha/d\psi_p\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
dexter.Harmonic.phase(psip: float) -> float
The harmonic's phase \(\phi(\psi_p)\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
dexter.Perturbation
A sum of different perturbation harmonics.
A Perturbation has the form:
To avoid confusion with a Harmonic's amplitude \(\alpha\), we denote the total sum of the harmonics as \(p\).
Attributes:
-
harmonics(list[Harmonic]) –The list of harmonics that appear in the perturbation.
Methods:
-
__init__–Constructs a
Perturbation. -
p–The \(p(\psi_p, \theta_B, \zeta)\) value.
-
dp_dpsip–The \(dp/d\psi_p\) value.
-
dp_dtheta–The \(dp/d\theta_B\) value.
-
dp_dzeta–The \(dp/d\zeta\) value.
-
dp_dt–The \(dp/dt\) value.
-
__getitem__–Returns the n-th harmonic
dexter.Perturbation.__init__(harmonics: list[Harmonic]) -> None
Constructs a Perturbation.
Parameters:
-
harmonics(list[Harmonic]) –The list of harmonics that appear in the perturbation.
dexter.Perturbation.p(psip: float, theta: float, zeta: float) -> float
The \(p(\psi_p, \theta_B, \zeta)\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The angle \(\theta\) in \([rads]\).
-
zeta(float) –The angle \(\zeta\) in \([rads]\).
Example
Creating a Perturbation by picking Harmonics:
>>> perturbation = dx.Perturbation(
... [
... dx.Harmonic("./data.nc", "steffen", m=1, n=7),
... dx.Harmonic("./data.nc", "steffen", m=1, n=8),
... dx.Harmonic("./data.nc", "steffen", m=1, n=9),
... ]
... )
Creating a Perturbation by list comprehension:
dexter.Perturbation.dp_dpsip(psip: float, theta: float, zeta: float) -> float
The \(dp/d\psi_p\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The angle \(\theta\) in \([rads]\).
-
zeta(float) –The angle \(\zeta\) in \([rads]\).
dexter.Perturbation.dp_dtheta(psip: float, theta: float, zeta: float) -> float
The \(dp/d\theta_B\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The angle \(\theta\) in \([rads]\).
-
zeta(float) –The angle \(\zeta\) in \([rads]\).
dexter.Perturbation.dp_dzeta(psip: float, theta: float, zeta: float) -> float
The \(dp/d\zeta\) value.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The angle \(\theta\) in \([rads]\).
-
zeta(float) –The angle \(\zeta\) in \([rads]\).
dexter.Perturbation.dp_dt(psip: float, theta: float, zeta: float) -> float
The \(dp/dt\) value.
This method always returs 0 at the moment.
Parameters:
-
psip(float) –The poloidal flux \(\psi_p\) in Normalized Units.
-
theta(float) –The angle \(\theta\) in \([rads]\).
-
zeta(float) –The angle \(\zeta\) in \([rads]\).
dexter.Perturbation.__getitem__(n: int) -> Harmonic
Returns the n-th harmonic