Equilibrium
dexter.Equilibrium(qfactor: Qfactor, current: Current, bfield: Bfield, *, perturbation: Optional[Perturbation] = Perturbation([]), geometry: Optional[Geometry] = None, species: ParticleSpecies = 'Proton')
¶
An Equilibrium.
Contains all the necessary equilibrium objects, defines conversions to SI and provides plots.
For conveniently constructing a numerical equilibrium from a netCDF file, see
numerical_equilibrium
Parameters:
-
qfactor(Qfactor) –The equilibrium's qfactor.
-
current(Current) –The equilibrium's current.
-
bfield(Bfield) –The equilibrium's bfield.
-
perturbation(Optional[Perturbation], default:Perturbation([])) –todo: The equilibrium's perturbation, if they exist. Defaults to None (unperturbed equilibrium).
-
geometry(Optional[Geometry], default:None) –The equilibrium's geometry. This field is not required for calculations. Defaults to None.
-
species(ParticleSpecies, default:'Proton') –The particle species under study. This only affects unit conversions to SI. Defaults to "Proton".
Example
Methods:
-
quantity–Constructs a Quantity
-
plot_b–Plots a contour plot of the magnetic field strength for a numerical equilibrium.
-
plot_db–Plots contour plots of the magnetic field's derivatives for a numerical equilibrium.
-
plot_flux_surfaces–Plots the flux surfaces of a numerical equilibrium.
-
plot_boozer_theta–Plots the \(\theta_B = const\) lines on a numerical equilibrium.
-
plot_midplane–Plots \(B\), \(dB/d(\psi/\psi_p)\) and \(dB/d\theta\) on the midplane.
Attributes:
-
geometry(Geometry) –The equilibrium 'Geometry'.
-
qfactor(Qfactor) –The equilibrium 'Qfactor'.
-
current(Current) –The equilibrium 'Current'.
-
bfield(Bfield) –The equilibrium 'Bfield'.
-
perturbation(Perturbation) –The equilibrium 'Perturbation'.
-
psi_last(float) –The value of the last closed toroidal flux surface, \(\psi_{LCFS}\).
-
psip_last(float) –The value of the last closed poloidal flux surface, \(\psi_{p,LCFS}\).
-
baxis(float) –The magnetic field strength on the axis, \(B_{axis}\).
-
raxis(float) –The device's major radius, \(R_{axis}\).
-
rlast(float) –The radial coordinate's value at the last closed flux surface, \(r_{LCFS}\).
dexter.Equilibrium.geometry: Geometry
property
¶
The equilibrium 'Geometry'.
dexter.Equilibrium.qfactor: Qfactor
property
¶
The equilibrium 'Qfactor'.
dexter.Equilibrium.current: Current
property
¶
The equilibrium 'Current'.
dexter.Equilibrium.bfield: Bfield
property
¶
The equilibrium 'Bfield'.
dexter.Equilibrium.perturbation: Perturbation
property
writable
¶
The equilibrium 'Perturbation'.
dexter.Equilibrium.psi_last: float
property
¶
The value of the last closed toroidal flux surface, \(\psi_{LCFS}\).
dexter.Equilibrium.psip_last: float
property
¶
The value of the last closed poloidal flux surface, \(\psi_{p,LCFS}\).
dexter.Equilibrium.baxis: float
property
¶
The magnetic field strength on the axis, \(B_{axis}\).
dexter.Equilibrium.raxis: float
property
¶
The device's major radius, \(R_{axis}\).
dexter.Equilibrium.rlast: float
property
¶
The radial coordinate's value at the last closed flux surface, \(r_{LCFS}\).
dexter.Equilibrium.quantity(value: float | ArrayLike, units: str) -> PlainQuantity
¶
Constructs a Quantity
dexter.Equilibrium.plot_b(levels: int = 20, units: UnitSystem = 'SI', show: bool = True) -> Canvas
¶
Plots a contour plot of the magnetic field strength for a numerical equilibrium.
Parameters:
-
levels(int, default:20) –The number of contour levels. Defaults to 20.
-
units(UnitSystem, default:'SI') –The unit system of the magnetic field magnitude. Defaults to "SI".
-
show(bool, default:True) –Whether or not to call
plt.show(). Defaults to True.
Returns:
-
Canvas–The produced
FigureandAx.
dexter.Equilibrium.plot_db(levels: int = 20, show: bool = True) -> MultiCanvas
¶
Plots contour plots of the magnetic field's derivatives for a numerical equilibrium.
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:
-
MultiCanvas–The produced
FigureandAxes.
dexter.Equilibrium.plot_flux_surfaces(number: int = 20, show: bool = True) -> Canvas
¶
Plots the flux surfaces of a numerical equilibrium.
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
FigureandAx.
dexter.Equilibrium.plot_boozer_theta(number: int = 80, show: bool = True) -> Canvas
¶
Plots the \(\theta_B = const\) lines on a numerical equilibrium.
Parameters:
-
number(int, default:80) –The number of lines to (try to) plot. Defaults to 80.",
-
show(bool, default:True) –Whether or not to call
plt.show(). Defaults to True.
Returns:
-
Canvas–The produced
FigureandAx.
dexter.Equilibrium.plot_midplane(show: bool = True) -> Canvas
¶
Plots \(B\), \(dB/d(\psi/\psi_p)\) and \(dB/d\theta\) on the midplane.
The midplane is defined as two \(\theta=const\) lines:
- \(\theta = \pi\) and \(\psi=[0, \psi_{LCFS}]\) (or \(\psi_p=[0, \psi_{p,LCFS}]\))
- \(\theta = 0\) and \(\psi=[0, \psi_{LCFS}]\) (or \(\psi_p=[0, \psi_{p,LCFS}]\))
Parameters:
-
show(bool, default:True) –Whether or not to call
plt.show(). Defaults to True.
Returns:
-
Canvas–The produced
FigureandAx.
dexter.numerical_equilibrium(path: str, interp1d_type: Interp1DType, interp2d_type: Interp2DType, *, padding: int = 15) -> Equilibrium
¶
Constructs a numerical equilibrium from a netCDF file.
Perturbations are not constructed, but can be added manually in the Equilibrium object.
Parameters:
-
path(str) –Path to netCDF file.
-
interp1d_type(Interp1DType) –The 1D interpolation type.
-
interp2d_type(Interp2DType) –The 2D interpolation type.
-
padding(int, default:15) –The left-right \(\theta\) (per-side) padding width of the \(B\) array. Defaults to 15.
Returns:
-
Equilibrium–Equilibrium object containing the corresponding
NcGeometry,NcQfactor,NcCurrentandNcBfield,