Skip to content

Queue

Queue class and helper objects for defining one.

dexter.InitialFluxArray(kind: FluxCoordinate, values: Array1)

A 1D array of initial "Toroidal" or "Poloidal" fluxes.

Useful when creating a QueueInitialConditions.

Example
InitialFluxArray definition
>>> psi0s = InitialFluxArray("Toroidal", np.linspace(0, 0.5, 10))
>>> psip0s = InitialFluxArray("Poloidal", np.linspace(0, 0.8, 20))

Methods:

  • __mul__ –

    Multiplies inner values by scalar.

Attributes:

dexter.InitialFluxArray.kind: FluxCoordinate property

The kind of the contained fluxes ("Toroidal" or "Poloidal").

dexter.InitialFluxArray.values: Array1 property

The flux values.

dexter.InitialFluxArray.__mul__(scalar) -> InitialFluxArray

Multiplies inner values by scalar.

dexter.QueueInitialConditions()

Sets of initial conditions for initializing a Queue.

Use QueueInitialConditions.boozer and QueueInitialConditions.mixed class methods to construct the set.

Use the InitialFluxArray helper object to initialize the \(\psi\)/\(\psi_p\) variables.

Methods:

  • boozer –

    Creates initial conditions for a Queue in Boozer coordinates.

  • mixed –

    Creates initial conditions for a Queue in Mixed coordinates.

Attributes:

dexter.QueueInitialConditions.t_array: Array1 property

The initial times array.

dexter.QueueInitialConditions.theta_array: Array1 property

The initial \(\theta\) array.

dexter.QueueInitialConditions.zeta_array: Array1 property

The initial \(\zeta\) array.

dexter.QueueInitialConditions.mu_array: Array1 property

The initial \(\mu\) array.

dexter.QueueInitialConditions.rho_array: Array1 property

The initial \(\rho\) array.

dexter.QueueInitialConditions.pzeta_array: Array1 property

The initial \(P_\zeta\) array.

dexter.QueueInitialConditions.boozer(t0: Array1, flux0: InitialFluxArray, theta0: Array1, zeta0: Array1, rho0: Array1, mu0: Array1) -> QueueInitialConditions classmethod

Creates initial conditions for a Queue in Boozer coordinates.

The initial conditions are defined on the \((t, \psi, \theta, \zeta, \rho, \mu)\) or \((t, \psi_p, \theta, \zeta, \rho, \mu)\) space, depending on the value of flux0.

Parameters:

  • t0 (Array1) –

    The initial times, in Normalized Units.

  • flux0 (InitialFluxArray) –

    The initial \(\psi / \psi_p\), in Normalized Units.

  • theta0 (Array1) –

    The initial \(\theta\) angles, in rads.

  • zeta0 (Array1) –

    The initial \(\zeta\) angles, in rads.

  • rho0 (Array1) –

    The initial \(\rho_{||}\), in Normalized Units.

  • mu0 (Array1) –

    The initial magnetic moments \(\mu\), in Normalized Units.

Example
QueueInitialConditions definition in Boozer coordinates
>>> num = 10
>>> psi0s = InitialFluxArray("Toroidal", np.linspace(0, 0.5, num))
>>>
>>> initial_conditions = QueueInitialConditions.boozer(
...     t0=np.zeros(num),
...     flux0=psi0s,
...     theta0=np.zeros(num),
...     zeta0=np.zeros(num),
...     rho0=np.logspace(1e-6, 1e-5, num),
...     mu0=np.full(num, 1e-6),
... )

dexter.QueueInitialConditions.mixed(t0: Array1, flux0: InitialFluxArray, theta0: Array1, zeta0: Array1, pzeta0: Array1, mu0: Array1) -> QueueInitialConditions classmethod

Creates initial conditions for a Queue in Mixed coordinates.

The initial conditions are defined on the \((t, \psi, \theta, \zeta, P_\zeta, \mu)\) or \((t, \psi_p, \theta, \zeta, P_\zeta, \mu)\) space, depending on the value of flux0.

