From abc93acafdb755f7c97c665c017369cbc13ddfae Mon Sep 17 00:00:00 2001 From: Dominic Power Date: Wed, 22 Oct 2025 17:50:12 -0400 Subject: [PATCH 1/4] Fixed line tracing issues when using tilts in SF15 config --- INGRID/topologies/sf15.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/INGRID/topologies/sf15.py b/INGRID/topologies/sf15.py index 766716a..40ffb91 100644 --- a/INGRID/topologies/sf15.py +++ b/INGRID/topologies/sf15.py @@ -428,8 +428,6 @@ def construct_patches(self): F3_W = self.LineTracer.draw_line(xpt2['E'], {'psi': psi_1}, option='rho', direction='ccw', show_plot=visual, text=verbose) - F3_W = self.LineTracer.draw_line(xpt2['E'], {'psi': psi_1}, option='rho', direction='ccw', - show_plot=visual, text=verbose) E3_E = F3_W.reverse_copy() F3_N = self.LineTracer.draw_line(F3_W.p[-1], {'line': EastPlate2}, option='theta', direction='cw', @@ -443,8 +441,13 @@ def construct_patches(self): midline_1__WestPlate1 = self.LineTracer.draw_line(C3_N.p[0], {'line': WestPlate1}, option='theta', direction='ccw', show_plot=visual, text=verbose) - B3_W = self.LineTracer.draw_line(B2_W.p[-1], {'line': midline_1__WestPlate1}, option='rho', direction='ccw', - show_plot=visual, text=verbose) + if self.settings['grid_settings']['patch_generation']['use_xpt1_W']: + 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}, option='rho', direction='ccw', + show_plot=visual, text=verbose) A3_E = B3_W.reverse_copy() A3_N, B3_N = midline_1__WestPlate1.reverse_copy().split(B3_W.p[-1], add_split_point=True) From c6d9a2d7c28471e2f712421f5cd64b5a90ff7ccd Mon Sep 17 00:00:00 2001 From: Dominic Power Date: Tue, 28 Oct 2025 09:43:52 -0400 Subject: [PATCH 2/4] Bug fixes in UDN topo (need to test) --- INGRID/topologies/udn.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/INGRID/topologies/udn.py b/INGRID/topologies/udn.py index 8cf5e1c..73eb8a5 100644 --- a/INGRID/topologies/udn.py +++ b/INGRID/topologies/udn.py @@ -254,6 +254,7 @@ def construct_patches(self): xpt2__psiMinPF2 = self.LineTracer.draw_line(xpt2['S'], {'psi': psi_pf_2}, option='rho', direction='cw', show_plot=visual, text=verbose) + #TODO: Implement split point ratio option here E2_E, E1_E = xpt2__psiMinPF2.split(xpt2__psiMinPF2.p[len(xpt2__psiMinPF2.p) // 2], add_split_point=True) D1_W = E1_E.reverse_copy() D2_W = E2_E.reverse_copy() @@ -289,7 +290,7 @@ def construct_patches(self): 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() @@ -319,7 +320,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}, From cd049ed1d816821c2b6e10520fe14172808f7fb1 Mon Sep 17 00:00:00 2001 From: Dominic Power Date: Thu, 8 Jan 2026 01:29:49 -0500 Subject: [PATCH 3/4] Bug fix in SF105 adjust_patches --- INGRID/topologies/sf105.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INGRID/topologies/sf105.py b/INGRID/topologies/sf105.py index 5e632af..31b52b5 100644 --- a/INGRID/topologies/sf105.py +++ b/INGRID/topologies/sf105.py @@ -526,7 +526,7 @@ def AdjustGrid(self) -> None: # Adjust cell grid face along vertical plane poloidal_tag, radial_tag = patch.get_tag() if poloidal_tag == 'D': - patch.AdjustBorder('E', self.patches['D' + radial_tag]) + patch.AdjustBorder('E', self.patches['E' + radial_tag]) # Circular patch configuration requires adjustment of border to close loop. # Convention chosen: 'E' indicates closed loop From 6d3886386555b6a4920824a4ed486faf4f9638cd Mon Sep 17 00:00:00 2001 From: Dominic Power Date: Wed, 14 Jan 2026 09:59:18 -0500 Subject: [PATCH 4/4] Fixed and tested UDN xpt2 tilts and added example --- INGRID/topologies/udn.py | 2 +- example_files/UDN/xpt_tilt_demo.yml | 83 +++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 example_files/UDN/xpt_tilt_demo.yml diff --git a/INGRID/topologies/udn.py b/INGRID/topologies/udn.py index 73eb8a5..0c68a35 100644 --- a/INGRID/topologies/udn.py +++ b/INGRID/topologies/udn.py @@ -283,7 +283,7 @@ 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() diff --git a/example_files/UDN/xpt_tilt_demo.yml b/example_files/UDN/xpt_tilt_demo.yml new file mode 100644 index 0000000..3a1a8c9 --- /dev/null +++ b/example_files/UDN/xpt_tilt_demo.yml @@ -0,0 +1,83 @@ +DEBUG: + verbose: + grid_generation: 0 + patch_generation: 0 + target_plates: 0 + visual: + SF_analysis: 0 + find_NSEW: 0 + gridue: 0 + patch_map: 0 + subgrid: 0 +eqdsk: ../data/NEQDSK_maxim/neqdsk_2 +grid_settings: + grid_generation: + distortion_correction: + all: + active: false + resolution: 1000 + theta_max: 120.0 + theta_min: 80.0 + np_default: 1 + nr_default: 1 + poloidal_f_default: x, x + radial_f_default: x, x + guard_cell_eps: 0.001 + nlevs: 30 + num_xpt: 2 + patch_generation: + xpt1_E_tilt: 0.1 + xpt1_W_tilt: -0.2 + rmagx_shift: 0.0 + xpt2_E_tilt: -3.0 + xpt2_W_tilt: 2.8 + strike_pt_loc: limiter + magx_tilt_1: 0.0 + magx_tilt_2: 0.0 + use_xpt1_E: true + use_xpt1_W: true + use_xpt2_E: true + use_xpt2_W: true + zmagx_shift: 0.0 + psi_1: 1.7 + psi_2: 1.6 + psi_core: 0.89 + psi_pf_1: 0.7 + psi_pf_2: 1.4 + rmagx: 1.6 + rxpt: 1.5 + rxpt2: 1.8 + view_mode: filled + zmagx: 0.0 + zxpt: -0.62 + zxpt2: 0.56 +integrator_settings: + dt: 0.01 + eps: 5.0e-06 + first_step: 5.0e-05 + max_step: 0.064 + step_ratio: 0.02 + tol: 0.005 +limiter: + rshift: 0.0 + use_efit_bounds: true + zshift: -0.1 + efit_buffer_r: 0.1 + efit_buffer_z: 0.7 +target_plates: + plate_E1: + file: '' + + zshift: 0.0 + plate_E2: + file: '' + + zshift: 0.0 + plate_W1: + file: '' + + zshift: 0.0 + plate_W2: + file: '' + + zshift: 0.0