Skip to content

$E-P_\zeta$ plane

dexter.EnergyPzetaPlane(machine: Machine, mu: float)

Representation of the 2D $(E, P_\zeta, \mu=const)$ plane.

Parameters:

  • machine (Machine) –

    The machine under study.

  • mu (float) –

    The magnetic moment $\mu$.

Attributes:

Example
$E-P_\zeta$ plane construction
>>> geometry = dex.LarGeometry(2, 1.75, 0.5)
>>> LCFS = geometry.psit_last
>>> machine = dex.Machine(
...     geometry=geometry,
...     qfactor=dex.ParabolicQfactor(qaxis=1.1, qlast=3.5, lcfs=LCFS),
...     current=dex.LarCurrent(),
...     bfield=dex.LarBfield(),
... )
>>>
>>> plane = dex.EnergyPzetaPlane(machine, mu=2e-5)
>>> fig, ax = plane.show(curves=True)
>>>
>>> # Critical points and Boundary extrema
>>> pzeta_array = np.linspace(-1.2, 0.3, 100) * machine.psip_last.value
>>> plane.calculate_critical_points(pzeta_array)
>>> plane.calculate_boundary_extrema(pzeta_array)
>>> fig, ax = plane.show()

bifurcation_analysis(pzeta_array: Array1)

Performs a full Bifurcation Analysis on the $E-P_\zeta$ plane.

This is a convenivenve method that simply calls the following methods:

Parameters:

  • pzeta_array (Array1) –

    The $P_\zeta$ values, in Normalized Units in which to search for critical points and boundary extrema. It usually makes more sense to normalize pzeta_array with respect to $\psi_{p, LCFS}$.

calculate_critical_points(pzeta_array: Array1)

Calculates the Hamiltonian's critical points over the pzeta_array.

The critical points are stored in self and can be accessed through self.critical_points.

Parameters:

  • pzeta_array (Array1) –

    The $P_\zeta$ values, in Normalized Units. It usually makes more sense to normalize pzeta_array with respect to $\psi_{p, LCFS}$.

calculate_boundary_extrema(pzeta_array: Array1)

Calculates the Hamiltonian's boundary extrema over the pzeta_array.

The critical points are stored in self and can be accessed through self.boundary_extrema.

Parameters:

  • pzeta_array (Array1) –

    The $P_\zeta$ values, in Normalized Units. It usually makes more sense to normalize pzeta_array with respect to $\psi_{p, LCFS}$.

classify_critical_points()

Classifies the already calculated critical points into one of CriticalPointKind.

classify_boundary_extrema()

Classifies the already calculated boundary extrema into one of BoundaryExtremumKind.

add_particles(obj: Particle | Queue)

Adds particles to the plane, discarding any previously stored ones.

At the time only certain particle attributes are stored.

Parameters:

  • obj (Particle | Queue) –

    The particle/queue to extract the data from.

clear_particles()

Clears all stored particles.

print_durations()

Prints the durations of the Bifurcation analysis' subroutines.

show(xlim: tuple[float, float] | None = None, ylim: float | tuple[float, float] = 3, particles: bool = True, critical_points: bool = True, boundary_extrema: bool = True, colors: Literal['Orbit', 'Cycle'] = 'Orbit', curves: bool = False, show: bool = True) -> tuple[Figure, Axes]

Plots the plane with the orbit classification curves.

Parameters:

  • xlim (tuple[float, float] | None, default: None ) –

    The xaxis limits, normalized to $\psi_{p,wall}$.

  • ylim (float | tuple[float, float], default: 3 ) –

    The yaxis limits, in $E/\mu$ units. If a float, it sets the yaxis upper limit while the lower limit is set to 0.

  • particles (bool, default: True ) –

    Whether or not to plot the stored particles' $(E, P_\zeta)$ points.

  • critical_points (bool, default: True ) –

    Whether or not to plot the stored critical points.

  • boundary_extrema (bool, default: True ) –

    Whether or not to plot the stored boundary extrema.

  • colors (Literal['Orbit', 'Cycle'], default: 'Orbit' ) –

    The coloring method for each particle's $E-P_\zeta$ point. 'Orbit' colors each point depending on its orbit type, as calculated from the classify routine. 'Cycle' cycles through the colors cbrmk.

  • curves (bool, default: False ) –

    Whether or not to plot the analytical curves (parabolas and approximate trapped-passing boundary).

  • show (bool, default: True ) –

    Whether or not to call plt.show().