Skip to content

Commit 752d6ed

Browse files
committed
No find_psi_2nd_separatrix number of x-point < 1
1 parent ab60739 commit 752d6ed

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/physics/fluxsurfaces.jl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ end
183183
find_psi_2nd_separatrix(eqt::IMAS.equilibrium__time_slice, PSI_interpolant::Interpolations.AbstractInterpolation)
184184
185185
Returns psi of the second magentic separatrix. This relies on the fact that find_x_points! saves the x points in such a way
186-
that the last one is the null with Z opposite to the first x point which is the closest in psi to the lcfs
186+
that the last one is the null with Z opposite to the first x point which is the closest in psi to the lcfs.
187187
"""
188188
function find_psi_2nd_separatrix(eqt::IMAS.equilibrium__time_slice, PSI_interpolant::Interpolations.AbstractInterpolation)
189189
psi2nd = PSI_interpolant.(eqt.boundary.x_point[end].r, eqt.boundary.x_point[end].z)
@@ -731,12 +731,14 @@ function flux_surfaces(eqt::equilibrium__time_slice{T}, B0::T, R0::T; upsample_f
731731
find_strike_points!(eqt)
732732

733733
# secondary separatrix
734-
psi2nd = find_psi_2nd_separatrix(eqt, PSI_interpolant)
735-
tmp, _ = flux_surface(r, z, PSI, eqt.profiles_1d.psi, eqt.global_quantities.magnetic_axis.r, eqt.global_quantities.magnetic_axis.z, psi2nd, :encircling)
736-
if !isempty(tmp)
737-
(pr2nd, pz2nd) = tmp[1]
738-
eqt.boundary_secondary_separatrix.outline.r = pr2nd
739-
eqt.boundary_secondary_separatrix.outline.z = pz2nd
734+
if length(eqt.boundary.x_point) > 1
735+
psi2nd = find_psi_2nd_separatrix(eqt, PSI_interpolant)
736+
tmp, _ = flux_surface(r, z, PSI, eqt.profiles_1d.psi, eqt.global_quantities.magnetic_axis.r, eqt.global_quantities.magnetic_axis.z, psi2nd, :encircling)
737+
if !isempty(tmp)
738+
(pr2nd, pz2nd) = tmp[1]
739+
eqt.boundary_secondary_separatrix.outline.r = pr2nd
740+
eqt.boundary_secondary_separatrix.outline.z = pz2nd
741+
end
740742
end
741743

742744
return eqt

0 commit comments

Comments
 (0)