-
Notifications
You must be signed in to change notification settings - Fork 4
Description
I recently noticed that when controlling the radial spacing near the separatrix using the input parameter psi_spacing_separatrix_multiplier, the radial spacing in the private flux region may become extremely small.
Problem description
Say, for example, we look at dx along two lines, one in the midplane and one in the private flux, as shown below:

If we change the value of psi_spacing_separatrix_multiplier from 1 to 4, the radial spacing along those two lines changes differently:
The spacing in the midplane changes as expected. However, when psi_spacing_separatrix_multiplier becomes large, the spacing in the private flux quickly tends to zero, which causes many numerical issues. I guess it is due to the requirement that dx and its derivatives have to be smooth?
Potential solutions
In some cases, I want to use psi_spacing_separatrix_multiplier=4, as I would like to test the case where dx is as uniform as possible. Is it possible to add a switch that enables discontinuous radial spacing in the private flux region?
For example, one potential way is to modify the describeSingleNull method in cases/tokamak.py. Around line 920, we have
if self.x_points[0].Z < self.o_point.Z:
print("Generating a lower single null", flush=True)
segments["lower_pf"] = {
"nx": self.user_options.nx_pf,
"psi_start": self.psi_pf_lower,
"psi_end": psi_sep,
"grad_end": dpsidi_sep,
}We can add a switch afterwards, such as:
if self.discontinous_pf_spacing:
segments["lower_pf"]["grad_end"] /= self.user_options.psi_spacing_separatrix_multiplierWith such a modification, the radial spacing in the private flux will always be uniform:
