API Reference
CoordinateConventions
CoordinateConventions.COCOS
— TypeCOCOS Structure
cocos::Int = COCOS ID number
exp_Bp::Int = 0 or 1, depending if psi is already divided by 2pi or not, respectively
sigma_Bp::Int = +1 or -1, depending if psi is increasing or decreasing with Ip and B0 positive
sigma_RpZ::Int = +1 or -1, depending if (R,phi,Z) is right-handed or (R,Z,phi), respectively
sigma_rhotp::Int = +1 or -1, depending if (rho, theta, phi) is right-handed or (rho,phi,theta), repectively
sign_q_pos::Int = +1 or -1, depending if q is positive or negative with Ip and B0 positive
sign_pprime_pos::Int = +1 or -1, depending if dp/dpsi is positive or negative with Ip and B0 positive
CoordinateConventions.check_cocos
— Functioncheck_cocos(sigma_B0, sigma_Ip, sigma_F, sigma_pprime, sigma_q, sigma_dpsi, cc::COCOS; verbose = false) -> Bool
Returns if equilibrium quantities are consistent with given COCOS
Arguments:
- sigma_B0 - Toroidal magnetic field sign
- sigma_Ip - Plasma current sign
- sigma_F - Poloidal current sign
- sigma_pprime - Pressure gradient sign
- sigma_dpsi - dpsi/dr sign
- cc::Union{Int,COCOS} - COCOS structure or ID
check_cocos(B0, Ip, F::AbstractVector, pprime::AbstractVector, q::AbstractVector, psi::AbstracVector, cc::COCOS; verbose = false) -> Bool
Returns if equilibrium quantities are consistent with given COCOS
Arguments:
- B0 - Toroidal magnetic field
- Ip - Plasma current
- F::AbstractVector - Poloidal current as a function of psi
- pprime::AbstracVector - Pressure gradient w.r.t. psi as a function of psi
- psi::AbstractVector - Poloidal flux
- cc::Union{Int,COCOS} - COCOS structure or ID
CoordinateConventions.cocos
— Functioncocos(cocos_ID) -> COCOS
Returns COCOS structure given the cocos_ID number
CoordinateConventions.cylindrical_cocos
— Functioncylindrical_cocos(c::COCOS, r, phi, z) -> NTuple{3}
Returns the right-handed cylindrical coordinate according to the provided COCOS.
cocos.sigma_RpZ = +1 -> (r, phi, z)
cocos.sigma_RpZ = -1 -> (r, z, phi)
CoordinateConventions.cylindrical_cocos_indices
— Functioncylindrical_cocos_indices(c::COCOS) -> NTuple{3}
Returns the indices of the r, phi, and z coordinates, respectively, relative to the provided COCOS.
cocos.sigma_RpZ = +1 -> (1, 2, 3)
cocos.sigma_RpZ = -1 -> (1, 3, 2)
CoordinateConventions.identify_cocos
— Functionidentify_cocos(sigma_B0, sigma_Ip, sigma_q, sigma_dpsi, clockwise_phi) -> List of possible COCOS IDs
Utility function to identify COCOS coordinate system. If multiple COCOS are possible, then all are returned.
Arguments:
- sigma_B0 - (+1,-1) sign of the toroidal magnetic field
- sigma_Ip - (+1,-1) sign of toroidal plasma current
- sigma_q - (+1,-1) sign of the safety factor (q) within the plasma
- sigma_dpsi - +1 if psi is increasing, -1 if psi is decreasing
- clockwise_phi::Bool - (optional) [true, false] if phi angle is defined clockwise or not. This is required to identify odd Vs even COCOS. Note that this cannot be determined from the output of a code.
identify_cocos(B0, Ip, q, psi, clockwise_phi, a)
Utility function to identify COCOS coordinate system. If multiple COCOS are possible, then all are returned.
Arguments:
- B0 - toroidal magnetic field (with sign)
- Ip - plasma current (with sign)
- q - safety factor profile (with sign) as function of psi
- psi::AbstractVector - Vector of poloidal fluxs from the magnetic axis to the plasma boundary
- clockwise_phi::Bool - (optional) [true, false] if phi angle is defined clockwise or not. This is required to identify odd Vs even COCOS. Note that this cannot be determined from the output of a code.
- a::AbstractVector - (optional) flux surfaces minor radius as function of psi. This is required to identify 2*pi term in psi definition
CoordinateConventions.poloidal_cocos
— Functionpoloidal_cocos(c::COCOS, rho, theta, phi) -> NTuple{3}
Returns the right-handed poloidal coordinate according to the provided COCOS.
cocos.sigma_rhotp = +1 -> (rho, theta, phi)
cocos.sigma_rhotp = -1 -> (rho, phi, theta)
CoordinateConventions.poloidal_cocos_indices
— Functionpoloidal_cocos_indices(c::COCOS) -> NTuple{3}
Returns the indices of the rho, theta, and phi coordinates, respectively, relative to the provided COCOS.
cocos.sigma_rhotp = +1 -> (1, 2, 3)
cocos.sigma_rhotp = -1 -> (1, 3, 2)
CoordinateConventions.transform_cocos
— Functiontransform_cocos(cc_in::Union{Int,COCOS}, cc_out::Union{Int,COCOS};
sigma_Ip = nothing, sigma_B0=nothing,
ld = (1,1), lB = (1,1), exp_mu0 = (0,0)) -> Dict
Returns a dictionary of the multiplicative factors to transform COCOS from ccin to ccout
Arguments:
- sigma_Ip::Union{NTuple{2,Int},Nothing} - A tuple of the (Input, Output) current sign or nothing
- sigma_B0::Union{NTuple{2,Int},Nothing} - A tuple of the (Input, Output) toroidal field sign or nothing
- ld::NTuple{2,<:Real} - A tuple of the (Input, Output) length scale factor. Default = (1,1)
- lB::NTuple{2,<:Real} - A tuple of the (Input, Output) magnetic field scale factor. Default = (1,1)
- exp_mu0::NTuple{2,<:Real} - A tuple of the (Input, Output) mu0 exponent (0, 1). Default = (0,0)