From d469abfd5c89014d0d7bcce92d9ef9a98cc549d8 Mon Sep 17 00:00:00 2001 From: Ben Dudson Date: Wed, 25 Jan 2023 23:06:19 -0800 Subject: [PATCH] Small tidy of core.mesh._find_intersections Remove unused keywords, reduce number of parameters that need to be passed to it for testing. Add explanation of how equilibrium and psi parameters are passed to the function. --- hypnotoad/core/mesh.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hypnotoad/core/mesh.py b/hypnotoad/core/mesh.py index 810e6287..a8aef9d6 100644 --- a/hypnotoad/core/mesh.py +++ b/hypnotoad/core/mesh.py @@ -347,14 +347,14 @@ def addPointAtWallToContours(self): # should the contour intersect a wall at the upper end? upper_wall = self.connections["upper"] is None + # Note: parallel_map will pass additional keywords to the function, + # including `equilibrium` and `psi`. map_result = self.parallel_map( _find_intersection, enumerate(self.contours), lower_wall=lower_wall, upper_wall=upper_wall, max_extend=max_extend, - atol=self.atol, - refine_width=self.user_options.refine_width, ) self.contours = [x[0] for x in map_result] @@ -2250,21 +2250,26 @@ def _find_intersection( i_contour, contour, *, - psi, equilibrium, lower_wall, upper_wall, max_extend, - atol, - refine_width, + psi=None, **kwargs, ): + """ + i_contour Index of contour. Only used for diagnostic output + """ print( f"finding wall intersections: {i_contour + 1}", end="\r", flush=True, ) + if psi is None: + # Get the poloidal flux from the equilibrium + psi = equilibrium.psi + # point where contour intersects the lower wall lower_intersect = None