Skip to content

ParabolicQfactor

q-factor profile described by the following formulas:

\[ q(\psi) = q_{axis} + (q_{LCFS} - q_{axis}) \bigg( \dfrac{\psi}{\psi_{LCFS}} \bigg)^2 \]
\[ \psi_p(\psi) = \dfrac{\psi_{LCFS}}{\sqrt{q_{axis}(q_{LCFS} - q_{axis})}} \arctan\bigg[ \dfrac{\psi\sqrt{q_{LCFS} - q_{axis}}}{\psi_{LCFS}\sqrt{q_{axis}}} \bigg] \]
\[ \psi(\psi_p) = \dfrac{\psi_{LCFS}\sqrt{q_{axis}}}{\sqrt{q_{LCFS} - q_{axis}}} \tan\bigg[ \dfrac{\sqrt{q_{axis}(q_{LCFS} - q_{axis})}}{\psi_{LCFS}}\psi_p \bigg] \]
\[ \dfrac{d\psi_p(\psi)}{d\psi} = ... = \dfrac{1}{q(\psi)} = \iota(\psi) \]
\[ \dfrac{d\psi(\psi_p)}{d\psi_p} = \dfrac{q_{axis}}{\cos^2 \bigg[ \dfrac{\sqrt{q_{axis}(q_{LCFS} - q_{axis})}}{\psi_{LCFS}}\psi_p \bigg]} \overset{*}{=} q(\psi_p) \]
\[ q(\psi_p) = q_{axis} + q_{axis} \tan^2 \bigg[ \dfrac{\sqrt{q_{axis}(q_{LCFS}-q_{axis})}}{\psi_{LCFS}} \psi_p \bigg] \]

\(^*\) Identity: \(\dfrac{1}{\cos^2\theta} = 1 + \tan^2\theta\)

dexter.ParabolicQfactor(qaxis: float, qlast: float, lcfs: LastClosedFluxSurface)

Analytical q-factor of parabolic q(ψ) profile.

Note

A ParabolicQfactor is defined with the help of the LastClosedFluxSurface helper type, which changes the position where qlast is met.

Parameters:

  • qaxis (float) –

    The value of \(q\) on the magnetic axis.

  • qlast (float) –

    The value of \(q\) at the last closed flux surface.

  • lcfs (LastClosedFluxSurface) –

    Helper type to define the Last Closed Flux Surface (LCFS) with respect to one of the two fluxes.

Example
UnityQfactor creation
>>> # Define q(ψ=ψlast=0.45) = qlast = 3.8
>>> LCFS = dex.LastClosedFluxSurface(kind="Toroidal", value=0.45)
>>> qfactor = dex.ParabolicQfactor(qaxis=1.1, qlast=3.8, lcfs=LCFS)

Methods:

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.

  • psi_last (float) –

    The value of the last closed toroidal flux surface \(\psi_{LCFS}\) in Normalized Units.

  • psip_last (float) –

    The value of the last closed poloidal flux surface \(\psi_{p,LCFS}\) in Normalized Units.

  • qlast (float) –

    The value of \(q\) at the last closed flux surface.

  • qaxis (float) –

    The value of \(q\) on the magnetic axis.

dexter.ParabolicQfactor.psi_state: FluxState property

The state of the toroidal flux coordinate.

dexter.ParabolicQfactor.psip_state: FluxState property

The state of the poloidal flux coordinate.

dexter.ParabolicQfactor.equilibrium_type: EquilibriumType property

The object's equilibrium's type.

dexter.ParabolicQfactor.psi_last: float property

The value of the last closed toroidal flux surface \(\psi_{LCFS}\) in Normalized Units.

dexter.ParabolicQfactor.psip_last: float property

The value of the last closed poloidal flux surface \(\psi_{p,LCFS}\) in Normalized Units.

dexter.ParabolicQfactor.qlast: float property

The value of \(q\) at the last closed flux surface.

dexter.ParabolicQfactor.qaxis: float property

The value of \(q\) on the magnetic axis.

