-
Notifications
You must be signed in to change notification settings - Fork 60
Closed
Description
Hi,
I’ve found a bug in the triangularityLower() method when installing FreeGS via pip install --user freegs.
The triangularityLower() method in Equilibrium class currently calculates the upper triangularity instead of the lower triangularity due to using the same code with triangularityUpper().
This is the code from the installed freegs package :
def triangularityLower(self, npoints=360):
"""Calculates plasma upper triangularity, delta_u.
P4 is the point at the lower extent of the plasma.
tri_l = (R0 - R(P4))/a
"""
# Get points along the LCFS
separatrix = self.separatrix(npoints=npoints) # Array [:,2]
Rlcfs = np.array([i[0] for i in separatrix])
Zlcfs = np.array([i[1] for i in separatrix])
ind_P2 = np.argmax(Zlcfs)
R_P2 = Rlcfs[ind_P2]
R0 = self.Rgeometric(npoints=npoints)
a = self.minorRadius(npoints=npoints)
return (R0 - R_P2) / a
This is the correct implementation (the code on GitHub is correct):
def triangularityLower(self, npoints=360):
"""Calculates plasma lower triangularity, delta_u.
P4 is the point at the lower extent of the plasma.
tri_l = (R0 - R(P4))/a
"""
# Get points along the LCFS
separatrix = self.separatrix(npoints=npoints) # Array [:,2]
Rlcfs = np.array([i[0] for i in separatrix])
Zlcfs = np.array([i[1] for i in separatrix])
ind_P4 = np.argmin(Zlcfs)
R_P4 = Rlcfs[ind_P4]
R0 = self.Rgeometric(npoints=npoints)
a = self.minorRadius(npoints=npoints)
return (R0 - R_P4) / a
Metadata
Metadata
Assignees
Labels
No labels