Skip to content
Open
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
16 changes: 15 additions & 1 deletion INGRID/line_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,21 @@ def map_xpt(self, xpt, magx, xpt_ID='xpt1', visual=False, verbose=False):
if (np.linalg.norm(N_minimizer - magx) >= self.eps):
self.flip_NSEW_lookup(xpt_ID)

self.config = 'LSN' if self.NSEW_lookup['xpt1']['coor']['N'][1] > xpt[1] else 'USN'
#
# By default assume we are not needing to swap midlines
#
# NOTE: This can occur when the primary x-point is in the
# upper midplane.
# Since we perform an xpt1 analysis even in the case of
# two x-points, we will always know whether or not to
# swap midlines
#
if self.NSEW_lookup['xpt1']['coor']['N'][1] > xpt[1]:
self.config = 'LSN'
self.swap_midlines = False
else:
self.config = 'USN'
self.swap_midlines = True

elif xpt_ID == 'xpt2':

Expand Down
7 changes: 5 additions & 2 deletions INGRID/topologies/snl.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,11 @@ def construct_patches(self):
Upper_Point = Point(magx[0], magx[1] + 1e6)
topLine = Line([Lower_Point, Upper_Point])

# If USN, we swap east and west lines
if self.config == 'USN':
#
# If primary x-point is in the "upper" orientation, we swap
# the midlines
#
if self.LineTracer.swap_midlines:
temp = midline_1.copy()
midline_1 = midline_2
midline_2 = temp
Expand Down
15 changes: 12 additions & 3 deletions INGRID/topologies/udn.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@ def construct_patches(self):
Upper_Point = Point(magx[0], magx[1] + 1e6)
topLine = Line([Lower_Point, Upper_Point])

#
# If primary x-point is in the "upper" orientation, we swap
# the midlines
#
if self.LineTracer.swap_midlines:
temp = midline_1.copy()
midline_1 = midline_2
midline_2 = temp

# Tracing primary-separatrix: core-boundary

xpt1N__psiMinCore = self.LineTracer.draw_line(xpt1['N'], {'psi': psi_core},
Expand Down Expand Up @@ -304,14 +313,14 @@ def construct_patches(self):

if self.settings['grid_settings']['patch_generation']['use_xpt2_W']:
tilt = self.settings['grid_settings']['patch_generation']['xpt2_W_tilt']
E3_E = self.LineTracer.draw_line(xpt2['W'], {'psi_horizontal': (psi_2, tilt)}, option='z_const', direction='cw', show_plot=visual, text=verbose).reverse_copy()
E3_E = self.LineTracer.draw_line(xpt2['W'], {'psi_horizontal': (psi_2, tilt)}, option='z_const', direction='ccw', show_plot=visual, text=verbose).reverse_copy()
else:
E3_E = self.LineTracer.draw_line(xpt2['W'], {'psi': psi_2}, option='rho', direction='ccw', show_plot=visual, text=verbose).reverse_copy()
F3_W = E3_E.reverse_copy()

if self.settings['grid_settings']['patch_generation']['use_xpt2_E']:
tilt = self.settings['grid_settings']['patch_generation']['xpt2_E_tilt']
D3_W = self.LineTracer.draw_line(xpt2['E'], {'psi_horizontal': (psi_1, tilt)}, option='z_const', direction='ccw', show_plot=visual, text=verbose)
D3_W = self.LineTracer.draw_line(xpt2['E'], {'psi_horizontal': (psi_1, tilt)}, option='z_const', direction='cw', show_plot=visual, text=verbose)
else:
D3_W = self.LineTracer.draw_line(xpt2['E'], {'psi': psi_1}, option='rho', direction='ccw', show_plot=visual, text=verbose)
C3_E = D3_W.reverse_copy()
Expand Down Expand Up @@ -341,7 +350,7 @@ def construct_patches(self):
G2_E = H2_W.reverse_copy()

if self.settings['grid_settings']['patch_generation']['use_xpt1_W']:
tilt = -self.settings['grid_settings']['patch_generation']['xpt1_W_tilt']
tilt = self.settings['grid_settings']['patch_generation']['xpt1_W_tilt']
B3_W = self.LineTracer.draw_line(B2_W.p[-1], {'line': (midline_1__WestPlate1, tilt)}, option='z_const', direction='ccw', show_plot=visual, text=verbose)
else:
B3_W = self.LineTracer.draw_line(B2_W.p[-1], {'line': midline_1__WestPlate1},
Expand Down
17 changes: 8 additions & 9 deletions example_files/UDN/DIIID_UDN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ DEBUG:
eqdsk: ../data/UDN/DIII-D/neqdsk
grid_settings:
grid_generation:
skewness_correction:
distortion_correction:
all:
active: false
resolution: 1000
Expand All @@ -25,19 +25,18 @@ grid_settings:
nlevs: 30
num_xpt: 2
patch_generation:
pf_split_point_ratio: 0.5
xpt2_E_tilt: -2.0
xpt2_W_tilt: -3.2
xpt1_E_tilt: 0.0
xpt1_W_tilt: 0.65
xpt1_W_tilt: -0.9
rmagx_shift: 0.0
xpt2_E_tilt: 0.0
xpt2_W_tilt: 0.0
strike_pt_loc: limiter
magx_tilt_1: 0.0
magx_tilt_2: 0.0
use_xpt1_E: false
use_xpt1_W: false
use_xpt2_E: false
use_xpt2_W: false
use_xpt1_E: False
use_xpt1_W: False
use_xpt2_E: False
use_xpt2_W: False
zmagx_shift: 0.0
psi_1: 1.127
psi_2: 1.131758078227
Expand Down