Skip to content

Initial Conditions

Types associated with Particle and Queue initialization.


dexter.InitialConditions()

Initial conditions set for a Particle.

This type is instantiated through the Boozer and Mixed class methods.

Attributes:

  • t0 (float) –

    The initial time $t_0$.

  • flux0 (MagneticFlux) –

    The initial magnetic flux $\psi_{t,0}$ or $\psi_{p,0}$.

  • theta0 (float) –

    The initial $\theta$ angle.

  • theta0 (float) –

    The initial $\zeta$ angle.

  • rho0 (float) –

    The initial $\rho_{||,0}$. If the set was initialized from Mixed and no particle routines have run, raises AttributeError.

  • pzeta0 (float) –

    The initial $P_{\zeta,0}$. If the set was initialized from Boozer and no particle routines have run, raises AttributeError.

  • coordinate_set (CoordinateSet) –

    The kind of initial conditions set.

Boozer(t0: float, flux0: MagneticFlux, theta0: float, zeta0: float, rho0: float, mu0: float) -> InitialConditions classmethod

Creates initial conditions for a Particle in Boozer coordinates.

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

Parameters:

  • t0 (float) –

    The initial time, in Normalized Units.

  • flux0 (MagneticFlux) –

    The initial $\psi$, in Normalized Units.

  • theta0 (float) –

    The initial $\theta$ angle, in rads.

  • zeta0 (float) –

    The initial $\zeta$ angle, in rads.

  • rho0 (float) –

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

  • mu0 (float) –

    The initial magnetic moment $\mu$, in Normalized Units.

Example
InitialConditions definition in Boozer-Toroidal coordinates
>>> initial_conditions = dex.InitialConditions.Boozer(
...     t0=0,
...     flux0=dex.MagneticFlux.Toroidal(0.01),  # ψt0 = 0.01
...     theta0=3.14,
...     zeta0=0,
...     rho0=1e-4,
...     mu0=7e-6,
... )

Mixed(t0: float, flux0: MagneticFlux, theta0: float, zeta0: float, pzeta0: float | MagneticFlux, mu0: float) -> InitialConditions classmethod

Creates initial conditions for a Particle in Mixed coordinates.

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

Parameters:

  • t0 (float) –

    The initial time, in Normalized Units.

  • flux0 (MagneticFlux) –

    The initial $\psi$, in Normalized Units.

  • theta0 (float) –

    The initial $\theta$ angle, in rads.

  • zeta0 (float) –

    The initial $\zeta$ angle, in rads.

  • pzeta0 (float | MagneticFlux) –

    The initial $P_\zeta$, in Normalized Units.

  • mu0 (float) –

    The initial magnetic moment $\mu$, in Normalized Units.

Example
InitialConditions definition in Mixed-Poloidal coordinates
>>> flux0=dex.MagneticFlux.Poloidal(0.02)  # ψp0 = 0.02
>>> initial_conditions = dex.InitialConditions.Mixed(
...     t0=0,
...     flux0=flux0,
...     theta0=3.14,
...     zeta0=0,
...     pzeta0=-0.4 * flux0.value,
...     mu0=7e-6,
... )

dexter.MagneticFluxArray()

A container of multiple magnetic flux values and their kind.

This type is instantiated through the Toroidal and Poloidal class methods.

Attributes:

  • values (Array1) –

    The contained values as a 1D Array.

  • kind (MagneticFluxKind) –

    The magnetic flux' kind.

Toroidal(array: ArrayLike) -> MagneticFluxArray classmethod

Defines an array of toroidal fluxes $\psi_t$.

Parameters:

  • array (ArrayLike) –

    The values of the toroidal magnetic fluxes.

Example
Toroidal MagneticFluxArray creation
>>> psit_array = dex.MagneticFluxArray.Toroidal(np.linspace(0, 0.05, 30))

Poloidal(array: ArrayLike) -> MagneticFluxArray classmethod

Defines an array of poloidal fluxes $\psi_p$.

Parameters:

  • array (ArrayLike) –

    The values of the poloidal magnetic fluxes.

Example
Poloidal MagneticFluxArray creation
>>> psip_array = dex.MagneticFluxArray.Poloidal([0.1, 0.2, 0.3])

__len__() -> int

Returns the number of contained values.

__getitem__(index: int) -> MagneticFlux

Returns a MagneticFlux of the same kind and value of self.values[index].


dexter.QueueInitialConditions()

Sets of initial conditions for initializing a Queue.

This type is instantiated through the Boozer and Mixed class methods.

Boozer(t0: Array1, flux0: MagneticFluxArray, theta0: Array1, zeta0: Array1, rho0: Array1, mu0: Array1) -> QueueInitialConditions classmethod

Creates sets of initial conditions for a Particle in Boozer coordinates.

The initial conditions are defined on the $(t, \psi_t, \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 (MagneticFluxArray) –

    The initial $\psi$ values, in Normalized Units.

  • theta0 (Array1) –

    The initial $\theta$ angles, in rads.

  • zeta0 (Array1) –

    The initial $\zeta$ angles, in rads.

  • rho0 (Array1) –

    The initial $\rho_{||}$ values, in Normalized Units.

  • mu0 (Array1) –

    The initial magnetic moments $\mu$, in Normalized Units.

Example
QueueInitialConditions definition in Boozer-Toroidal coordinates
>>> num = 10
>>> psit0s = dex.MagneticFluxArray.Toroidal(np.linspace(0, 0.05, num))
>>> initial_conditions = dex.QueueInitialConditions.Boozer(
...     t0=np.zeros(num),
...     flux0=psit0s,
...     theta0=np.zeros(num),
...     zeta0=np.zeros(num),
...     rho0=np.full(num, 1e-5),
...     mu0=np.full(num, 1e-6),
... )

Mixed(t0: Array1, flux0: MagneticFluxArray, theta0: Array1, zeta0: Array1, pzeta0: Array1, mu0: Array1) -> QueueInitialConditions classmethod

Creates sets of initial conditions for a Particle in Boozer coordinates.

The initial conditions are defined on the $(t, \psi_t, \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 (MagneticFluxArray) –

    The initial $\psi$ values, 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$ values, in Normalized Units.

  • mu0 (Array1) –

    The initial magnetic moments $\mu$, in Normalized Units.

Example
QueueInitialConditions definition in Mixed-Poloidal coordinates
>>> num = 10
>>> psip0s = dex.MagneticFluxArray.Poloidal(np.linspace(0, 0.05, num))
>>> initial_conditions = dex.QueueInitialConditions.Mixed(
...     t0=np.zeros(num),
...     flux0=psip0s,
...     theta0=np.zeros(num),
...     zeta0=np.zeros(num),
...     pzeta0=np.full(num, -0.02),
...     mu0=np.full(num, 1e-6),
... )