SPECreader.jl
Reading in data
SPECreader.SPECEquilibrium
— TypeSPECEquilibrium{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
— MethodReadBoundary(fname::String)
Outputs the necessary data to reconstruct a SPEC boundary.
SPECreader.ReadPoincare
— MethodReadPoincare(fname::String)
Read the Poincaré section for a given SPEC equilibrium output.
Geometry
SPECreader.find_sθζ
— Functionfind_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
— Methodget_RZ(s::TT,θ,ζ,SpecVol::SPECEquilibrium,lvol::Integer) where TT
Get 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
— Methodget_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
— Functionget_boundary(SpecVol::SPECEquilibrium, lvol=SpecVol.NumberofVolumes)
Pull the outer boundary from a spec equlibrium data structure.
Fields
SPECreader.field_line!
— Functionfield_line!(ẋ, t, x, SpecVol::SPECEquilibrium,lvol::Int=1)
In place field line tracing function given a lvol
TODO: Implement for multi-volume spec equilibria
SPECreader.get_Bfield
— Methodget_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.