Beispiel #1
0
#! /usr/pppl/python/2.3.5x/bin/python
import sys, Gnuplot, Numeric, sets
from get_EV import *
mn = int(sys.argv[1])
mx = int(sys.argv[2])
data_list = dict()
d1 = get_EV(mn)
data = d1.data
for key in data.keys():
  data_list[key] = [data[key]]
for i in range(mn+1,mx):
  try:
    try:
      d1 = get_EV(i)
      data = d1.data
    except:
      d1 = get_EV(i,output_folder='output_cyl')
      data = d1.data
  except:
    continue
  for key in data_list.keys():
    data_list[key].append(data[key])
for key in data_list.keys():
  if len(sets.Set(data_list[key])) ==1:
    continue
  if 't_' in key or 'type' in key or 'kB' in key or 'num' in key or 'NN' in key:
    continue
  #print key
  data_list[key] = Numeric.array(data_list[key])
  g = Gnuplot.Gnuplot(persist=1)
  #g('set log y')
#! /usr/pppl/python/2.3.5x/bin/python
import Numeric, Gnuplot, sys, math, multiplot
from get_EV import *
coord = sys.argv[1]
var_key = sys.argv[2]
ylabels = []
d = []
N_fac = 10
num0 = int(sys.argv[3])
EV = get_EV(num0) 
x = Numeric.arange(0,EV.data['a'],EV.data['a']/(EV.data['ngrid']*N_fac))
tt = '{/Symbol x}_%s'%coord
print_keys = EV.idata
for i in range(len(print_keys)):
  if print_keys[i]!=var_key:
    tt = tt+', %s=%g'%(print_keys[i],EV.data[print_keys[i]])
title=tt
for i in range(3,len(sys.argv),2):
  num = int(sys.argv[i])
  evec_num = int(sys.argv[i+1])
  EV = get_EV(num) 
  (y,yl)  = EV.get_evec1(coord,evec_num,x)
  ereal = ((EV.evals[evec_num])).real
  eimag = ((EV.evals[evec_num])).imag
  ylabels.append( '%s=%g'%(var_key,EV.data[var_key]))
  dr =  Gnuplot.Data(x,y.real,title='Real',with='lines')
  di =  Gnuplot.Data(x,y.imag,title='Imag',with='lines')
  dg = Gnuplot.Data(EV.grid,[0]*len(EV.grid),with='points 1',title='Grid')
  d.append([dr,di,dg])
  if EV.data['vcyl'] and eimag!=0:
    if EV.data['tw'] <= 0 and abs(eimag)>0:
Beispiel #3
0
#! /usr/pppl/python/2.3.5x/bin/python
import Numeric, Gnuplot, sys, sets
from get_EV import *
ref = int(sys.argv[1])
d = get_EV(ref,output_folder='output_vcyl')

len_branch = len(d.evals)/6-1
xs = 1.5
ys = 2.5*math.log(len_branch)
dy = ys/len_branch
dx = xs/3.
inds = list(Numeric.argsort(d.evals.real))
inds.reverse()
x = Numeric.arange(0,d.data['a'],1./(d.data['ngrid']*10))
#print inds
#print Numeric.take(d.evals.real,inds)
fns = ['fast', 'alfven', 'slow']
for i in range(3):
  g = Gnuplot.Gnuplot()
  g('set output "plots/%d_all_%s.eps"'%(ref,fns[i]))
  g('set term postscript enhanced eps solid 8')
  g('set size %g,%g'%(xs,ys))
  g('set multiplot')
  g('set size %g,%g'%(dx,dy))
  if len_branch>50:
    g('unset xtics')
    #g('unset ytics')
    #g('set yrange [0:1]')
    g('set xrange [0:%g]'%d.data['a'])
  
  for j in range(len_branch-1,-1,-1):
Beispiel #4
0
#! /usr/pppl/python/2.3.5x/bin/python
from get_EV import *
import Gnuplot, Numeric, cmath, sys, sets
ref = int(sys.argv[1])
var_key = sys.argv[2]
var_key2 = sys.argv[3]
nq = False
if var_key == 'nq':
  nq = True
  if 'z' in sys.argv:
    var_key = 'Bz0'
  else:
    var_key = 'Bt0'