Parameters:

  • t0 (Array1) –

    The initial times, in Normalized Units.

  • flux0 (InitialFluxArray) –

    The initial \(\psi / \psi_p\), in Normalized Units.

  • theta0 (Array1) –

    The initial \(\theta\) angles, in rads.

  • zeta0 (Array1) –

    The initial \(\zeta\) angles, in rads.

  • pzeta0 (Array1) –

    The initial \(P_\zeta\), in Normalized Units.

  • mu0 (Array1) –

    The initial magnetic moments \(\mu\), in Normalized Units.

Example
QueueInitialConditions definition in Boozer coordinates
>>> num = 10
>>> psi0s = InitialFluxArray("Toroidal", np.linspace(0, 0.5, num))
>>>
>>> initial_conditions = QueueInitialConditions.mixed(
...     t0=np.zeros(num),
...     flux0=psi0s,
...     theta0=np.zeros(num),
...     zeta0=np.zeros(num),
...     pzeta0=np.linspace(-0.02, -0.01, num),
...     mu0=np.full(num, 1e-6),
... )

dexter.Queue(initial_conditions: QueueInitialConditions)

A collection of multiple Particles , constructed from a QueueInitialConditions.

Offers the ability to batch Particle::integrate or Particle::intersect all the contained particles, using multiple threads.

Parameters:

Example
Queue integration
>>> # Initial Conditions setup
>>> num = 10
>>> psi0s = InitialFluxArray("Toroidal", np.linspace(0, 0.5, num))
>>>
>>> initial_conditions = QueueInitialConditions.boozer(
...     t0=np.zeros(num),
...     flux0=psi0s,
...     theta0=np.zeros(num),
...     zeta0=np.zeros(num),
...     rho0=np.logspace(1e-6, 1e-5, num),
...     mu0=np.full(num, 1e-6),
... )
>>>
>>> # Queue setup
>>> queue = dex.Queue(initial_conditions)

Methods:

  • plot_energies –

    Plots a stem plot of all the particles' energies.

  • plot_steps_taken –

    Plots a stem plot of all the number of steps each particle has taken.

  • plot_steps_stored –

    Plots a stem plot of all the number of steps each particle has stored.

  • plot_const_zeta_cartesian_poincare –

    Plots the \(\zeta=const\) poincare map on the \(\theta-\psi\) cartesian plane.

  • plot_const_theta_cartesian_poincare –

    Plots the \(\theta=const\) poincare map on the \(\zeta-\psi_p\) cartesian plane.

  • plot_const_zeta_rz_poincare –

    Plots the \(\zeta=const\) poincare map on the \(R-Z\) coordinate system.

  • plot_qkinetic_radial_sweep –

    Plots the contained particles' calculated \(q_{kinetic}\) with respect to their \(\psi_0/\psi_{p,0}\).

  • plot_qkinetic_pzeta_sweep –

    Plots the contained particles' calculated \(q_{kinetic}\) with respect to their \(P_\zeta\).

  • plot_qkinetic_energy_sweep –

    Plots the contained particles' calculated \(q_{kinetic}\) with respect to their Energy.

  • plot_qkinetic_pzeta_energy3d –

    Plots the contained particles' calculated \(q_{kinetic}\) with respect to their \(P_\zeta\) and \(E\).

  • from_particles –

    Creates a new Queue from a list of Particles, copying all their attributes.

  • retain_pzeta –

    Iterates through self’s particles, keeping only the ones with an initial \(P_\zeta\)

  • retain_energy –

    Iterates through self’s particles, keeping only the ones with an initial Energy

  • bin_pzeta –

    Iterates through self’s particles, keeping only one particle in each Pζ bin.

  • retain_energy_pzeta_positions –

    Iterates through self’s particles, keeping only the ones with an

  • retain_orbit_types –

    Iterates through self’s particles, keeping only the ones with an

  • integrate –

    Integrates all the contained particles for a specific time interval.

  • intersect –

    Integrates all the contained particles, calculating their intersections with a constant \(\theta\) or \(\zeta\) surface.

  • close –

    Integrates all the contained particles for a certain amount of \(\theta-\psi\) periods.

  • classify –

    Classifies the particles' orbits using their position on the \((E, P_\zeta, \mu=const)\)

