Skip to content

Commit

Permalink
Merge pull request #75 from freegs-plasma/fix-shapedcoil
Browse files Browse the repository at this point in the history
ShapedCoil fix: Multiply control response by turns
  • Loading branch information
bendudson authored Apr 17, 2023
2 parents ce18e28 + 9582eeb commit 83b82af
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions freegs/shaped_coil.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,13 @@ def __init__(self, shape, current=0.0, turns=1, control=True, npoints=6):

def controlPsi(self, R, Z):
"""
Calculate poloidal flux at (R,Z) due to a unit current
Calculate poloidal flux at (R,Z) due to a unit current in the circuit
"""
result = 0.0
for R_fil, Z_fil, weight in self._points:
result += Greens(R_fil, Z_fil, R, Z) * weight
return result
# Multiply by turns so that toroidal current is current * turns
return result * self.turns

def controlBr(self, R, Z):
"""
Expand All @@ -107,7 +108,7 @@ def controlBr(self, R, Z):
result = 0.0
for R_fil, Z_fil, weight in self._points:
result += GreensBr(R_fil, Z_fil, R, Z) * weight
return result
return result * self.turns

def controlBz(self, R, Z):
"""
Expand All @@ -116,7 +117,7 @@ def controlBz(self, R, Z):
result = 0.0
for R_fil, Z_fil, weight in self._points:
result += GreensBz(R_fil, Z_fil, R, Z) * weight
return result
return result * self.turns

def inShape(self,polygon):
Shaped_Coil = Polygon([shape for shape in self.shape])
Expand Down

0 comments on commit 83b82af

Please sign in to comment.