API Reference
VacuumFields
Missing docstring for AbstractCircuit
. Check Documenter's build log for details.
VacuumFields.AbstractCoil
— TypeAbstractCoil
Abstract coil type
VacuumFields.AbstractControlPoint
— TypeAbstractControlPoint{T<:Real}
Abstract control point - for coil current least-squres fitting
VacuumFields.DistributedCoil
— TypeDistributedCoil{T1<:Real,T2<:Real,T3<:Real,T4<:Real} <: AbstractSingleCoil{T1,T2,T3,T4}
Coil consisting of distributed filaments
VacuumFields.FluxControlPoint
— TypeFluxControlPoint(R::Real, Z::Real, target::Real, weight::Real=1.0)
Return a control point for a target
flux value at point (R, Z)
, with an optional weight
VacuumFields.FluxControlPoints
— FunctionFluxControlPoints(Rs::AbstractVector{<:Real}, Zs::AbstractVector{<:Real}, ψtarget::Real)
Return a Vector of FluxControlPoint at each Rs
and Zs
point, each with the same ψtarget
flux
FluxControlPoints(Rs::AbstractVector{<:Real}, Zs::AbstractVector{<:Real}, ψtargets::AbstractVector{<:Real})
Return a Vector of FluxControlPoint at each Rs
and Zs
point with ψtargets
flux
Missing docstring for GS_IMAS_pf_active__coil
. Check Documenter's build log for details.
Missing docstring for IMAS_pf_active__coils
. Check Documenter's build log for details.
VacuumFields.IsoControlPoint
— TypeIsoControlPoint(R::Real, Z::Real,weight::Real=1.0)
Return a control point for equal flux between points (R1, Z1)
and (R2, Z2)
, with an optional weight
VacuumFields.IsoControlPoints
— FunctionIsoControlPoints(Rs::AbstractVector{<:Real}, Zs::AbstractVector{<:Real})
Return a Vector of IsoControlPoints between each pair of Rs
and Zs
points
Missing docstring for MultiCoil
. Check Documenter's build log for details.
VacuumFields.ParallelogramCoil
— TypeParallelogramCoil{T1, T2, T3, T4} <: AbstractSingleCoil{T1, T2, T3, T4}
Parallelogram coil with the R, Z, ΔR, ΔZ, θ1, θ2 formalism (as used by EFIT, for example). Here θ1 and θ2 are the shear angles along the x- and y-axes, respectively, in degrees.
VacuumFields.PointCoil
— TypePointCoil{T1, T2, T3, T4} <: AbstractSingleCoil{T1, T2, T3, T4}
Point filament coil at scalar (R, Z) location
VacuumFields.QuadCoil
— TypeQuadCoil{T1, T2, T3, T4} <: AbstractSingleCoil{T1, T2, T3, T4}
Quadrilateral coil with counter-clockwise corners (starting from lower left) at R and Z
VacuumFields.SaddleControlPoint
— TypeSaddleControlPoint(R::Real, Z::Real,weight::Real=1.0)
Return a control point for a saddle (i.e., dψ/dR = dψ/dZ = 0.0) at point (R, Z)
, with an optional weight
VacuumFields.SaddleControlPoints
— FunctionSaddleControlPoints(Rs::AbstractVector{<:Real}, Zs::AbstractVector{<:Real})
Return a Vector of SaddleControlPoint at each Rs
and Zs
point
Missing docstring for SeriesCircuit
. Check Documenter's build log for details.
VacuumFields.boundary_control_points
— Functionboundary_control_points(EQfixed::MXHEquilibrium.AbstractEquilibrium, fraction_inside::Float64=0.999; Npts::Integer=99)
Return a Vector of IsoControlPoints, at Npts
equally distributed fraction_inside
percent inside the the boundary of EQfixed
boundary_control_points(EQfixed::MXHEquilibrium.AbstractEquilibrium, fraction_inside::Float64=0.999; Npts::Integer=99)
Return a Vector of IsoControlPoints, at Npts
equally distributed fraction_inside
percent inside the the boundary of shot
VacuumFields.d2M_dZ2
— Functiond2M_dZ2(EQ::MXHEquilibrium.AbstractEquilibrium, C::Union{AbstractCoil, IMAScoil}, δZ::Real=0.0;
+ COCOS::MXHEquilibrium.COCOS=MXHEquilibrium.cocos(EQ), kwargs...)
Compute the second Z derivative of the mutual inductance between an equilibrium and a coil, where the equilibrium is shifted vertically by δZ
d2M_dZ2(image::Image, C::Union{AbstractCoil, IMAScoil}, Ip::Real, δZ::Real=0.0;
+ COCOS::MXHEquilibrium.COCOS=MXHEquilibrium.cocos(EQ), kwargs...)
Compute the second Z derivative of the mutual inductance between an equilibrium's image current and a coil, where the equilibrium is shifted vertically by δZ
VacuumFields.dM_dZ
— FunctiondM_dZ(EQ::MXHEquilibrium.AbstractEquilibrium, C::Union{AbstractCoil, IMAScoil}, δZ::Real=0.0;
+ COCOS::MXHEquilibrium.COCOS=MXHEquilibrium.cocos(EQ), kwargs...)
Compute the Z derivative of the mutual inductance between an equilibrium and a coil, where the equilibrium is shifted vertically by δZ
dM_dZ(image::Image, C::Union{AbstractCoil, IMAScoil}, Ip::Real, δZ::Real=0.0;
+ COCOS::MXHEquilibrium.COCOS=MXHEquilibrium.cocos(EQ), kwargs...)
Compute the Z derivative of the mutual inductance between an equilibrium's image current and a coil, where the equilibrium is shifted vertically by δZ
VacuumFields.encircling_coils
— Functionencircling_coils(EQfixed::MXHEquilibrium.AbstractEquilibrium, n_coils::Int)
Return a Vector of n_coils
PointCoil
s distributed outside of EQfixed
's boundary
encircling_coils(shot::TEQUILA.Shot, n_coils::Int)
Return a Vector of n_coils
PointCoil
s distributed outside of shot
's boundary
encircling_coils(bnd_r::AbstractVector{T}, bnd_z::AbstractVector{T}, n_coils::Int) where {T<:Real}
Return a Vector of n_coils
PointCoil
s distributed outside of closed boundary defined by bnd_r
and bnd_z
VacuumFields.find_coil_currents!
— Functionfind_coil_currents!(
+ coils::AbstractVector{<:AbstractCoil},
+ EQ::MXHEquilibrium.AbstractEquilibrium;
+ flux_cps::Vector{<:FluxControlPoint}=FluxControlPoint{Float64}[],
+ saddle_cps::Vector{<:SaddleControlPoint}=SaddleControlPoint{Float64}[],
+ iso_cps::Vector{<:IsoControlPoint}=IsoControlPoint{Float64}[],
+ ψbound::Real=0.0,
+ fixed_coils::AbstractVector{<:AbstractCoil}=PointCoil{Float64,Float64}[],
+ λ_regularize::Float64=0.0,
+ Sb::MXHEquilibrium.Boundary=plasma_boundary_psi_w_fallback(EQ)[1])
Find the currents for coils
that best match (least-squares) the control points provided by flux_cps
, saddle_cps
, and iso_cps
Assumes flux from plasma current given by equilibrium EQ
with a ψbound
flux at the boundary Sb
Optionally assumes flux from additional fixed_coils
, whose currents will not change
λ_regularize
provides regularization in the least-squares fitting
find_coil_currents!(
+ coils::AbstractVector{<:AbstractCoil},
+ EQ::MXHEquilibrium.AbstractEquilibrium,
+ image::Image;
+ flux_cps::Vector{<:FluxControlPoint}=FluxControlPoint{Float64}[],
+ saddle_cps::Vector{<:SaddleControlPoint}=SaddleControlPoint{Float64}[],
+ iso_cps::Vector{<:IsoControlPoint}=IsoControlPoint{Float64}[],
+ ψbound::Real=0.0,
+ fixed_coils::AbstractVector{<:AbstractCoil}=PointCoil{Float64,Float64}[],
+ λ_regularize::Float64=0.0,
+ Sb::MXHEquilibrium.Boundary=plasma_boundary_psi_w_fallback(EQ)[1])
Find the currents for coils
that best match (leas-squares) the control points provided by flux_cps
, saddle_cps
, and iso_cps
Assumes flux from plasma current given by equilibrium EQ
with image currents image
and a ψbound
flux at the boundary Sb
Optionally assumes flux from additional fixed_coils
, whose currents will not change
λ_regularize
provides regularization in the least-squares fitting
find_coil_currents!(
+ coils::AbstractVector{<:AbstractCoil},
+ EQ::MXHEquilibrium.AbstractEquilibrium,
+ image::Image;
+ flux_cps::Vector{<:FluxControlPoint}=FluxControlPoint{Float64}[],
+ saddle_cps::Vector{<:SaddleControlPoint}=SaddleControlPoint{Float64}[],
+ iso_cps::Vector{<:IsoControlPoint}=IsoControlPoint{Float64}[],
+ ψbound::Real=0.0,
+ fixed_coils::AbstractVector{<:AbstractCoil}=PointCoil{Float64,Float64}[],
+ λ_regularize::Float64=0.0,
+ Sb::MXHEquilibrium.Boundary=plasma_boundary_psi_w_fallback(EQ)[1])
Find the currents for coils
that best match (leas-squares) the control points provided by flux_cps
, saddle_cps
, and iso_cps
Assumes flux from plasma current given by equilibrium EQ
with image currents image
and a ψbound
flux at the boundary Sb
Optionally assumes flux from additional fixed_coils
, whose currents will not change
λ_regularize
provides regularization in the least-squares fitting
find_coil_currents!(
+ coils::AbstractVector{<:AbstractCoil},
+ EQ::Nothing;
+ flux_cps::Vector{<:FluxControlPoint}=FluxControlPoint{Float64}[],
+ saddle_cps::Vector{<:SaddleControlPoint}=SaddleControlPoint{Float64}[],
+ iso_cps::Vector{<:IsoControlPoint}=IsoControlPoint{Float64}[],
+ ψbound::Real=0.0,
+ fixed_coils::AbstractVector{<:AbstractCoil}=PointCoil{Float64,Float64}[],
+ λ_regularize::Float64=0.0,
+ cocos=MXHEquilibrium.cocos(11),
+ Sb=nothing)
Find the currents for coils
that best match (leas-squares) the control points provided by flux_cps
, saddle_cps
, and iso_cps
Vacuume case: assumes no equilibrium plasma current
Optionally assumes flux from additional fixed_coils
, whose currents will not change
λ_regularize
provides regularization in the least-squares fitting
find_coil_currents!(
+ coils::AbstractVector{<:AbstractCoil},
+ EQ::Nothing, # VACUUM case
+ image::Nothing;
+ flux_cps::Vector{<:FluxControlPoint}=FluxControlPoint{Float64}[],
+ saddle_cps::Vector{<:SaddleControlPoint}=SaddleControlPoint{Float64}[],
+ iso_cps::Vector{<:IsoControlPoint}=IsoControlPoint{Float64}[],
+ ψbound::Real=0.0,
+ fixed_coils::AbstractVector{<:AbstractCoil}=PointCoil{Float64,Float64}[],
+ λ_regularize::Float64=0.0,
+ cocos=MXHEquilibrium.cocos(11),
+ Sb=nothing)
Find the currents for coils
that best match (leas-squares) the control points provided by flux_cps
, saddle_cps
, and iso_cps
Vacuume case: assumes no equilibrium plasma current
Optionally assumes flux from additional fixed_coils
, whose currents will not change
λ_regularize
provides regularization in the least-squares fitting
find_coil_currents!(
+ coils::AbstractVector{<:AbstractCoil};
+ flux_cps::Vector{<:FluxControlPoint}=FluxControlPoint{Float64}[],
+ saddle_cps::Vector{<:SaddleControlPoint}=SaddleControlPoint{Float64}[],
+ iso_cps::Vector{<:IsoControlPoint}=IsoControlPoint{Float64}[],
+ fixed_coils::AbstractVector{<:AbstractCoil}=PointCoil{Float64,Float64}[],
+ λ_regularize::Float64=0.0,
+ cocos=MXHEquilibrium.cocos(11))
Find the currents for coils
that best match (leas-squares) the control points provided by flux_cps
, saddle_cps
, and iso_cps
Vacuume case: assumes no equilibrium plasma current
Optionally assumes flux from additional fixed_coils
, whose currents will not change
λ_regularize
provides regularization in the least-squares fitting
VacuumFields.fixed2free
— Functionfixed2free(
+ EQfixed::MXHEquilibrium.AbstractEquilibrium,
+ coils::AbstractVector{<:AbstractCoil},
+ R::AbstractVector{T},
+ Z::AbstractVector{T};
+ ψbound::Real=0.0,
+ kwargs...) where {T<:Real}
Convert the flux of a fixed-boundary equilibrium EQfixed
to a free-boundary representation on an (R,Z)
grid, using the flux from coils
with currents satisfying given control points
fixed2free(
+ EQfixed::MXHEquilibrium.AbstractEquilibrium,
+ image::Image,
+ coils::AbstractVector{<:AbstractCoil},
+ R::AbstractVector{T},
+ Z::AbstractVector{T};
+ flux_cps::Vector{<:FluxControlPoint}=FluxControlPoint{Float64}[],
+ saddle_cps::Vector{<:SaddleControlPoint}=SaddleControlPoint{Float64}[],
+ iso_cps::Vector{<:IsoControlPoint}=IsoControlPoint{Float64}[],
+ ψbound::Real=0.0,
+ fixed_coils::AbstractVector{<:AbstractCoil}=PointCoil{Float64,Float64}[],
+ λ_regularize::Real=0.0) where {T<:Real}
Convert the flux of a fixed-boundary equilibrium EQfixed
to a free-boundary representation on an (R,Z)
grid, subtracting out the flux from image currents image
and adding in the flux from coils
with currents that best satisfy the control points and fixed_coils
with predefined coil currents
VacuumFields.mutual
— Functionmutual(C1::Union{AbstractCoil, IMASelement}, C2::PointCoil)
Compute the mutual inductance between an arbitrary coil or IMAS.pf_active__coil___element
and a PointCoil
mutual(C1::Union{AbstractCoil, IMASelement}, C2::DistributedCoil)
Compute the mutual inductance between an arbitrary coil or IMAS.pf_active__coil___element
and a DistributedCoil
mutual(C1::Union{AbstractCoil, IMASelement}, C2::Union{ParallelogramCoil, QuadCoil, IMASelement}; xorder::Int=3, yorder::Int=3)
Compute the mutual inductance between an arbitrary coil or IMAS.pf_active__coil___element
and a ParallelogramCoil, QuadCoil, or IMAS.pf_active__coil___element
xorder
and yorder
give the order of Gauss-Legendre quadrature for integration over the coil area
mutual(C1::Union{AbstractCoil, IMASelement}, C2::IMAScoil; xorder::Int=3, yorder::Int=3)
Compute the mutual inductance between an arbitrary coil or IMAS.pf_active__coil___element
and a IMAS.pf_active__coil
xorder
and yorder
give the order of Gauss-Legendre quadrature for integration over the coil area
mutual(C1::IMAScoil, C2::Union{AbstractCoil, IMAScoil, IMASelement}; xorder::Int=3, yorder::Int=3)
Compute the mutual inductance between an IMAS.pf_active__coil
and an arbitrary coil, IMAS.pf_active__coil___element
, or a IMAS.pf_active__coil
xorder
and yorder
give the order of Gauss-Legendre quadrature for integration over the coil area
mutual(EQ::MXHEquilibrium.AbstractEquilibrium, C::Union{AbstractCoil, IMAScoil}, δZ::Real=0.0;
+ COCOS::MXHEquilibrium.COCOS=MXHEquilibrium.cocos(EQ), kwargs...)
Compute the mutual inductance between an equilibrium and a coil, where the equilibrium is shifted vertically by δZ
mutual(image::Image, C::Union{AbstractCoil, IMAScoil}, Ip::Real, δZ::Real=0.0;
+ COCOS::MXHEquilibrium.COCOS=MXHEquilibrium.cocos(11), kwargs...)
Compute the mutual inductance between an equilibrium's image current and a coil, where the equilibrium is shifted vertically by δZ
VacuumFields.normalized_growth_rate
— Functionnormalized_growth_rate(EQ::MXHEquilibrium.AbstractEquilibrium, coils::Vector{<:Union{AbstractCoil, IMAScoil}}; kwargs...)
Compute the vertical growth rate (γ) and effective vertical time constant (τ, weighted L/R time) for a given equilibrium and coils
Return (γ, τ, γ * τ), where γ * τ < 10 for stability or controllability
This is the massless approximation and only use the passive conductors for computing τ (per advice from Olofsson)
normalized_growth_rate(image::Image, coils::Vector{<:Union{AbstractCoil, IMAScoil}}, Ip::Real; order::Int=default_order)
Compute the vertical growth rate (γ) and effective vertical time constant (τ, weighted L/R time), for a given equilibrium's image & plasma current and coils
Return (γ, τ, γ * τ), where γ * τ < 10 for stability or controllability
This is the massless approximation and only use the passive conductors for computing τ (per advice from Olofsson)
VacuumFields.optimal_λ_regularize
— Functionoptimal_λ_regularize(
+ coils::AbstractVector{<:AbstractCoil},
+ EQ::MXHEquilibrium.AbstractEquilibrium,
+ image::Image;
+ flux_cps::Vector{<:FluxControlPoint}=FluxControlPoint{Float64}[],
+ saddle_cps::Vector{<:SaddleControlPoint}=SaddleControlPoint{Float64}[],
+ iso_cps::Vector{<:IsoControlPoint}=IsoControlPoint{Float64}[],
+ ψbound::Real=0.0,
+ fixed_coils::AbstractVector{<:AbstractCoil}=PointCoil{Float64,Float64}[],
+ min_exp::Integer=-20, max_exp::Integer=-10,
+ Sb::MXHEquilibrium.Boundary=plasma_boundary_psi_w_fallback(EQ)[1])
Find the optimizal λ_regularize
to be used within find_coil_currents!
that minimizes the cost
VacuumFields.stability_margin
— Functionstability_margin(EQ::MXHEquilibrium.AbstractEquilibrium, coils::Vector{<:Union{AbstractCoil, IMAScoil}}; kwargs...)
Compute the m_s inductive stability margin for a given equilibrium and coils. Should be greater than 0.15 for vertical stability
First introduced in A. Portone, Nucl. Fusion 45 (2005) 926–932. https://doi.org/10.1088/0029-5515/45/8/021
stability_margin(image::Image, coils::Vector{<:Union{AbstractCoil, IMAScoil}}, Ip::Real; order::Int=default_order)
Compute the m_s inductive stability margin for a given equilibrium's image & plasma current and coils. Should be greater than 0.15 for vertical stability
First introduced in A. Portone, Nucl. Fusion 45 (2005) 926–932. https://doi.org/10.1088/0029-5515/45/8/021
Missing docstring for update_coil_currents!
. Check Documenter's build log for details.