Skip to content

Commit

Permalink
ShapedCoil fix: Multiply control response by turns
Browse files Browse the repository at this point in the history
The toroidal current is `coil.current * coil.turns`
but the `turns` variable was not used in the calculation
of the flux or field components.

This change should bring `ShapedCoil` in line with other coils
in their behaviour.
  • Loading branch information
bendudson committed Dec 14, 2022
1 parent 4e233b7 commit 9582eeb
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 9582eeb

Please sign in to comment.