Attributes:

dexter.Queue.initial_conditions: QueueInitialConditions property

The Queue's initial conditions.

dexter.Queue.particle_count: int property

The number of contained Particles.

dexter.Queue.particles: list[Particle] property

The contained Particles.

dexter.Queue.routine: Routine property

The routine run by the Queue.

dexter.Queue.energy_array: Array1 property

The particles' calculated energies.

Particles are visited in order of instantiation.

dexter.Queue.steps_taken_array: Array1 property

The number of steps each particle has taken.

Particles are visited in order of instantiation.

dexter.Queue.steps_stored_array: Array1 property

The number of steps each particle has stored.

Particles are visited in order of instantiation.

dexter.Queue.omega_theta_array: Array1 property

The particles' calculated \(\omega_theta\).

Particles are visited in order of instantiation.

dexter.Queue.omega_zeta_array: Array1 property

The particles' calculated \(\omega_zeta\).

Particles are visited in order of instantiation.

dexter.Queue.qkinetic_array: Array1 property

The particles' calculated \(q_{kinetic}\).

Particles are visited in order of instantiation.

dexter.Queue.durations: np.ndarray[tuple[int], np.dtype[np.timedelta64]] property

The particles' calculated \(q_{kinetic}\).

Particles are visited in order of instantiation.

dexter.Queue.plot_energies(show=True) -> Canvas

Plots a stem plot of all the particles' energies.

Particles are visited in order of instantiation.

Useful to visualize the energy spans of the particles under study.

Parameters:

  • show –

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

Returns:

  • Canvas –

    The produced Figure and Ax.

dexter.Queue.plot_steps_taken(show=True) -> Canvas

Plots a stem plot of all the number of steps each particle has taken.

Particles are visited in order of instantiation.

Parameters:

  • show –

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

Returns:

  • Canvas –

    The produced Figure and Ax.

dexter.Queue.plot_steps_stored(show=True) -> Canvas

Plots a stem plot of all the number of steps each particle has stored.

Particles are visited in order of instantiation.

Parameters:

  • show –

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

Returns:

  • Canvas –

    The produced Figure and Ax.

dexter.Queue.plot_const_zeta_cartesian_poincare(initial: bool = False, color: bool = False, show: bool = True) -> Canvas

Plots the \(\zeta=const\) poincare map on the \(\theta-\psi\) cartesian plane.

Parameters:

  • color (bool, default: False ) –

    Whether or not to use a different color for each orbit. Defaults to False.

  • initial (bool, default: False ) –

    Whether or not to plot the initial points. Note that the initial \(\theta_0\) should be equal to the intersection angle, and the initial flux coordinate should be \(\psi\). 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.Queue.plot_const_theta_cartesian_poincare(initial: bool = False, color: bool = False, show: bool = True) -> Canvas

Plots the \(\theta=const\) poincare map on the \(\zeta-\psi_p\) cartesian plane.

Parameters:

  • color (bool, default: False ) –

    Whether or not to use a different color for each orbit. Defaults to False.

  • initial (bool, default: False ) –

    Whether or not to plot the initial points. Note that the initial \(\zeta_0\) should be equal to the intersection angle, and the initial flux coordinate should be \(\psi_p\). 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.Queue.plot_const_zeta_rz_poincare(equilibrium: Equilibrium, initial: bool = False, color: bool = False, show: bool = True) -> Canvas

Plots the \(\zeta=const\) poincare map on the \(R-Z\) coordinate system.

