|
183 | 183 | find_psi_2nd_separatrix(eqt::IMAS.equilibrium__time_slice, PSI_interpolant::Interpolations.AbstractInterpolation)
|
184 | 184 |
|
185 | 185 | 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. |
187 | 187 | """
|
188 | 188 | function find_psi_2nd_separatrix(eqt::IMAS.equilibrium__time_slice, PSI_interpolant::Interpolations.AbstractInterpolation)
|
189 | 189 | 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
|
731 | 731 | find_strike_points!(eqt)
|
732 | 732 |
|
733 | 733 | # 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 |
740 | 742 | end
|
741 | 743 |
|
742 | 744 | return eqt
|
|
0 commit comments