d1 = get_EV(ref)
print_keys = d1.idata 
d1 = d1.data
dk = dict()
dk_keys = ['t_assemb','num','t_solve',var_key,var_key2,'epsilo','NN','vcyl']
for key in d1.keys():
  if key not in dk_keys:
    dk[key] = d1[key]
matching_files = []
var_list= []
var2_list = []

g = Gnuplot.Gnuplot(persist=1)
g1 = Gnuplot.Gnuplot(persist=1)
g._clear_queue()
g1._clear_queue()
g.xlabel(var_key)
g1.xlabel(var_key)
Beispiel #5
0
#! /usr/pppl/python/2.3.5x/bin/python
from get_EV import *
import Gnuplot, Numeric, cmath, sys
ref = sys.argv[1]
var_key = sys.argv[2]
d1 = get_EV(ref)
dk = dict()
print_keys = d1.idata #['Vz0','P1','alpha','ngrid','tw','b']
dk_keys = ['t_assemb','num','t_solve',var_key,'epsilo','NN','vcyl']
for key in d1.data.keys():
  if key not in dk_keys:
    dk[key] = d1.data[key]
matching_files = []
var_list= []
p0_list = []
eps_list = []
g = Gnuplot.Gnuplot(persist=1)
if 'lx' in sys.argv:
  g('set log x')
if 'ly' in sys.argv:
  g('set log y')
negty = ''
nfacy = 1 
if 'negy' in sys.argv:
  negty = '-'
  nfacy = -1
negtx = ''
nfacx = 1 
if 'negx' in sys.argv:
  negtx = '-'
  nfacx = -1
Beispiel #6
0
#! /usr/pppl/python/2.3.5x/bin/python
import Numeric, Gnuplot, sys, math, multiplot, os
from get_EV import *
num = (sys.argv[1])
evec_num = int(sys.argv[2])
nc = int(sys.argv[3])
coord = (sys.argv[-nc:])
nc = len(coord)
N_fac = 10
EV = get_EV(num) 
ereal = ((EV.evals[evec_num])).real
eimag = ((EV.evals[evec_num])).imag
minx = 0
maxx = EV.data['a']
if 'xr' in sys.argv:
  ind = sys.argv.index('xr')
  minx = max(0,float(sys.argv[ind+1]))
  maxx = min(EV.data['a'],float(sys.argv[ind+2]))
x = Numeric.arange(minx,maxx,EV.data['a']/(EV.data['ngrid']*N_fac))
print_keys = EV.idata
tt = '{/Symbol w}=%g+%gi, '%(ereal,eimag)
for i in range(len(print_keys)):
  tt = tt+'%s=%g, '%(print_keys[i],EV.data[print_keys[i]])
title=tt[:-2] 
ylabels = []
d = []
for i in range(nc):
  #ylabels.append('{/Symbol x}_%s'%coord[i])
  (y,yl)  = EV.get_evec1(coord[i],evec_num,x)
  ylabels.append(yl)
  dr =  Gnuplot.Data(x,y.real,title='Real',with='lines')
Beispiel #7
0
dk = {'a': 1.0, 'rho0': 20.0, 'Bt0': 0.0, 'Bz0': 0.02,  'k': 0.5, 'm': 1, 'equilibr': 1,  's2': 0.083333333333333301}
if dk['m'] != 1:
  print 'm must equal 1'
  sys.exit()
matching_files = []
N = []
N_lin = []
error = []
err_lin = []
A = dk['a']**2
s2 = dk['s2']
omega1 = dk['Bz0']**2/(2*dk['rho0']*s2/(5./3.)*dk['Bz0']**2*A)*(A*dk['k']**2+gamma_alpha[gamma_ind]**2)*(1+s2)*(1-(1-4*s2*A*dk['k']**2/((1+s2)**2*(A*dk['k']**2+gamma_alpha[gamma_ind]**2)))**(1./2.))
slow_inf = s2*dk['Bz0']**2*dk['k']**2/(dk['rho0']*(1+s2)*s2/(5./3.)*dk['Bz0']**2)
for i in range(1,1000):
  try:
    d = get_EV(i,output_folder='output_cyl')
    data = d.data
  except:
    continue
  match = True
  for key in dk.keys():    
    if key == 's2':
      continue
    if data[key] != dk[key]:        
      match = False
      break
  if match:
    matching_files.append(i)
    evals = d.evals
    evalsr = Numeric.absolute(evals.real)
    if data['fe_type'] == 'spline':