Parameters:

  • color (bool, default: False ) –

    Whether or not to use a different color for each orbit. Defaults to False.

  • initial (bool, default: False ) –

    Whether or not to plot the initial points. Note that the initial \(\theta_0\) should be equal to the intersection angle, and the initial flux coordinate should be \(\psi\). 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.Queue.plot_qkinetic_radial_sweep(lcfs_value: float | None = None, show: bool = True) -> Canvas

Plots the contained particles' calculated \(q_{kinetic}\) with respect to their \(\psi_0/\psi_{p,0}\).

This is useful for low energy particles and magnetic field lines, where $\Delta\psi \approx \(\Delta\psi_p \approx 0\).

Parameters:

  • lcfs_value (float | None, default: None ) –

    The value of the magnetic flux \(/psi/\psi_p\) at the Last Closed Flux Surface. If passed, the magnetic flux values are displayed with respect to it.

  • show (bool, default: True ) –

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

Returns:

  • Canvas –

    The produced Figure and Ax.

dexter.Queue.plot_qkinetic_pzeta_sweep(psip_last: float | None = None, show: bool = True) -> Canvas

Plots the contained particles' calculated \(q_{kinetic}\) with respect to their \(P_\zeta\).

Parameters:

  • psip_last (float | None, default: None ) –

    The value of the poloidal flux \(\psi_p\) at the Last Closed Flux Surface. If passed, the \(P_\zeta\) values are displayed with respect to \(\psi_{p,last}\)

  • show (bool, default: True ) –

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

Returns:

  • Canvas –

    The produced Figure and Ax.

dexter.Queue.plot_qkinetic_energy_sweep(show: bool = True) -> Canvas

Plots the contained particles' calculated \(q_{kinetic}\) with respect to their Energy.

Parameters:

  • show (bool, default: True ) –

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

Returns:

  • Canvas –

    The produced Figure and Ax.

dexter.Queue.plot_qkinetic_pzeta_energy3d(psip_last: float | None = None, show: bool = True) -> Canvas3d

Plots the contained particles' calculated \(q_{kinetic}\) with respect to their \(P_\zeta\) and \(E\).

Parameters:

  • psip_last (float | None, default: None ) –

    The value of the poloidal flux \(\psi_p\) at the Last Closed Flux Surface. If passed, the \(P_\zeta\) values are displayed with respect to \(\psi_{p,last}\)

  • show (bool, default: True ) –

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

Returns:

  • Canvas –

    The produced Figure and Ax.

dexter.Queue.from_particles(particles: list[Particle]) -> Queue classmethod

Creates a new Queue from a list of Particles, copying all their attributes.

dexter.Queue.retain_pzeta(span: tuple[float, float]) -> None

Iterates through self’s particles, keeping only the ones with an initial \(P_\zeta\) within the given span, discarding the rest.

dexter.Queue.retain_energy(span: tuple[float, float]) -> None

Iterates through self’s particles, keeping only the ones with an initial Energy within the given span, discarding the rest.

dexter.Queue.bin_pzeta(num_bins: int) -> None

Iterates through self’s particles, keeping only one particle in each Pζ bin.

Bins are defined as the intervals: $$ P_{\zeta, min} <= P_{\zeta, min} + \Delta P_\zeta <= P_{\zeta, min} + 2\Delta P_\zeta <= ... <= P_{\zeta, min} + (n-1)\Delta P_\zeta <= P_{\zeta, max}, $$ where \(n\)=1..num_bins and \(\Delta P_\zeta = (P_{\zeta,max} - P_{\zeta,min})/n\).

When called after retain_energy with a small energy span, we can obtain a set of particles of approximately same energy and approximately equispaced \(P_\zeta\)s, depending on the span and num_bins parameters. This is useful since we essentially have no control over the particles’ energies.

Note

Particles are visited in order of instantiation, and the first particle that falls in an unfilled bin will be selected.

dexter.Queue.retain_energy_pzeta_positions(positions: Iterable[EnergyPzetaPosition]) -> None

