API Reference

TEQUILA

TEQUILA.solveFunction
solve(
    shot::Shot,
    its::Integer;
    tol::Real=0.0,
    relax::Real=1.0,
    debug::Bool=false,
    fit_fallback::Bool=true,
    concentric_first::Bool=true,
    P::Union{Nothing,Tuple{<:Union{FE_rep,Function},Symbol},Profile}=nothing,
    dP_dψ::Union{Nothing,Tuple{<:Union{FE_rep,Function},Symbol},Profile}=nothing,
    F_dF_dψ::Union{Nothing,Tuple{<:Union{FE_rep,Function},Symbol},Profile}=nothing,
    Jt_R::Union{Nothing,Tuple{<:Union{FE_rep,Function},Symbol},Profile}=nothing,
    Jt::Union{Nothing,Tuple{<:Union{FE_rep,Function},Symbol},Profile}=nothing,
    Pbnd=shot.Pbnd,
    Fbnd=shot.Fbnd,
    Ip_target=shot.Ip_target
)

Solve the equilibrium, initially defined by shot with its iterations. Pressure and current information taken from shot unless provided in keywords

Returns a new Shot, often called refill by convention

Keyword arguments

  • tol - Relative tolerance for convergence of the magnetic axis flux value to terminate iterations early
  • relax - Relaxation parameter on the Picard iterations. Ψₙ₊₁ = relax * Ψ̃ₙ₊₁ + (1 - relax) * Ψₙ
  • debug=true - Print debugging and convergence information
  • fit_fallback=true - Use concentric surfaces if any flux surface errors on refitting. Improves robustness in early iterations
  • concentric_first=true - Use concentric surfaces for first iteration, which can improve robustness if large changes from shot is expected
source
TEQUILA.FSAFunction
FSA(f::F1, shot::F2, ρ::Real; tid=Threads.threadid()) where {F1,F2<:Shot}

Compute flux-surface average of f at ρ for the equilibrium defined in shot

Here f is a function of θ only, so something like f = θ -> F(ρ, θ) may be required

source
FSA(f::F1, shot::F2, ρ::Real, Vprime::F3; tid=Threads.threadid()) where {F1,F2<:Shot,F3<:FE_rep}

Compute flux-surface average of f at ρ for the equilibrium defined in shot, using the given finite-element representation of Vprime

Here f is a function of θ only, so something like f = θ -> F(ρ, θ) may be required

source
FSA(f::F1, shot::F2, ρ::Real, Vprime::Real; tid=Threads.threadid()) where {F1,F2<:Shot}

Compute flux-surface average of f at ρ for the equilibrium defined in shot, using the given value of Vprime

Here f is a function of θ only, so something like f = θ -> F(ρ, θ) may be required

source
TEQUILA.IpFunction
Ip(shot::F1; ε::Real=1e-6) where {F1<:Shot}

Returns the plasma current of shot

source
TEQUILA.ShotType
Shot{
    I1<:Integer,
    VR1<:AbstractVector{<:Real},
    MR1<:AbstractMatrix{<:Real},
    MR2<:AbstractMatrix{<:Real},
    PT1<:Union{Nothing,Profile},
    PT2<:Union{Nothing,Profile},
    PT3<:Union{Nothing,Profile},
    PT4<:Union{Nothing,Profile},
    PT5<:Union{Nothing,Profile},
    R1<:Real,
    R2<:Real,
    IP1<:Union{Nothing,Real},
    FE1<:FE_rep,
    VFE1<:AbstractVector{<:FE_rep},
    Q1<:QuadInfo,
    VDC1<:Vector{<:DiffCache},
    F1<:Factorization
} <: AbstractEquilibrium

The fundamental data structure for a TEQUILA equilibrium, storing grid, flux-surface, and equilibrium information, as well as preallocated work arrays

shot(R,Z) returns the flux at point (R,Z)

source
TEQUILA.VprimeFunction
Vprime(shot::F1, ρ::Real; tid=Threads.threadid()) where {F1<:Shot}

Compute dV/dρ at ρ for the equilibrium defined in shot

source
TEQUILA.find_axisFunction
find_axis(shot::Shot)

Returns the location and flux value of the magnetic axis, (Raxis, Zaxis, Ψaxis)

source
find_axis(Ψ, R0::Real, Z0::Real)

Returns the location and flux value of the magnetic axis, (Raxis, Zaxis, Ψaxis), with initial guess (R0, Z0)

source
TEQUILA.fsa_invRFunction
fsa_invR(shot::F1, ρ; tid=Threads.threadid()) where {F1<:Shot}

Compute <R⁻¹> at ρ for the equilibrium defined in shot

source
TEQUILA.fsa_invR2Function
fsa_invR2(shot::F1, ρ; tid=Threads.threadid()) where {F1<:Shot}

Compute <R⁻²> at ρ for the equilibrium defined in shot

source
TEQUILA.psi_ρθFunction
psi_ρθ(shot::Shot, ρ::Real, θ::Real)

Return the flux from shot at the MXH (ρ, θ)

source