Beispiel #8
0
import sys, Numeric, Gnuplot, cmath
equilib = '4'
dk = {'a': 1.0,'lambd': 3.1760000000000002,  'ngrid': 20, 'rho0': 1.0,   'k': 1.20000000000000001,  'm': 1, 'equilibr': 4, 'nz': 1, 'fe_type':'spline','P1':0.0,'P0':0.050000000000000003}
matching_files = []
Vz0_list= []
p0_list = []
eps_list = []
g = Gnuplot.Gnuplot(persist=1)
g._clear_queue
g.xlabel('Vz0')
g.ylabel('{/Symbol w}^2')
print dk['equilibr']
scale_fac = 10**7
for i in range(1,1000):
  try:
    d2 = get_EV(i)
    data = d2.data
  except:
    continue
  match = True
  for key in dk.keys(): 
    if key == 'm':
      if abs(data[key]) == abs(dk[key]):
        continue   
    if data[key] != dk[key]:
      match = False
      print 'dk does not equal data for run %d on key: %s'%(i,key)
      break
  if match:    
    matching_files.append(data['num'])
    Vz0_list.append(data['Vz0'])
Beispiel #9
0
#! /usr/pppl/python/2.3.5x/bin/python
from get_EV import *
import Gnuplot, Numeric, cmath, sys
equilib = '3'
dk = {'a': 1.0,  'ngrid': 20, 'rho0': 1.0, 'tw':10,'b': 2.0,'Bt0': 1.0,  'k': 0.20000000000000001,  'm': 2, 'equilibr': int(equilib),  'fe_type':'spline'}
ref = sys.argv[1]
dk = get_EV(ref).data
equilib = dk['equilibr']
matching_files = []
nq_list= []
p0_list = []
eps_list = []
g = Gnuplot.Gnuplot(persist=1)
g._clear_queue
g.xlabel('nq')
g.ylabel('{/Symbol w}^2')
print dk['equilibr']
scale_fac = 10**7
for i in range(1,1000):
  try:
    d2 = get_EV(i)
    data = d2.data
  except:
    continue
  match = True
  for key in dk.keys(): 
    if key == 'm':
      if abs(data[key]) == abs(dk[key]):
        continue   
    if data[key] != dk[key]:
      match = False
Beispiel #10
0
#! /usr/pppl/python/2.3.5x/bin/python
Bz = 2e-2
rho = 20
R = 1
k = .5
from pygsl import sf
from get_EV import *
import Numeric
import Gnuplot
import sys
m=1
gamma = ([1.841183781, 5.331442774, 8.536316366, 11.7060049, 14.86358863, 18.01552786, 21.16436986, 24.31132686, 27.45705057, 30.60192297, 33.7461829, 3.68899874E+01, 40.03344405, 43.17662897, 46.31959756, 49.46239114, 52.60504111, 55.74757179, 58.8900023])
N = 10
d = get_EV(int(sys.argv[1]))
data = d.data
nphi = data['ngrid']
xgrid = d.grid
x = Numeric.arange(0,data['a'],data['a']/100.)
x[0] = x[1]/10000.0
y = Numeric.zeros(len(x),typecode=Numeric.Float)
ygrid = Numeric.zeros(len(xgrid),typecode=Numeric.Float)
dk = data
A = dk['a']**2
s2 = dk['s2']
evals = d.evals.real**2
if data['fe_type'] == 'linconst':
  xgrid = xgrid+xgrid[1]/2.
for gamma_ind in range(6):#min(nphi,len(gamma)-1)):#nphi,2):
  for i in range(len(x)):
    y[i] = sf.bessel_J1(x[i]*gamma[gamma_ind])[0]
  for i in range(len(xgrid)):