Iterates through self’s particles, keeping only the ones with an EnergyPzetaPosition that matches an element of positions.

dexter.Queue.retain_orbit_types(orbit_types: Iterable[OrbitType]) -> None

Iterates through self’s particles, keeping only the ones with an OrbitType that matches an element of orbit_types.

dexter.Queue.integrate(equilibrium: Equilibrium, teval: tuple[float, float], *, stepping_method: Optional[SteppingMethod] = 'EnergyAdaptiveStep', max_steps: Optional[int] = 1000000, first_step: Optional[float] = 0.1, safety_factor: Optional[float] = 0.9, energy_rel_tol: Optional[float] = 1e-12, energy_abs_tol: Optional[float] = 1e-14, error_rel_tol: Optional[float] = 1e-12, error_abs_tol: Optional[float] = 1e-14)

Integrates all the contained particles for a specific time interval.

The time interval is in Normalized Units (inverse gyro-frequency).

Parameters:

  • equilibrium (Equilibrium) –

    The equilibrium in which to integrate the particle.

  • teval (tuple[float, float]) –

    The time span \((t_0, t_f)\) in which to integrate the particles, in Normalized Units.

Other Parameters:

  • stepping_method (Optional[SteppingMethod]) –

    The optimal step calculation method. Defaults to "EnergyAdaptiveStep".

  • max_steps (Optional[int]) –

    The maximum amount of steps a particle can make before terminating its integration. Defaults to 1.000.000.

  • first_step (Optional[float]) –

    The initial time step for the RKF45 adaptive step method. The value is empirical. Defaults to 1e-1.

  • safety_factor (Optional[float]) –

    The safety factor of the solver. Should be less than 1.0. Defaults to 0.9.

  • energy_rel_tol (Optional[float]) –

    The relative tolerance of the energy difference in every step. Defaults to 1e-12.

  • energy_abs_tol (Optional[float]) –

    The absolute tolerance of the energy difference in every step. Defaults to 1e-14.

  • error_rel_tol (Optional[float]) –

    The relative tolerance of the local truncation error in every step. Defaults to 1e-12.

  • error_abs_tol (Optional[float]) –

    The absolute tolerance of the local truncation error in every step. Defaults to 1e-14.

Example
Queue integration
>>> # Equilibrium setup
>>> LCFS = dex.LastClosedFluxSurface(kind="Toroidal", value=0.45)
>>> equilibrium = dex.Equilibrium(
...     qfactor=dex.ParabolicQfactor(qaxis=1.1, qlast=4.1, lcfs=LCFS),
...     current=dex.LarCurrent(),
...     bfield=dex.LarBfield(),
...     perturbation=dex.Perturbation(
...         [
...             dex.CosHarmonic(epsilon=1e-3, lcfs=LCFS, m=1, n=3, phase=0),
...             dex.CosHarmonic(epsilon=1e-3, lcfs=LCFS, m=2, n=3, phase=0),
...         ]
...     )
... )
>>>
>>> # Initial Conditions setup
>>> num = 10
>>> psi0s = InitialFluxArray("Toroidal", np.linspace(0, 0.5, num))
>>>
>>> initial_conditions = QueueInitialConditions.boozer(
...     t0=np.zeros(num),
...     flux0=psi0s,
...     theta0=np.zeros(num),
...     zeta0=np.zeros(num),
...     rho0=np.logspace(1e-6, 1e-5, num),
...     mu0=np.full(num, 1e-6),
... )
>>>
>>> # Queue setup
>>> queue = dex.Queue(initial_conditions)
>>>
>>> # Run
>>> queue.integrate(
...     equilibrium=    equilibrium,
...     teval=(0, 1e2),
...     first_step=1e-3,
...     energy_rel_tol=1e-11,
... )

