Skip to content

Commit

Permalink
changed gyroDeg to gyroTraceLength
Browse files Browse the repository at this point in the history
  • Loading branch information
plasmapotential committed Dec 27, 2023
1 parent 4de7d7c commit fc2f1e0
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 35 deletions.
20 changes: 10 additions & 10 deletions source/dashGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ def inputDragDrop(file, contents, MachFlag):
State('OFwriteDeltaT', 'value'),
State('dataPath', 'value'),
State('N_gyroSteps','value'),
State('gyroDeg','value'),
State('gyroTraceLength','value'),
State('gyroT_eV','value'),
State('N_vSlice','value'),
State('N_vPhase','value'),
Expand Down Expand Up @@ -583,7 +583,7 @@ def saveGUIinputs( n_clicks,
OFwriteDeltaT,
dataLoc,
N_gyroSteps,
gyroDeg,
gyroTraceLength,
gyroT_eV,
N_vSlice,
N_vPhase,
Expand Down Expand Up @@ -670,7 +670,7 @@ def saveGUIinputs( n_clicks,
data['writeDeltaT'] = OFwriteDeltaT
#gyro variables
data['N_gyroSteps'] = N_gyroSteps
data['gyroDeg'] = gyroDeg
data['gyroTraceLength'] = gyroTraceLength
data['gyroT_eV'] = gyroT_eV
data['N_vSlice'] = N_vSlice
data['N_vPhase'] = N_vPhase
Expand Down Expand Up @@ -1902,7 +1902,7 @@ def gyroInputBoxes():
html.Div(
children=[
dbc.Label("Gyro Trace Length [deg]"),
dbc.Input(id="gyroDeg", className="textInput"),
dbc.Input(id="gyroTraceLength", className="textInput"),
],
className="OFInput"
),
Expand Down Expand Up @@ -2099,7 +2099,7 @@ def allROISource(className):
[Input('loadGYRO', 'n_clicks')],
[State('N_gyroSteps', 'value'),
State('N_gyroPhase', 'value'),
State('gyroDeg', 'value'),
State('gyroTraceLength', 'value'),
State('ionMassAMU', 'value'),
State('vMode','value'),
State('gyroT_eV', 'value'),
Expand All @@ -2108,7 +2108,7 @@ def allROISource(className):
State('ionFrac', 'value'),
State('gyroSource', 'value')
])
def loadGYRO(n_clicks,N_gyroSteps,N_gyroPhase,gyroDeg,ionMassAMU,vMode,gyroT_eV,
def loadGYRO(n_clicks,N_gyroSteps,N_gyroPhase,gyroTraceLength,ionMassAMU,vMode,gyroT_eV,
N_vPhase, N_vSlice, ionFrac, gyroSource):
"""
sets up GYRO module
Expand All @@ -2120,7 +2120,7 @@ def loadGYRO(n_clicks,N_gyroSteps,N_gyroPhase,gyroDeg,ionMassAMU,vMode,gyroT_eV,
if ('allROI' in gyroSource) and (len(gyroSource)>1):
gyroSource.remove('allROI')

gui.getGyroInputs(N_gyroSteps,N_gyroPhase,gyroDeg,ionMassAMU,vMode,gyroT_eV,
gui.getGyroInputs(N_gyroSteps,N_gyroPhase,gyroTraceLength,ionMassAMU,vMode,gyroT_eV,
N_vPhase, N_vSlice, ionFrac, gyroSource)
gyroPhaseFig = gyroPhasePlots(update=True)
vPhaseFig = vPhasePlots(update=True)
Expand All @@ -2132,7 +2132,7 @@ def loadGYRO(n_clicks,N_gyroSteps,N_gyroPhase,gyroDeg,ionMassAMU,vMode,gyroT_eV,
GYROdata = {
'Number of steps per helix period':N_gyroSteps,
'Number of samples in gyro phase space':N_gyroPhase,
'Gyro trace length [degrees] (goes both directions)': gyroDeg,
'Gyro trace length [degrees] (goes both directions)': gyroTraceLength,
'Ion effective mass [AMU]': ionMassAMU,
'Velocity / Temperature Mode':vMode,
'Ion temperature at PFC surface [eV]':gyroT_eV,
Expand Down Expand Up @@ -3885,7 +3885,7 @@ def testDiv():
Output('OFdeltaT', 'value'),
Output('OFwriteDeltaT', 'value'),
Output('N_gyroSteps','value'),
Output('gyroDeg','value'),
Output('gyroTraceLength','value'),
Output('gyroT_eV','value'),
Output('N_vSlice','value'),
Output('N_vPhase','value'),
Expand Down Expand Up @@ -3992,7 +3992,7 @@ def session_data(n_clicks, inputTs, ts, MachFlag, data, inputFileData):
data.get('deltaT', ''),
data.get('writeDeltaT', ''),
data.get('N_gyroSteps',''),
data.get('gyroDeg',''),
data.get('gyroTraceLength',''),
data.get('gyroT_eV',''),
data.get('N_vSlice',''),
data.get('N_vPhase',''),
Expand Down
24 changes: 12 additions & 12 deletions source/engineClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ def loadGYROParams(self, infile=None):
self.getGyroInputs(
self.GYRO.N_gyroSteps,
self.GYRO.N_gyroPhase,
self.GYRO.gyroDeg,
self.GYRO.gyroTraceLength,
self.GYRO.ionMassAMU,
self.GYRO.vMode,
self.GYRO.gyroT_eV,
Expand All @@ -1211,13 +1211,13 @@ def loadGYROParams(self, infile=None):
)
return

def getGyroInputs(self,N_gyroSteps,N_gyroPhase,gyroDeg,ionMassAMU,vMode,gyroT_eV,
def getGyroInputs(self,N_gyroSteps,N_gyroPhase,gyroTraceLength,ionMassAMU,vMode,gyroT_eV,
N_vPhase, N_vSlice, ionFrac, gyroSources):
"""
Sets up the gyro module
"""
self.GYRO.N_gyroSteps = int(N_gyroSteps)
self.GYRO.gyroDeg = int(gyroDeg)
self.GYRO.gyroTraceLength = int(gyroTraceLength)
self.GYRO.gyroT_eV = float(gyroT_eV)
self.GYRO.N_vSlice = int(N_vSlice)
self.GYRO.N_vPhase = int(N_vPhase)
Expand Down Expand Up @@ -1253,7 +1253,7 @@ def getGyroInputs(self,N_gyroSteps,N_gyroPhase,gyroDeg,ionMassAMU,vMode,gyroT_eV
self.GYRO.setupConstants(self.GYRO.ionMassAMU)
print('Loaded Gyro Orbit Settings')
print('# Steps per helix period = {:f}'.format(float(N_gyroSteps)))
print('Gyro tracing distance [degrees] = {:f}'.format(float(gyroDeg)))
print('Gyro tracing distance [degrees] = {:f}'.format(float(gyroTraceLength)))
print('Plasma Temperature Mode = ' + vMode)
print('Number of Monte Carlo runs per point = {:f}'.format(float(self.GYRO.N_MC)))
print("Source of gyro orbit power = "+self.GYRO.gyroSourceTag)
Expand Down Expand Up @@ -1433,18 +1433,18 @@ def Btrace(self,x,y,z,t,direction,traceDeg,dpinit,tag=None):
self.MHD.getFieldpath(dphi, gridfile, controlfilePath, controlfile, paraview_mask=True, tag=tag)
return

def gyroTrace(self,x,y,z,t,gPhase,vPhase,gyroDeg,dpinit,N_helix,traceDirection,gyroT_eV,tag=None):
def gyroTrace(self,x,y,z,t,gPhase,vPhase,gyroTraceLength,dpinit,N_helix,traceDirection,gyroT_eV,tag=None):
"""
performs a single gyro orbit trace
(x,y,z) are locations where we launch trace from
gyroPhase is initial phase angle of orbit in degrees
gyroDeg is the number of degrees we will trace for
gyroTraceLength is the number of degrees we will trace for
N_gyroSteps is the number of discrete lines we approximate helical path by
"""
print("\n========Gyro Trace Initialized========")
#get bField trace from this point
self.Btrace(x,y,z,t,traceDirection,gyroDeg,dpinit,tag)
self.Btrace(x,y,z,t,traceDirection,gyroTraceLength,dpinit,tag)
#read bField trace csv output

structOutfile = self.MHD.shotPath + self.tsFmt.format(t) + '/struct.dat'
Expand Down Expand Up @@ -1500,7 +1500,7 @@ def gyroTraceMultiple(self,data,t):
vPhase = data['vPhase[deg]']
gyroT_eV = data['T[eV]']
N_helix = data['N_helix']
gyroDeg = data['Length[deg]']
gyroTraceLength = data['Length[deg]']

xyz = np.array([x,y,z]).T
controlfile = '_structCTL.dat'
Expand All @@ -1517,7 +1517,7 @@ def gyroTraceMultiple(self,data,t):
structOutfile = controlfilePath + 'struct.dat'

for i in range(Ntraces):
self.gyroTrace(x[i],y[i],z[i],t,gPhase[i],vPhase[i],gyroDeg[i],
self.gyroTrace(x[i],y[i],z[i],t,gPhase[i],vPhase[i],gyroTraceLength[i],
dpinit[i],N_helix[i],traceDirection[i],gyroT_eV[i],
tag='pt{:03d}'.format(i))
os.remove(structOutfile)
Expand Down Expand Up @@ -3349,7 +3349,7 @@ def getDefaultDict(self):
'qFilePath' : None,
'qFileTag' : None,
'N_gyroSteps': None,
'gyroDeg': None,
'gyroTraceLength': None,
'gyroT_eV': None,
'N_vSlice': None,
'N_vPhase': None,
Expand Down Expand Up @@ -3429,7 +3429,7 @@ def loadInputs(self, inFile=None):
'meshMaxLevel': self.OF.meshMaxLevel,
'material': self.OF.material,
'N_gyroSteps': self.GYRO.N_gyroSteps,
'gyroDeg': self.GYRO.gyroDeg,
'gyroTraceLength': self.GYRO.gyroTraceLength,
'gyroT_eV': self.GYRO.gyroT_eV,
'N_vSlice': self.GYRO.N_vSlice,
'N_vPhase': self.GYRO.N_vPhase,
Expand Down Expand Up @@ -3494,7 +3494,7 @@ def getCurrentInputs(self):
'meshMaxLevel': self.OF.meshMaxLevel,
'material': self.OF.material,
'N_gyroSteps': self.GYRO.N_gyroSteps,
'gyroDeg': self.GYRO.gyroDeg,
'gyroTraceLength': self.GYRO.gyroTraceLength,
'gyroT_eV': self.GYRO.gyroT_eV,
'N_vSlice': self.GYRO.N_vSlice,
'N_vPhase': self.GYRO.N_vPhase,
Expand Down
8 changes: 4 additions & 4 deletions source/gyroClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ def allowed_class_vars(self):
:N_gyroSteps: number of discrete line segments per helical gyro period [integer].
Higher values mean better approximation of the helical trajectory but come at
the cost of longer computation times.
:gyroDeg: number of steps to trace for gyro orbit calculation [integer]. Step width
:gyroTraceLength: number of steps to trace for gyro orbit calculation [integer]. Step width
is defined by the MHD EQ variable dpinit. Should really change this name to
gyroTraceLength as it is not directly related to degrees. Total toroidal distance
of trace is gyroDeg * dpinit
of trace is gyroTraceLength * dpinit
:gyroT_eV: Plasma ion temperature [eV]. This temperature corresponds to the mean
total velocity in the ion velocity distribution function.
:N_vSlice: Number of macroparticle samples to take from the velocity distribution
Expand All @@ -80,7 +80,7 @@ def allowed_class_vars(self):

self.allowed_vars = [
'N_gyroSteps',
'gyroDeg',
'gyroTraceLength',
'gyroT_eV',
'N_vSlice',
'N_vPhase',
Expand All @@ -98,7 +98,7 @@ def setTypes(self):
"""
integers = [
'N_gyroSteps',
'gyroDeg',
'gyroTraceLength',
'N_vSlice',
'N_vPhase',
'N_gyroPhase',
Expand Down
16 changes: 8 additions & 8 deletions source/pfcClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,8 @@ def findGuidingCenterPaths(self, MHD, GYRO):
"""
#walk up field line to determine where we should start helix tracing from
CTLfile = self.controlfilePath + self.controlfileStruct
MHD.ittGyro = int(GYRO.gyroDeg / GYRO.dpinit)
print("Tracing guiding centers for {:f} degrees".format(GYRO.gyroDeg))
MHD.ittGyro = int(GYRO.gyroTraceLength / GYRO.dpinit)
print("Tracing guiding centers for {:f} degrees".format(GYRO.gyroTraceLength))

#MHD.writeControlFile(CTLfile, self.t, 0, mode='gyro') #0 for both directions
#trace
Expand Down Expand Up @@ -744,9 +744,9 @@ def findHelicalPathsOpen3D(self, GYRO):

#Walk downstream along GC path tracing helices and looking for intersections
if "allROI" in GYRO.gyroSources:
N_GCdeg = int((GYRO.gyroDeg*2) / GYRO.dpinit) + 1
N_GCdeg = int((GYRO.gyroTraceLength*2) / GYRO.dpinit) + 1
else:
N_GCdeg = int((GYRO.gyroDeg) / GYRO.dpinit) + 1
N_GCdeg = int((GYRO.gyroTraceLength) / GYRO.dpinit) + 1

gP = 0
vP = 0
Expand Down Expand Up @@ -990,9 +990,9 @@ def findHelicalPathsOpen3D_NoLoop(self, GYRO):

#Walk downstream along GC path tracing helices and looking for intersections
if "allROI" in GYRO.gyroSources:
N_GCdeg = int((GYRO.gyroDeg*2) / GYRO.dpinit) + 1
N_GCdeg = int((GYRO.gyroTraceLength*2) / GYRO.dpinit) + 1
else:
N_GCdeg = int((GYRO.gyroDeg) / GYRO.dpinit) + 1
N_GCdeg = int((GYRO.gyroTraceLength) / GYRO.dpinit) + 1

GYRO.Nsteps = N_GCdeg
gP = 0
Expand Down Expand Up @@ -1405,9 +1405,9 @@ def findHelicalPaths(self, GYRO):

#Walk downstream along GC path tracing helices and looking for intersections
if "allROI" in GYRO.gyroSources:
N_GCdeg = GYRO.gyroDeg*2 + 1
N_GCdeg = GYRO.gyroTraceLength*2 + 1
else:
N_GCdeg = GYRO.gyroDeg + 1
N_GCdeg = GYRO.gyroTraceLength + 1
gP = 0
vP = 0
vS = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/integrationTests/nstxuTestCase/nstx/NSTXU_input.csv
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ qFileTag, None
# Ion Gyro Orbit HF Variables
#==============================================================
N_gyroSteps, 8
gyroDeg, 10
gyroTraceLength, 10
gyroT_eV, 100
N_vSlice, 1
N_vPhase, 3
Expand Down

0 comments on commit fc2f1e0

Please sign in to comment.