Skip to content

CosHarmonic

A simple analytical Harmonic of the form:

\[ \alpha\cos(m\theta-n\zeta + \phi) \]

where \(\alpha\), \(\phi\) constants.

dexter.CosHarmonic(epsilon: float, lcfs: LastClosedFluxSurface, m: int, n: int, phase: float)

A simple analytical Harmonic of the form αcos(mθ-nζ+φ), where α, φ constants.

Parameters:

  • epsilon (float) –

    The harmonic's constant amplitude \(\alpha\) in Normalized Units.

  • lcfs (LastClosedFluxSurface) –

    The harmonic’s last closed flux surface.

  • m (int) –

    The poloidal mode number \(m\).

  • n (int) –

    The poloidal mode number \(n\).

  • phase (float) –

    The harmonic's constant phase \(\phi\) in \([rads]\).

Example
CosHarmonic creation
>>> LCFS = LastClosedFluxSurface("Toroidal", 0.45)
>>> harmonic = dex.CosHarmonic(epsilon=1e-3, lcfs=LCFS, m=3, n=2, phase=0)

Methods:

  • alpha_of_psi

    The harmonic's amplitude \(\alpha(\psi, \theta, \zeta, t)\) value in Normalized Units.

  • alpha_of_psip

    The harmonic's amplitude \(\alpha(\psi_p, \theta, \zeta, t)\) value in Normalized Units.

  • phase_of_psi

    The harmonic's phase \(\phi(\psi, \theta, \zeta, t)\) value in Normalized Units.

  • phase_of_psip

    The harmonic's phase \(\phi(\psi_p, \theta, \zeta, t)\) value in Normalized Units.

  • plot_alpha_of_psi

    Plots the harmonic's amplitude \(\alpha(\psi)\).

  • plot_alpha_of_psip

    Plots the harmonic's amplitude \(\alpha(\psi_p)\).

  • plot_phase_of_psi

    Plots the harmonic's phase \(\phi(\psi)\).

  • plot_phase_of_psip

    Plots the harmonic's phase \(\phi(\psi_p)\).

  • plot_dalpha_of_psi

    Plots the harmonic's amplitude's deritave \(d\alpha(\psi)/d\psi\).

  • plot_dalpha_of_psip

    Plots the harmonic's amplitude's deritave \(d\alpha(\psi_p)/d\psi_p\).

  • h_of_psi

    The full harmonic's value \(h(\psi, \theta, \zeta, t)\) value in Normalized Units.

  • h_of_psip

    The full harmonic's value \(h(\psi_p, \theta, \zeta, t)\) value in Normalized Units.

  • dh_dpsi

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

  • dh_dpsip

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

  • dh_of_psi_dtheta

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

  • dh_of_psip_dtheta

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

  • dh_of_psi_dzeta

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

  • dh_of_psip_dzeta

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

  • dh_of_psi_dt

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

  • dh_of_psip_dt

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

Attributes:

  • psi_state (FluxState) –

    The state of the toroidal flux coordinate.

  • psip_state (FluxState) –

    The state of the poloidal flux coordinate.

  • equilibrium_type (EquilibriumType) –

    The object's equilibrium's type.

  • epsilon (float) –

    The harmonic's constant \(\epsilon\).

  • lcfs (LastClosedFluxSurface) –

    The Harmonic’s last closed flux surface.

  • m (int) –

    The harmonic's poloidal mode number \(m\).

  • n (int) –

    The harmonic's toroidal mode number \(n\).

  • phase (float) –

    The harmonic's constant phase \(\phi\) in \([rads]\).

  • psi_last (float) –

    Returns the value of the last closed toroidal flux \(\psi_{LCFS}\).

  • psip_last (float) –

    Returns the value of the last closed toroidal flux \(\psi_{p,LCFS}\).

dexter.CosHarmonic.psi_state: FluxState property

The state of the toroidal flux coordinate.

dexter.CosHarmonic.psip_state: FluxState property

The state of the poloidal flux coordinate.

dexter.CosHarmonic.equilibrium_type: EquilibriumType property

The object's equilibrium's type.

dexter.CosHarmonic.epsilon: float property

The harmonic's constant \(\epsilon\).

dexter.CosHarmonic.lcfs: LastClosedFluxSurface property

The Harmonic’s last closed flux surface.

dexter.CosHarmonic.m: int property

The harmonic's poloidal mode number \(m\).

dexter.CosHarmonic.n: int property

The harmonic's toroidal mode number \(n\).

dexter.CosHarmonic.phase: float property

The harmonic's constant phase \(\phi\) in \([rads]\).

dexter.CosHarmonic.psi_last: float property

Returns the value of the last closed toroidal flux \(\psi_{LCFS}\).

dexter.CosHarmonic.psip_last: float property

Returns the value of the last closed toroidal flux \(\psi_{p,LCFS}\).

dexter.CosHarmonic.alpha_of_psi(psi: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The harmonic's amplitude \(\alpha(\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.CosHarmonic.alpha_of_psip(psip: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The harmonic's amplitude \(\alpha(\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.CosHarmonic.phase_of_psi(psi: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The harmonic's phase \(\phi(\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.CosHarmonic.phase_of_psip(psip: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The harmonic's phase \(\phi(\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.CosHarmonic.plot_alpha_of_psi(points: int = 1000, data: bool = False, show: bool = True) -> Canvas

Plots the harmonic's amplitude \(\alpha(\psi)\).

Note

It is assumed that the amplitude \(\alpha\) is only a function of the flux.

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(\alpha(\psi)\). Defaults to 1000.

  • data (bool, default: False ) –

    Whether or not to plot the data array points (numerical equilibria only). 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.CosHarmonic.plot_alpha_of_psip(points: int = 1000, data: bool = False, show: bool = True) -> Canvas

Plots the harmonic's amplitude \(\alpha(\psi_p)\).

Note

It is assumed that the amplitude \(\alpha\) is only a function of the flux.

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(\alpha(\psi_p)\). Defaults to 1000.

  • data (bool, default: False ) –

    Whether or not to plot the data array points (numerical equilibria only). 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.CosHarmonic.plot_phase_of_psi(points: int = 1000, data: bool = False, resonance: bool = True, show: bool = True) -> Canvas

Plots the harmonic's phase \(\phi(\psi)\).

Note

It is assumed that the amplitude \(\phi\) is only a function of the flux.

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(\phi(\psi)\). Defaults to 1000.

  • data (bool, default: False ) –

    Whether or not to plot the data array points (numerical equilibria only). Defaults to False.

  • resonance (bool, default: True ) –

    Whether or not to plot the resonance location, if phase_method is Resonance. Defaults to True.

  • show (bool, default: True ) –

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

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.CosHarmonic.plot_phase_of_psip(points: int = 1000, data: bool = False, resonance: bool = True, show: bool = True) -> Canvas

Plots the harmonic's phase \(\phi(\psi_p)\).

Note

It is assumed that the amplitude \(\phi\) is only a function of the flux.

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(\phi(\psi_p)\). Defaults to 1000.

  • data (bool, default: False ) –

    Whether or not to plot the data array points (numerical equilibria only). Defaults to False.

  • resonance (bool, default: True ) –

    Whether or not to plot the resonance location, if phase_method is Resonance. Defaults to True.

  • show (bool, default: True ) –

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

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.CosHarmonic.plot_dalpha_of_psi(points: int = 1000, show: bool = True) -> Canvas

Plots the harmonic's amplitude's deritave \(d\alpha(\psi)/d\psi\).

Note

It is assumed that the amplitude \(\alpha\) is only a function of the flux.

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(d\alpha(\psi)/d\psi\). Defaults to 1000.

  • show (bool, default: True ) –

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

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.CosHarmonic.plot_dalpha_of_psip(points: int = 1000, show: bool = True) -> Canvas

Plots the harmonic's amplitude's deritave \(d\alpha(\psi_p)/d\psi_p\).

Note

It is assumed that the amplitude \(\alpha\) is only a function of the flux.

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(d\alpha(\psi_p)/d\psi_p\). Defaults to 1000.

  • show (bool, default: True ) –

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

Returns:

  • Canvas

    The produced Figure and Ax.

dexter.CosHarmonic.h_of_psi(psi: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The full harmonic's value \(h(\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.CosHarmonic.h_of_psip(psip: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The full harmonic's value \(h(\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.CosHarmonic.dh_dpsi(psi: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The harmonic's derivative with respect to \(\psi\), \(\partial h(\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.CosHarmonic.dh_dpsip(psip: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The harmonic's derivative with respect to \(\psi_p\), \(\partial h(\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.CosHarmonic.dh_of_psi_dtheta(psi: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The harmonic's derivative with respect to \(\theta\), \(\partial h(\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.CosHarmonic.dh_of_psip_dtheta(psip: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The harmonic's derivative with respect to \(\theta\), \(\partial h(\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.CosHarmonic.dh_of_psi_dzeta(psi: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The harmonic's derivative with respect to \(\zeta\), \(\partial h(\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.CosHarmonic.dh_of_psip_dzeta(psip: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The harmonic's derivative with respect to \(\zeta\), \(\partial h(\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.CosHarmonic.dh_of_psi_dt(psi: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The harmonic's derivative with respect to the time \(t\), \(\partial h(\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.CosHarmonic.dh_of_psip_dt(psip: ArrayLike, theta: ArrayLike, zeta: ArrayLike, t: ArrayLike) -> NDArray

The harmonic's derivative with respect to the time \(t\), \(\partial h(\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