-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Even when using non-orthogonal grids, the MeshRegion
boundaries at X-point locations are defined by lines perpendicular to flux surfaces. This can cause problems for short-leg divertors, e.g. the region boundary could even intersect the wall (thanks @mikekryjak for finding this case!).
In principle it should be straightforward to add an option to choose the region boundary in a different way here
hypnotoad/hypnotoad/core/mesh.py
Lines 213 to 267 in 82a0121
# set sign of step in psi towards this region from primary separatrix at start of | |
# region | |
if temp_psi_vals[-1] - start_psi > 0: | |
start_psi_sep_plus_delta = ( | |
start_psi | |
+ self.equilibriumRegion.equilibrium.poloidal_spacing_delta_psi | |
) | |
else: | |
start_psi_sep_plus_delta = ( | |
start_psi | |
- self.equilibriumRegion.equilibrium.poloidal_spacing_delta_psi | |
) | |
vec_points = followPerpendicular( | |
0, | |
start_point, | |
start_psi, | |
f_R=self.meshParent.equilibrium.f_R, | |
f_Z=self.meshParent.equilibrium.f_Z, | |
psivals=[start_psi, start_psi_sep_plus_delta], | |
rtol=self.user_options.follow_perpendicular_rtol, | |
atol=self.user_options.follow_perpendicular_atol, | |
) | |
self.equilibriumRegion.gradPsiSurfaceAtStart = ( | |
vec_points[1].as_ndarray() - vec_points[0].as_ndarray() | |
) | |
# Make vector along grad(psi) at end of equilibriumRegion | |
end_point = self.equilibriumRegion[self.equilibriumRegion.endInd] | |
end_psi = self.equilibriumRegion.psi(*end_point) | |
# set sign of step in psi towards this region from primary separatrix at end of | |
# region | |
if temp_psi_vals[-1] - end_psi > 0: | |
end_psi_sep_plus_delta = ( | |
end_psi + self.equilibriumRegion.equilibrium.poloidal_spacing_delta_psi | |
) | |
else: | |
end_psi_sep_plus_delta = ( | |
end_psi - self.equilibriumRegion.equilibrium.poloidal_spacing_delta_psi | |
) | |
vec_points = followPerpendicular( | |
-1, | |
end_point, | |
end_psi, | |
f_R=self.meshParent.equilibrium.f_R, | |
f_Z=self.meshParent.equilibrium.f_Z, | |
psivals=[end_psi, end_psi_sep_plus_delta], | |
rtol=self.user_options.follow_perpendicular_rtol, | |
atol=self.user_options.follow_perpendicular_atol, | |
) | |
self.equilibriumRegion.gradPsiSurfaceAtEnd = ( | |
vec_points[1].as_ndarray() - vec_points[0].as_ndarray() | |
) |
(renaming the
gradPsiSurfaceAtStart
and gradPsiSurfaceAtEnd
member variables to something more generic).
For example, the boundary could just be a straight line going away from the X-point at some specified angle (with some check that it is actually pointing into the right region and does not intersect the separatrix).
One fiddly part would be naming the options and looking up the right one for each MeshRegion
, depending which divertor leg (and which radial side) the boundary belongs to.