dexter.Queue.intersect(equilibrium: Equilibrium, intersect_params: IntersectParams, *, stepping_method: Optional[SteppingMethod] = 'EnergyAdaptiveStep', max_steps: Optional[int] = 1000000, first_step: Optional[float] = 0.1, safety_factor: Optional[float] = 0.9, energy_rel_tol: Optional[float] = 1e-12, energy_abs_tol: Optional[float] = 1e-14, error_rel_tol: Optional[float] = 1e-12, error_abs_tol: Optional[float] = 1e-14)

Integrates all the contained particles, calculating their intersections with a constant \(\theta\) or \(\zeta\) surface.

Otherwise known as a Poincare map.

The intersection surface, angle, and number of turns are configured with the helper class IntersectParams.

Parameters:

  • equilibrium (Equilibrium) –

    The equilibrium in which to integrate the particle.

  • intersect_params (IntersectParams) –

    The parameters of the integration.

Other Parameters:

  • stepping_method (Optional[SteppingMethod]) –

    The optimal step calculation method. Defaults to "EnergyAdaptiveStep".

  • max_steps (Optional[int]) –

    The maximum amount of steps a particle can make before terminating its integration. Defaults to 1.000.000.

  • first_step (Optional[float]) –

    The initial time step for the RKF45 adaptive step method. The value is empirical. Defaults to 1e-1.

  • safety_factor (Optional[float]) –

    The safety factor of the solver. Should be less than 1.0. Defaults to 0.9.

  • energy_rel_tol (Optional[float]) –

    The relative tolerance of the energy difference in every step. Defaults to 1e-12.

  • energy_abs_tol (Optional[float]) –

    The absolute tolerance of the energy difference in every step. Defaults to 1e-14.

  • error_rel_tol (Optional[float]) –

    The relative tolerance of the local truncation error in every step. Defaults to 1e-12.

  • error_abs_tol (Optional[float]) –

    The absolute tolerance of the local truncation error in every step. Defaults to 1e-14.

Example
Queue intersection integration
>>> # Equilibrium setup
>>> LCFS = dex.LastClosedFluxSurface(kind="Toroidal", value=0.45)
>>> equilibrium = dex.Equilibrium(
...     qfactor=dex.ParabolicQfactor(qaxis=1.1, qlast=4.1, lcfs=LCFS),
...     current=dex.LarCurrent(),
...     bfield=dex.LarBfield(),
...     perturbation=dex.Perturbation(
...         [
...             dex.CosHarmonic(epsilon=1e-3, lcfs=LCFS, m=1, n=3, phase=0),
...             dex.CosHarmonic(epsilon=1e-3, lcfs=LCFS, m=2, n=3, phase=0),
...         ]
...     )
... )
>>>
>>> # Initial Conditions setup
>>> num = 10
>>> psi0s = InitialFluxArray("Toroidal", np.linspace(0.01, 0.4, num))
>>>
>>> initial_conditions = QueueInitialConditions.mixed(
...     t0=np.zeros(num),
...     flux0=psi0s,
...     theta0=np.zeros(num),
...     zeta0=np.zeros(num),
...     pzeta0=np.logspace(-0.02, 0.01, num),
...     mu0=np.full(num, 7e-7),
... )
>>>
>>> # IntersectParams setup
>>> intersect_params = dex.IntersectParams(
...     intersection = "ConstZeta",
...     angle = 0.0,
...     turns = 5,
... )
>>>
>>> # Queue setup
>>> queue = dex.Queue(initial_conditions)
>>>
>>> # Run
>>> queue.intersect(
...     equilibrium=equilibrium,
...     intersect_params=intersect_params,
...     energy_rel_tol=1e-11,
... )

dexter.Queue.close(equilibrium: Equilibrium, *, periods: Optional[int] = 1, stepping_method: Optional[SteppingMethod] = 'EnergyAdaptiveStep', max_steps: Optional[int] = 1000000, first_step: Optional[float] = 0.1, safety_factor: Optional[float] = 0.9, energy_rel_tol: Optional[float] = 1e-12, energy_abs_tol: Optional[float] = 1e-14, error_rel_tol: Optional[float] = 1e-12, error_abs_tol: Optional[float] = 1e-14)

