Mode Objects¶
dexter.ModeObject: TypeAlias = FluteMode | NcFluteMode
module-attribute
¶
Available Mode objects.
FluteMode: A simple analytical flute mode.NcFluteMode: Single perturbation flute mode from a netCDF file.
dexter.FluteMode(epsilon: float, lcfs: MagneticFlux, m: int, n: int, phase: float)
¶
Bases: MachineObject, Mode
A simple analytical flute mode.
A flute mode is defined as:
$$ m(\psi, \theta, \zeta) = \epsilon\sqrt{\dfrac{\psi}{\psi_{LCFS}}}\cos(m\theta-n\zeta+\phi) $$
Parameters:
-
epsilon(float) –The modes's "amplitude" $\epsilon$. Corresponds the value of the amplitude at the last closed flux surface.
-
lcfs(MagneticFlux) –The Last Closed Flux Surface, with respect to which the mode is defined.
-
phase(float) –The mode's constant phase $\phi$.
Attributes:
-
epsilon(float) –The modes's "amplitude" $\epsilon$. Corresponds the value of the amplitude at the last closed flux surface.
-
lcfs(MagneticFlux) –The Last Closed Flux Surface, with respect to which the mode is defined.
-
phase(float) –The mode's constant phase $\phi$.
dexter.NcFluteMode(path: str, interp_type: Interpolation1dType, m: int, n: int, phase_method: PhaseMethod = 'Interpolation', analytical_threshold_index: int = 3)
¶
Bases: MachineObject, Mode
Single perturbation flute mode from a netCDF file.
Related quantities are computed by interpolating over the data arrays.
A numerical flute mode is defined as:
$$ m(\psi, \theta, \zeta) = \sum_{m,n} \alpha_{m,n}(\psi, \theta, \zeta)\cos\big(m\theta-n\zeta+\phi(\psi)\big) $$
Parameters:
-
path(str) –The path to the NetCDF file.
-
interp_type(Interpolation1dType) –The 1D interpolation type.
-
m(int) –The poloidal mode number.
-
n(int) –The toroidal mode number.
-
phase_method(PhaseMethod, default:'Interpolation') –The phase $\phi(\psi)$ calculation method.
-
analytical_threshold_index(int, default:3) –The modes’s analytical threshold point. Defines the index of the magnetic flux values under which to switch to the analytica formula.
Numerical flute mode analytical patching
By definition, flute modes must behave like $\approx\sqrt\psi$ close to the axis, and therefore their derivative with respect to the flux must go to infinity. This is a behavior that splines cannot replicate, resulting to unnatural orbits close to the magnetic axis. To solve this, the mode switches to an analytical formula for the values of $\psi/\psi_p$ under a certain threshold. The threshold is defined by the flux value at the position index of the data array.
Formula¶
The patch has the form $\beta\sqrt\psi + \gamma$, where $\beta$ and $\gamma$ are adjusted in order to ensure continuity of both $\alpha(\psi)$ and its first derivative. $\beta$ is calculated first by $\beta = 2\alpha' \sqrt\psi$ to ensure the correct value of the derivative $d\alpha/d\psi$ at the patch’s edge. Finally, $\gamma = \alpha - \beta\sqrt\psi$ ensures the continuity of $\alpha$ itself.
Note that sometimes $\gamma$ may become slightly negative, resulting to $\alpha$ becoming slightly negative extremely close to the axis. However this error should be negligible compared to the possible non-continuity of $\alpha$’s higher derivatives and/or its deviation from the actual data.
Attributes:
-
path(str) –The path to the netCDF file.
-
netcdf_version(NetCDFVersion) –The netCDF file's version (SemVer).
-
interp_type(Interpolation1dType) –The 1D interpolation type.
-
phase_method(PhaseMethod) –The phase $\phi$ calculation method.
-
analytical_threshold_index(int) –The analytical threshold index.
-
phase_average(float | None) –The average value of the phase array, if
PhaseMethod == 'Average'. -
psit_array(Array1 | None) –The toroidal flux' values.
-
psip_array(Array1 | None) –The poloidal flux' values.
-
alpha_array(Array1) –The amplitude $\alpha$ values.
-
phase_array(Array1) –The phase $\phi$ values.