Skip to content

Perturbation

A sum of an arbitrary number of Harmonics, of the general form:

\[ \sum_{\{m,n\}} \bigg[ \alpha_{\{m,n\}}(\psi/\psi_p, \theta, \zeta, t) \bigg] \]

with '\(\psi/\psi_p\)' meaning it can be expressed as a function of either/both flux coordinates.

dexter.Perturbation(harmonics: list[CosHarmonic] | list[NcHarmonic])

A sum of an arbitrary number of Harmonics.

Note

All the harmonics must be of the same type.

Parameters:

Example
Create a Perturbation of specific cosine harmonics
>>> LCFS = dex.LastClosedFluxSurface(kind="Toroidal", value=0.45)
>>> perturbation = dex.Perturbation(
...     [
...         dex.CosHarmonic(1e-3, LCFS, 1, 2, 0.0),
...         dex.CosHarmonic(1e-3, LCFS, 1, 3, 0.0),
...         dex.CosHarmonic(1e-3, LCFS, 1, 4, 0.0),
...         dex.CosHarmonic(1e-3, LCFS, 1, 5, 0.0),
...     ]
... )
CosPerturbation creation with list iteration
>>> LCFS = dex.LastClosedFluxSurface(kind="Toroidal", value=0.45)
>>> perturbation = dex.Perturbation(
...     [dex.CosHarmonic(1e-3, LCFS, 1, n, 0.0) for n in range(1, 8)] # modes with m=1 and n=1-7
... )
Create a Perturbation from numerical harmonics
>>> perturbation = dex.Perturbation(
...     [
...         dex.NcHarmonic(path, "cubic", 2, 1, phase_method="Interpolation"),
...         dex.NcHarmonic(path, "cubic", 2, 2, phase_method="Interpolation"),
...         dex.NcHarmonic(path, "cubic", 3, 2, phase_method="Interpolation"),
...     ]
... )

Methods:

  • p_of_psi

    The perturbation's value \(p(\psi, \theta, \zeta, t)\) value in Normalized Units.

  • p_of_psip

    The perturbation's value \(p(\psi_p, \theta, \zeta, t)\) value in Normalized Units.

  • dp_dpsi

    The perturbation's derivative with respect to \(\psi\), \(\partial p(\psi, \theta, \zeta, t)/\partial\psi\)

  • dp_dpsip

    The perturbation's derivative with respect to \(\psi_p\), \(\partial p(\psi_p, \theta, \zeta, t)/\partial \psi_p\)

  • dp_of_psi_dtheta

    The perturbation's derivative with respect to \(\theta\), \(\partial p(\psi, \theta, \zeta, t)/\partial \theta\)

  • dp_of_psip_dtheta

    The perturbation's derivative with respect to \(\theta\), \(\partial p(\psi_p, \theta, \zeta, t)/\partial \theta\)

  • dp_of_psi_dzeta

    The perturbation's derivative with respect to \(\zeta\), \(\partial p(\psi, \theta, \zeta, t)/\partial \zeta\)

  • dp_of_psip_dzeta

    The perturbation's derivative with respect to \(\zeta\), \(\partial p(\psi_p, \theta, \zeta, t)/\partial \zeta\)

  • dp_of_psi_dt

    The perturbation's derivative with respect to the time \(t\), \(\partial p(\psi, \theta, \zeta, t)/\partial t\)

  • dp_of_psip_dt

    The perturbation's derivative with respect to the time \(t\), \(\partial p(\psi_p, \theta, \zeta, t)/\partial t\)

  • __getitem__

    Makes the object indexable.

  • __len__

    Returns the number of the contained harmonics.

dexter.Perturbation.p_of_psi(psi: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The perturbation's value \(p(\psi, \theta, \zeta, t)\) value in Normalized Units.

Parameters:

  • psi (ArrayLike) –

    The toroidal flux \(\psi\) in Normalized Units.

  • theta (ArrayLike) –

    The \(\theta\) angle in \([rads]\).

  • zeta (ArrayLike) –

    The \(\zeta\) angle in \([rads]\).

  • t (ArrayLike) –

    The time in Normalized Units

dexter.Perturbation.p_of_psip(psip: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The perturbation's value \(p(\psi_p, \theta, \zeta, t)\) value in Normalized Units.

Parameters:

  • psip (ArrayLike) –

    The poloidal flux \(\psi_p\) in Normalized Units.

  • theta (ArrayLike) –

    The \(\theta\) angle in \([rads]\).

  • zeta (ArrayLike) –

    The \(\zeta\) angle in \([rads]\).

  • t (ArrayLike) –

    The time in Normalized Units

dexter.Perturbation.dp_dpsi(psi: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The perturbation's derivative with respect to \(\psi\), \(\partial p(\psi, \theta, \zeta, t)/\partial\psi\) in Normalized Units.

Parameters:

  • psi (ArrayLike) –

    The toroidal flux \(\psi\) in Normalized Units.

  • theta (ArrayLike) –

    The \(\theta\) angle in \([rads]\).

  • zeta (ArrayLike) –

    The \(\zeta\) angle in \([rads]\).

  • t (ArrayLike) –

    The time in Normalized Units

dexter.Perturbation.dp_dpsip(psip: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The perturbation's derivative with respect to \(\psi_p\), \(\partial p(\psi_p, \theta, \zeta, t)/\partial \psi_p\) in Normalized Units.

Parameters:

  • psip (ArrayLike) –

    The poloidal flux \(\psi_p\) in Normalized Units.

  • theta (ArrayLike) –

    The \(\theta\) angle in \([rads]\).

  • zeta (ArrayLike) –

    The \(\zeta\) angle in \([rads]\).

  • t (ArrayLike) –

    The time in Normalized Units

dexter.Perturbation.dp_of_psi_dtheta(psi: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The perturbation's derivative with respect to \(\theta\), \(\partial p(\psi, \theta, \zeta, t)/\partial \theta\) in Normalized Units, as a function of \(\psi\).

Parameters:

  • psi (ArrayLike) –

    The toroidal flux \(\psi\) in Normalized Units.

  • theta (ArrayLike) –

    The \(\theta\) angle in \([rads]\).

  • zeta (ArrayLike) –

    The \(\zeta\) angle in \([rads]\).

  • t (ArrayLike) –

    The time in Normalized Units

dexter.Perturbation.dp_of_psip_dtheta(psip: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The perturbation's derivative with respect to \(\theta\), \(\partial p(\psi_p, \theta, \zeta, t)/\partial \theta\) in Normalized Units, as a function of \(\psi_p\).

Parameters:

  • psip (ArrayLike) –

    The poloidal flux \(\psi_p\) in Normalized Units.

  • theta (ArrayLike) –

    The \(\theta\) angle in \([rads]\).

  • zeta (ArrayLike) –

    The \(\zeta\) angle in \([rads]\).

  • t (ArrayLike) –

    The time in Normalized Units

dexter.Perturbation.dp_of_psi_dzeta(psi: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The perturbation's derivative with respect to \(\zeta\), \(\partial p(\psi, \theta, \zeta, t)/\partial \zeta\) in Normalized Units, as a function of \(\psi\).

Parameters:

  • psi (ArrayLike) –

    The toroidal flux \(\psi\) in Normalized Units.

  • theta (ArrayLike) –

    The \(\theta\) angle in \([rads]\).

  • zeta (ArrayLike) –

    The \(\zeta\) angle in \([rads]\).

  • t (ArrayLike) –

    The time in Normalized Units

dexter.Perturbation.dp_of_psip_dzeta(psip: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The perturbation's derivative with respect to \(\zeta\), \(\partial p(\psi_p, \theta, \zeta, t)/\partial \zeta\) in Normalized Units, as a function of \(\psi_p\).

Parameters:

  • psip (ArrayLike) –

    The poloidal flux \(\psi_p\) in Normalized Units.

  • theta (ArrayLike) –

    The \(\theta\) angle in \([rads]\).

  • zeta (ArrayLike) –

    The \(\zeta\) angle in \([rads]\).

  • t (ArrayLike) –

    The time in Normalized Units

dexter.Perturbation.dp_of_psi_dt(psi: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The perturbation's derivative with respect to the time \(t\), \(\partial p(\psi, \theta, \zeta, t)/\partial t\) in Normalized Units, as a function of \(\psi\).

Parameters:

  • psi (ArrayLike) –

    The toroidal flux \(\psi\) in Normalized Units.

  • theta (ArrayLike) –

    The \(\theta\) angle in \([rads]\).

  • zeta (ArrayLike) –

    The \(\zeta\) angle in \([rads]\).

  • t (ArrayLike) –

    The time in Normalized Units

dexter.Perturbation.dp_of_psip_dt(psip: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The perturbation's derivative with respect to the time \(t\), \(\partial p(\psi_p, \theta, \zeta, t)/\partial t\) in Normalized Units, as a function of \(\psi_p\).

Parameters:

  • psip (ArrayLike) –

    The poloidal flux \(\psi_p\) in Normalized Units.

  • theta (ArrayLike) –

    The \(\theta\) angle in \([rads]\).

  • zeta (ArrayLike) –

    The \(\zeta\) angle in \([rads]\).

  • t (ArrayLike) –

    The time in Normalized Units

dexter.Perturbation.__getitem__(index: int)

Makes the object indexable.

dexter.Perturbation.__len__() -> int

Returns the number of the contained harmonics.