-
Notifications
You must be signed in to change notification settings - Fork 1
/
makeplots.py
95 lines (68 loc) · 2.47 KB
/
makeplots.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
93
94
95
import matplotlib.pyplot as plt
from boutdata import collect
from numpy import amax, abs, linspace, transpose
# Single filament results
Apar1 = collect("Apar", path="single", xind=40, zind=80)[:,0,0,0]
Apar2 = collect("Apar", path="single-no-resist", xind=40, zind=80)[:,0,0,0]
t = collect("t_array", path="single")
plt.plot(t, Apar1, label=r"$\eta = 10^{-5}$")
plt.plot(t, Apar2, label=r"$\eta = 0.0$")
plt.xlabel("Time [normalised]")
plt.ylabel(r"Flux $A_{||}$ at filament centre")
plt.legend()
plt.savefig("single_flux.pdf")
plt.show()
# Shape change
j1 = collect("Jpar", path="single", zind=80,tind=0)[0,:,0,0]
j2 = collect("Jpar", path="single", zind=80,tind=1)[0,:,0,0]
j3 = collect("Jpar", path="single", zind=80,tind=100)[0,:,0,0]
plt.plot(j1, label=r"$t=0$")
plt.plot(j2, label=r"$t=5$")
plt.plot(j3, label=r"$t=500$")
plt.xlabel("X grid index")
plt.ylabel(r"$J_{||}$")
plt.legend()
plt.savefig("single_jpar_x.pdf")
plt.show()
j1 = collect("Jpar", path="single", xind=40,tind=0)[0,0,0,:]
j2 = collect("Jpar", path="single", xind=40,tind=1)[0,0,0,:]
j3 = collect("Jpar", path="single", xind=40,tind=100)[0,0,0,:]
plt.plot(j1, label=r"$t=0$")
plt.plot(j2, label=r"$t=5$")
plt.plot(j3, label=r"$t=500$")
plt.xlabel("Z grid index")
plt.ylabel(r"$J_{||}$")
plt.legend()
plt.savefig("single_jpar_z.pdf")
plt.show()
### Merging
Apar1 = collect("Apar", path="merging", xind=40, zind=80)[:,0,0,0]
Apar2 = collect("Apar", path="merging-no-resist", xind=40, zind=80)[:,0,0,0]
t = collect("t_array", path="merging")
plt.plot(t, Apar1, label=r"$\eta = 10^{-5}$")
plt.plot(t, Apar2, label=r"$\eta = 0.0$")
plt.xlabel("Time [normalised]")
plt.ylabel(r"Flux $A_{||}$ at domain centre")
plt.legend()
plt.savefig("merge_flux.pdf")
plt.show()
def contourJ(data, nlevels=51):
maxabs = amax(abs(data))
levels = linspace(-maxabs, maxabs, num=nlevels)
cmap = plt.cm.get_cmap("bwr")
plt.contourf(transpose(data), levels, cmap=cmap)
plt.colorbar()
plt.xlabel("X grid index")
plt.ylabel("Z grid index")
for tind in [0, 100]:
j = collect("jpar", path="merging-no-resist", tind=tind)
contourJ(j[0,:,0,:])
plt.title(r"$J_{||}$ at t = %03d. $\eta = 0$" % (t[tind],))
plt.savefig("merge-nores-j-t%03d.pdf" % (tind,))
plt.show()
for tind in [0, 20, 40, 100]:
j = collect("jpar", path="merging", tind=tind)
contourJ(j[0,:,0,:])
plt.title(r"$J_{||}$ at t = %03d. $\eta = 10^{-5}$" % (t[tind],))
plt.savefig("merge-j-t%03d.pdf" % (tind,))
plt.show()