Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Equilibrium/EquilibriumTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ specified in the input.
- `grid_type::String` - Grid type for flux surface discretization ("auto" — two-pass measured-curvature
refinement when mpsi=0, three-region log layout when mpsi>0; "core_edge_packed" (sin² spacing, dense at axis and edge), "pow1", "uniform";
inverse equilibria also "rho" (uniform in √ψ from psilow to psihigh) and "original" (the input
file's own ψ nodes off the axis; ignores psilow and mpsi); "log_asymptotic" is a legacy alias for "auto")
file's own ψ nodes between psilow and psihigh; ignores mpsi); "log_asymptotic" is a legacy alias for "auto")
- `psilow::Float64` - Lower limit of normalized flux coordinate
- `psihigh::Float64` - Requested upper limit of normalized flux coordinate; the value the
equilibrium is actually formed on is `EquilibriumParameters.psihigh_resolved`.
Expand Down
4 changes: 2 additions & 2 deletions src/Equilibrium/InverseEquilibrium.jl
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ function equilibrium_solver(input::InverseRunInput; override_psi_nodes::Union{No
# Uniform in √ψ from psilow to psihigh (Fortran's rho ignores psilow)
sq_xs = [(sqrt(psilow) + (sqrt(psihigh) - sqrt(psilow)) * i / mpsi)^2 for i in 0:mpsi]
elseif grid_type in ("original", "orig")
# The input's own ψ nodes off the axis; psilow and mpsi are ignored, psihigh still sets psilim
sq_xs = filter(>(0.0), rz_in_xs)
# The input's own ψ nodes, ended by psilow and psihigh as the other grids are; mpsi is ignored
sq_xs = [psilow; filter(x -> psilow < x < psihigh, rz_in_xs); psihigh]
mpsi = length(sq_xs) - 1
elseif grid_type == "uniform"
if mpsi == 0
Expand Down
5 changes: 3 additions & 2 deletions test/runtests_equil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,10 @@ using Statistics
splines(eq) = (eq.rzphi_rsquared, eq.rzphi_offset, eq.rzphi_nu, eq.rzphi_jac, eq.eqfun_B, eq.eqfun_metric1, eq.eqfun_metric2)
finite(eq) = all(isfinite, eq.profiles.dVdpsi_spline.y) && all(all(isfinite, s.nodal_derivs.partials) for s in splines(eq))

# original: the file's own ψ nodes off the axis (this file starts at the axis), whatever psilow/mpsi
# original: the file's own ψ nodes between psilow and psihigh, whatever mpsi
eq_o = Eq.setup_equilibrium(cfg("original"))
@test eq_o.rzphi_xs == Eq.read_chease_binary(cfg("original")).rz_in_xs[2:end]
xs_in = Eq.read_chease_binary(cfg("original")).rz_in_xs
@test eq_o.rzphi_xs == [0.01; filter(x -> 0.01 < x < 0.99, xs_in); 0.99]
@test finite(eq_o)

# rho: starts at psilow (Fortran's rho starts at psihigh/(mpsi+1)²)
Expand Down
Loading