Skip to content

Commit

Permalink
Merge pull request #41 from bendudson/boundary_resolution
Browse files Browse the repository at this point in the history
Boundary resolution
  • Loading branch information
bendudson committed Jan 12, 2021
2 parents 548bba1 + 685f448 commit 934ced6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion freegs/critical.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ def find_separatrix(eq, opoint=None, xpoint=None, ntheta=20, psi=None, axis=None

# Avoid putting theta grid points exactly on the X-points
xpoint_theta = arctan2(xpoint[0][0] - r0, xpoint[0][1] - z0)
xpoint_theta = xpoint_theta * (xpoint_theta >= 0) + (xpoint_theta + 2 * pi) * (xpoint_theta < 0) #let's make it between 0 and 2*pi
# How close in theta to allow theta grid points to the X-point
TOLERANCE = 1.e-3
if any(abs(theta_grid - xpoint_theta) < TOLERANCE):
Expand All @@ -394,7 +395,8 @@ def find_separatrix(eq, opoint=None, xpoint=None, ntheta=20, psi=None, axis=None
r0, z0,
r0 + 10.*sin(theta), z0 + 10.*cos(theta),
psival=psival,
axis=axis)
axis=axis,
n=1000)
isoflux.append((r, z, xpoint[0][0], xpoint[0][1]))

return isoflux
Expand Down Expand Up @@ -437,6 +439,7 @@ def find_safety(eq, npsi=1, psinorm=None, ntheta=128, psi=None, opoint=None, xpo

# Avoid putting theta grid points exactly on the X-points
xpoint_theta = arctan2(xpoint[0][0] - r0, xpoint[0][1] - z0)
xpoint_theta = xpoint_theta * (xpoint_theta >= 0) + (xpoint_theta + 2 * pi) * (xpoint_theta < 0) #let's make it between 0 and 2*pi
# How close in theta to allow theta grid points to the X-point
TOLERANCE = 1.e-3

Expand Down

0 comments on commit 934ced6

Please sign in to comment.