dexter.ParabolicQfactor.q_of_psi(psi: ArrayLike) -> NDArray

The \(q(\psi)\) value.

Parameters:

  • psi (ArrayLike) –

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

dexter.ParabolicQfactor.q_of_psip(psip: ArrayLike) -> NDArray

The \(q(\psi_p)\) value.

Parameters:

  • psip (ArrayLike) –

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

dexter.ParabolicQfactor.dpsip_dpsi(psi: ArrayLike) -> NDArray

The derivative \(d\psi_p(\psi)/d\psi\) value in Normalized Units.

It's a good check that the values coincide with qfactor.iota_of_psi(psi).

Parameters:

  • psi (ArrayLike) –

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

dexter.ParabolicQfactor.dpsi_dpsip(psip: ArrayLike) -> NDArray

The derivative \(d\psi(\psi_p)/d\psi_p\) value in Normalized Units.

It's a good check that the values coincide with qfactor.q_of_psip(psip).

Parameters:

  • psip (ArrayLike) –

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

dexter.ParabolicQfactor.iota_of_psi(psi: ArrayLike) -> NDArray

The \(\iota(\psi) = \dfrac{1}{q(\psi)}\) value.

Parameters:

  • psi (ArrayLike) –

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

dexter.ParabolicQfactor.iota_of_psip(psip: ArrayLike) -> NDArray

The \(\iota(\psi_p) = \dfrac{1}{q(\psi_p)}\) value.

Parameters:

  • psip (ArrayLike) –

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

dexter.ParabolicQfactor.plot_q_of_psi(points: int = 1000, data: bool = False, show: bool = True) -> Canvas

Plots \(q(\psi)\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(q(\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.ParabolicQfactor.plot_q_of_psip(points: int = 1000, data: bool = False, show: bool = True) -> Canvas

Plots \(q(\psi_p)\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(q(\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.ParabolicQfactor.plot_dpsip_dpsi(points: int = 1000, show: bool = True) -> Canvas

Plots \(d\psi_p(\psi)/d\psi\) and \(\iota(\psi)\).

This is a check to make sure the two quantities do indeed overlap.

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate the two splines. 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.ParabolicQfactor.plot_dpsi_dpsip(points: int = 1000, show: bool = True) -> Canvas

Plots \(d\psi(\psi_p)/d\psi_p\) and \(q(\psi_p)\).

This is a check to make sure the two quantities do indeed overlap.

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate the two splines. 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.ParabolicQfactor.plot_iota_of_psi(points: int = 1000, show: bool = True) -> Canvas

Plots \(\iota(\psi)\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(\iota(\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.ParabolicQfactor.plot_iota_of_psip(points: int = 1000, show: bool = True) -> Canvas

Plots \(\iota(\psi_p)\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(\iota(\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.ParabolicQfactor.psip_of_psi(psi: ArrayLike) -> NDArray

The \(\psi_p(\psi)\) value in Normalized Units.

Parameters:

  • psi (ArrayLike) –

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

dexter.ParabolicQfactor.psi_of_psip(psip: ArrayLike) -> NDArray

The \(\psi(\psi_p)\) value in Normalized Units.

Parameters:

  • psip (ArrayLike) –

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

dexter.ParabolicQfactor.plot_psip_of_psi(points: int = 1000, data: bool = False, show: bool = True) -> Canvas

Plots \(\psi(\psi_p)\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(\psi_p(\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.ParabolicQfactor.plot_psi_of_psip(points: int = 1000, data: bool = False, show: bool = True) -> Canvas

Plots \(\psi(\psi_p)\).

Parameters:

  • points (int, default: 1000 ) –

    The number of points in which to evaluate \(\psi(\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.ParabolicQfactor.psi_of_q(q: ArrayLike) -> NDArray

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

Parameters:

  • q (ArrayLike) –

    The q-factor value \(q\).

dexter.ParabolicQfactor.psip_of_q(q: ArrayLike) -> NDArray

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

Parameters:

  • q (ArrayLike) –

    The q-factor value \(q\).