Skip to content

Commit

Permalink
Update geqdsk.py , analyse_equil_2.py
Browse files Browse the repository at this point in the history
The xlim variable was wrongly read from edit files. Consequently
workflow.py changes.
Correct a bug in Analyse_equil_2.py
  • Loading branch information
brey committed Jan 8, 2014
1 parent bd1ff50 commit 94b812c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
7 changes: 5 additions & 2 deletions tools/tokamak_grids/pyGridGen/analyse_equil_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ def analyse_equil ( F, R, Z):
func = RectBivariateSpline(Rx, Zx, F)
for i in xrange(numpy.size(opt_ri)): opt_f[i]=func(opt_ri[i], opt_zi[i])

n_opoint=numpy.size(opt_ri)

# x-points

x_ri=numpy.delete(rex1, numpy.array(list(repeated)))
Expand All @@ -121,6 +123,7 @@ def analyse_equil ( F, R, Z):
func = RectBivariateSpline(Rx, Zx, F)
for i in xrange(numpy.size(xpt_ri)): xpt_f[i]=func(xpt_ri[i], xpt_zi[i])

n_xpoint=numpy.size(xpt_ri)

# plot o-points

Expand All @@ -147,7 +150,7 @@ def analyse_equil ( F, R, Z):
if n_opoint == 0 :
print "No O-points! Giving up on this equilibrium"
return Bunch(n_opoint=0, n_xpoint=0, primary_opt=-1)


#;;;;;;;;;;;;;; Find plasma centre ;;;;;;;;;;;;;;;;;;;
# Find the O-point closest to the middle of the grid
Expand All @@ -161,7 +164,7 @@ def analyse_equil ( F, R, Z):
mind = d

primary_opt = ind
print "Primary O-point is at "+ numpy.str(opt_ri[ind]) + ", " + numpy.str(opt_zi[ind])
print "Primary O-point is at "+ numpy.str(numpy.interp(opt_ri[ind],numpy.arange(numpy.size(R)),R)) + ", " + numpy.str(numpy.interp(opt_zi[ind],numpy.arange(numpy.size(Z)),Z))
print ""

if n_xpoint > 0 :
Expand Down
4 changes: 2 additions & 2 deletions tools/tokamak_grids/pyGridGen/geqdsk.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def openFile(self, filename):
self.data['rlim'] = numpy.zeros( (limitr,), numpy.float64 ), "R of surrounding limiter contour in meter"
self.data['zlim'] = numpy.zeros( (limitr,), numpy.float64 ), "Z of surrounding limiter contour in meter"
for i in range(limitr):
self.data['rbbbs'][0][i] = data[2*nbbbs + 2*i]
self.data['zbbbs'][0][i] = data[2*nbbbs + 2*i + 1]
self.data['rlim'][0][i] = data[2*nbbbs + 2*i]
self.data['zlim'][0][i] = data[2*nbbbs + 2*i + 1]


def getAll(self):
Expand Down
Binary file removed tools/tokamak_grids/pyGridGen/mesh
Binary file not shown.
12 changes: 6 additions & 6 deletions tools/tokamak_grids/pyGridGen/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

show(block=False)

plot(g.rbdry,g.zbdry,'g-')
plot(g.xlim,g.ylim,'g-')

draw()

Expand Down Expand Up @@ -75,12 +75,12 @@
iter=0, fpsi = None, fast='fast')


#save mesh object for faster re-iterations of process_grid (optional)
saveobject(mesh, 'mesh')
##save mesh object for faster re-iterations of process_grid (optional)
#saveobject(mesh, 'mesh')
#
#read mesh object for faster re-iterations of process_grid (optional)
with open('mesh', 'rb') as input:
mesh = pickle.load(input)
##read mesh object for faster re-iterations of process_grid (optional)
#with open('mesh', 'rb') as input:
# mesh = pickle.load(input)


process_grid( rz_grid, mesh )

0 comments on commit 94b812c

Please sign in to comment.