-
Notifications
You must be signed in to change notification settings - Fork 0
/
ITPA_GENE.py
127 lines (78 loc) · 2.62 KB
/
ITPA_GENE.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import Mix as mix
import read_data as rd
import ControlPlot as cpr
import ymath
import curve as crv
import write_data as wr
import zf_gam as zf
import ITG_gamma as itg
import transport
import equil_profiles
import Distribution as distribution
import MPR as mpr
import gam_theory
import gam_exp
import Geom as geom
import common
import numpy as np
from scipy import interpolate
import h5py as h5
from scipy.signal import correlate
def reload():
# Important: put here all modules that you want to reload
mix.reload_module(mix)
mix.reload_module(rd)
mix.reload_module(cpr)
mix.reload_module(ymath)
mix.reload_module(crv)
mix.reload_module(wr)
mix.reload_module(zf)
mix.reload_module(itg)
mix.reload_module(transport)
mix.reload_module(equil_profiles)
mix.reload_module(distribution)
mix.reload_module(mpr)
mix.reload_module(gam_theory)
mix.reload_module(gam_exp)
mix.reload_module(geom)
mix.reload_module(common)
def GENE_ES_global(oo):
dd = oo.get('dds', None)[0]
flag_semilogy = oo.get('flag_semilogy', False)
# --- GENE data ---
path_gene = 'd:/Work-Projects/MyProgs/ORB_data/turbulence/ITPA/GENE/ES-global/'
x_gene = np.loadtxt(path_gene + '/x.dat')
t_gene = np.loadtxt(path_gene + '/t.dat') # in a/cs units
phi_gene = np.loadtxt(path_gene + '/phi.dat') # (x,t), in T/(e*rho_star) units
# - renormalize GENE data -
rho_star = 2 / dd['Lx']
inv_rho_star = 1. / rho_star
renorm_phi = dd['wc'] * dd['R0'] / dd['cs']
curves = crv.Curves().xlab('t[wci^{-1}]').ylab('x').tit('Phi')
# curves.new()\
# .XS(x_gene)\
# .YS(t_gene * renorm_phi)\
# .ZS(phi_gene).lev(60)
curves.new() \
.YS(x_gene) \
.XS(t_gene * renorm_phi) \
.ZS(phi_gene.T).lev(60)
cpr.plot_curves_3d(curves)
max_phi_gene = np.max(phi_gene, axis=0) # -> function on t
# t_gene = t_gene * inv_rho_star # in 1/wc units
t_gene = t_gene * renorm_phi # in 1/wc units
max_phi_gene = max_phi_gene / renorm_phi # in T/e units
# --- ORB5 DATA ---
vvar = common.choose_vars(oo)[0]
data_orb = vvar['data'][0]
t_orb = vvar['x']
leg_orb = vvar['legs'][0]
curves = crv.Curves().xlab('t[wci^{-1}]').tit('ORB5:\ ' + leg_orb)
curves.new().XS(t_orb).YS(data_orb)
cpr.plot_curves(curves)
# # --- COMPARE ---
curves = crv.Curves().xlab('t[wci^{-1}]').tit('max_s:\ \Phi')
curves.flag_semilogy = flag_semilogy
curves.new().XS(t_gene).YS(max_phi_gene).leg('GENE')
curves.new().XS(t_orb).YS(data_orb).leg('ORB5')
cpr.plot_curves(curves)