-
Notifications
You must be signed in to change notification settings - Fork 0
/
collecting.py
127 lines (94 loc) · 2.41 KB
/
collecting.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
''' FOR g = 0.1, 0 > L > -2*L2 '''
g = 0.1
D0 = 2*np.exp(2+2*W(-g/A, -1)).real
L2 = (g/(3*W(-g/(3*np.sqrt(2)*np.exp(4/3)), -1)))**2
L2 = L2.real
L0 = g**2/16
Ec20 = -g/(c*np.sqrt(2)*W(-g/A, -1)).real
print('D0 =', 2*np.exp(2+2*W(-g/A, -1)).real, '\n')
print('L2 =', L2,'\n')
print('L0 =', L0,'\n')
print('Ec20 = ', Ec20, '\n')
L = np.linspace(0, 2*L2, 50)
fE = open('Ecn_g01_L2.txt', 'w')
fD = open('D2n_g01_L2.txt', 'w')
for i in range(len(L)):
Ec2, Xm2 = crit_Ecn(L[i], g)
Dm2 = 1/Xm2**2
print('Ec =',Ec2/Ec20)
print('Dc =',Dm2/D0)
print(i, '\n')
fE.write(str(L[i]) + ' ' + str(Ec2) + '\n')
fD.write(str(L[i]) + ' ' + str(Dm2) + '\n')
fE.close()
fD.close()
''' FOR g = 0.1, 0 < L < L2 '''
g = 0.1
D0 = 2*np.exp(2+2*W(-g/A, -1)).real
L2 = (g/(3*W(-g/(3*np.sqrt(2)*np.exp(4/3)), -1)))**2
L2 = L2.real
L0 = g**2/16
Ec20 = -g/(c*np.sqrt(2)*W(-g/A, -1)).real
print('D0 =', 2*np.exp(2+2*W(-g/A, -1)).real, '\n')
print('L2 =', L2,'\n')
print('L0 =', L0,'\n')
print('Ec20 = ', Ec20, '\n')
L = np.linspace(0,L2,20)
fE = open('Ecp_g01_L2.txt', 'w')
fD = open('D2p_g01_L2.txt', 'w')
for i in range(len(L)):
Ec2, Dm2 = crit_Ecp (L[i], g)
print('Ec =',Ec2/Ec20)
print('Dc =',Dm2/D0)
print(i, '\n')
fE.write(str(L[i]) + ' ' + str(Ec2) + '\n')
fD.write(str(L[i]) + ' ' + str(Dm2) + '\n')
fE.close()
fD.close()
'''reading'''
fE = open('Ecp_g01_L2.txt')
fD = open('D2p_g01_L2.txt')
dataE = fE.read()
dataE = dataE.split()
dataE = np.array(list(map(float, dataE)))
m = int(len(dataE)/2)
dataE = np.reshape(dataE, (m, 2))
Lp = dataE[:, 0]/L2
Ecp = dataE[:, 1]/Ec20
dataD = fD.read()
dataD = dataD.split()
dataD = np.array(list(map(float, dataD)))
m = int(len(dataD)/2)
dataD = np.reshape(dataD, (m, 2))
Dp = dataD[:, 1]/D0
fE.close()
fD.close()
fE = open('Ecn_g01_L2.txt')
fD = open('D2n_g01_L2.txt')
dataE = fE.read()
dataE = dataE.split()
dataE = np.array(list(map(float, dataE)))
m = int(len(dataE)/2)
dataE = np.reshape(dataE, (m, 2))
Ln = -dataE[:, 0]/L2
Ln = np.flip(Ln, 0)
Ecn = dataE[:, 1]/Ec20
Ecn = np.flip(Ecn, 0)
dataD = fD.read()
dataD = dataD.split()
dataD = np.array(list(map(float, dataD)))
m = int(len(dataD)/2)
dataD = np.reshape(dataD, (m, 2))
Dn = dataD[:, 1]/D0
Dn = np.flip(Dn, 0)
fE.close()
fD.close()
L = np.concatenate((Ln, Lp))
Dc = np.concatenate((Dn, Dp))
Ec = np.concatenate((Ecn, Ecp))
plt.plot(L, Dc)
plt.axvline(x = 0, ls = '--')
plt.figure()
plt.plot(L, Ec)
plt.axvline(x = 0, ls = '--')
plt.show()