SPECreader.jl
SPECReader — Module
SPECreaderJulia version of the SPEC-field-reader by Zhisong Qu. It also has some of the functionality of the MATLAB and Python routines packaged with SPEC.
Index
SPECReader.SPECEquilibrium — Type
SPECEquilibrium{TT, ATT<:Array{TT}, TSA}All components needed to reconstruct a SPEC equilibrium.
eqname = "testing/data/G3V01L0Fi.002.sp.h5"
speceq = SPECEquilibrium(eqname)SPECReader.ReadBoundary — Method
ReadBoundary(fname::String)Outputs the necessary data to reconstruct a SPEC boundary.
SPECReader.ReadPoincare — Method
ReadPoincare(fname::String)Read the Poincaré section for a given SPEC equilibrium output.
Geometry
SPECReader.find_sθζ — Function
find_sθζ(X,ζ,SpecVol::SPECEquilibrium,lvol::Integer,max_attempts=100)Find the $(s,\theta,\zeta)$ point corresponding to a given $(R,Z)$ point for a fixed $\zeta$. It is possible that the starting location is bad and the located point is outside of the computational domain, in which case we generate random initial conditions until it ends up inside the domain. The point is first approached using the optimize function from Optim.jl, then NonlinearSolve is used to hopefully finish pushing the point as close as possible.
SPECReader.get_RZ — Method
get_RZ(s::TT,θ,ζ,SpecVol::SPECEquilibrium,lvol::Integer) where TTGet the $(R,Z)$ coordinates from $(s,\theta,\zeta,l_{vol})\in[-1,1]\times[0,2\pi)\times[0,2\pi)\times[1,N_{vol}]$ logical coordinates.
SPECReader.get_axis — Method
get_axis(SpecVol)Get the Fourier modes of the magnetic axis of a SPEC equilibrium and output a named tuple axis.R and axis.Z.
SPECReader.get_boundary — Function
get_boundary(SpecVol::SPECEquilibrium, lvol=SpecVol.NumberofVolumes)Pull the outer boundary from a spec equlibrium data structure.
Fields
SPECReader.get_Bfield — Method
get_Bfield(s::TT, θ::TT, ζ::TT, SpecVol::SPECEquilibrium{TT,ATT,TSA},lvol::Int=1) where {TT,ATT,TSA}Take a point in $(s,\theta,\zeta)$ and return the covarient (cotangent) components of the magnetic field.