Integrates all the contained particles for a certain amount of \(\theta-\psi\) periods.

Parameters:

  • equilibrium (Equilibrium) –

    The equilibrium in which to integrate the particle.

  • periods (Optional[int], default: 1 ) –

    The amount of periods to integrate. Defaults to 1.

Other Parameters:

  • stepping_method (Optional[SteppingMethod]) –

    The optimal step calculation method. Defaults to "EnergyAdaptiveStep".

  • max_steps (Optional[int]) –

    The maximum amount of steps a particle can make before terminating its integration. Defaults to 1.000.000.

  • first_step (Optional[float]) –

    The initial time step for the RKF45 adaptive step method. The value is empirical. Defaults to 1e-1.

  • safety_factor (Optional[float]) –

    The safety factor of the solver. Should be less than 1.0. Defaults to 0.9.

  • energy_rel_tol (Optional[float]) –

    The relative tolerance of the energy difference in every step. Defaults to 1e-12.

  • energy_abs_tol (Optional[float]) –

    The absolute tolerance of the energy difference in every step. Defaults to 1e-14.

  • error_rel_tol (Optional[float]) –

    The relative tolerance of the local truncation error in every step. Defaults to 1e-12.

  • error_abs_tol (Optional[float]) –

    The absolute tolerance of the local truncation error in every step. Defaults to 1e-14.

Example
Queue intersection integration
>>> # Equilibrium setup
>>> LCFS = dex.LastClosedFluxSurface(kind="Toroidal", value=0.45)
>>> equilibrium = dex.Equilibrium(
...     qfactor=dex.ParabolicQfactor(qaxis=1.1, qlast=4.1, lcfs=LCFS),
...     current=dex.LarCurrent(),
...     bfield=dex.LarBfield(),
...     perturbation=dex.Perturbation([])
... )
>>>
>>> # Initial Conditions setup
>>> num = 10
>>> psi0s = InitialFluxArray("Toroidal", np.linspace(0.01, 0.4, num))
>>>
>>> initial_conditions = QueueInitialConditions.boozer(
...     t0=np.zeros(num),
...     flux0=psi0s,
...     theta0=np.zeros(num),
...     zeta0=np.zeros(num),
...     rho0=np.full(num, 1e-5),
...     mu0=np.full(num, 7e-7),
... )
>>>
>>> # Queue setup
>>> queue = dex.Queue(initial_conditions)
>>>
>>> # Run
>>> queue.close(
...     equilibrium=equilibrium,
...     periods=1,
...     energy_rel_tol=1e-11,
... )

dexter.Queue.classify(equilibrium: Equilibrium)

Classifies the particles' orbits using their position on the \((E, P_\zeta, \mu=const)\) plane without integrating.

Parameters:

  • equilibrium (Equilibrium) –

    The equilibrium in which to integrate the particles.

Example
Queue Classification
>>> # Equilibrium setup
>>> LCFS = dex.LastClosedFluxSurface(kind="Toroidal", value=0.45)
>>> equilibrium = dex.Equilibrium(
...     qfactor=dex.ParabolicQfactor(qaxis=1.1, qlast=4.1, lcfs=LCFS),
...     current=dex.LarCurrent(),
...     bfield=dex.LarBfield(),
... )
>>>
>>> # Initial Conditions setup
>>> num = 10
>>> psi0s = InitialFluxArray("Toroidal", np.linspace(0.01, 0.4, num))
>>>
>>> initial_conditions = QueueInitialConditions.boozer(
...     t0=np.zeros(num),
...     flux0=psi0s,
...     theta0=np.zeros(num),
...     zeta0=np.zeros(num),
...     rho0=np.full(num, 1e-5),
...     mu0=np.full(num, 7e-7),
... )
>>>
>>> # Queue setup
>>> queue = dex.Queue(initial_conditions)
>>>
>>> # Run
>>> queue.classify(equilibrium=equilibrium)