-
Notifications
You must be signed in to change notification settings - Fork 11
/
rcwa_test_matrix.py
249 lines (209 loc) · 9.95 KB
/
rcwa_test_matrix.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
import numpy as np
import matplotlib.pyplot as plt
from solcore import si, material
from solcore.structure import Junction, Layer
from solcore.solar_cell import SolarCell
from solcore.solar_cell_solver import solar_cell_solver, default_options
from solcore.light_source import LightSource
from rigorous_coupled_wave_analysis.rcwa import rcwa
from solcore.absorption_calculator.nk_db import download_db, search_db
from solcore.material_system.create_new_material import create_new_material
import xarray as xr
from angles import make_angle_vector, theta_summary
calc = False
GaAs = material('GaAs')()
Air = material('Air')()
Ag = material('Ag_Jiang')()
# Materials for the anti-reflection coating
MgF2 = material('203', nk_db=True)()
#TiO2 = material('TiO2')()
Ta2O5 = material('410', nk_db = True)()
#Si = material('Si')()
SiN = material('321', nk_db = True)()
#x = 500
x=500
# anti-reflection coating
ARC = [Layer(si('78nm'), MgF2), Layer(si('48nm'), Ta2O5)]
ARC = [Layer(si('60nm'), SiN)]
size = ((x, 0),(x/2,np.tan(np.pi/3)*x))
# The layer with nanoparticles
#struct_mirror = [Layer(si('120nm'), TiO2, geometry=[{'type': 'rectangle', 'mat': Ag, 'center': (x/2, x/2),
# 'halfwidths': (210,210), 'angle': 0}])]
grating = [Layer(si('120nm'), SiN, geometry=[{'type': 'circle', 'mat': Ag, 'center': (0, 0),
'radius': 100, 'angle': 0}])]
# NP_layer=[Layer(si('50nm'), Ag)]
solar_cell = SolarCell(ARC + [Layer(material=GaAs, width=si('80nm'))] + grating)
#solar_cell = SolarCell(grating)
orders = 20
wavelengths = np.linspace(250, 930, 40)*1e-9
options = {'nm_spacing': 0.5,
'project_name': 'RCWA_test',
'calc_profile': False,
'n_theta_bins': 15,
'c_azimuth': 0.25,
'pol': 'u',
'wavelengths': wavelengths,
'theta_in': 0, 'phi_in': 0,
'parallel': True, 'n_jobs': -1,
'phi_symmetry': np.pi/2,
}
all_orders = [3, 9, 19, 39, 75, 99, 125, 147]
import seaborn as sns
pal = sns.cubehelix_palette(len(all_orders), start=.5, rot=-.9)
spect=np.loadtxt('AM0.csv', delimiter=',')
from solcore.interpolate import interp1d
from solcore.constants import q, h, c
AM0 = interp1d(spect[:,0], spect[:,1])
EQE_wl = np.linspace(250.1, 929.9, 700)
Jscs = []
if calc:
plt.figure()
for i1, orders in enumerate(all_orders):
print(orders)
grating = [Layer(si('120nm'), SiN, geometry=[{'type': 'circle', 'mat': Ag, 'center': (0, 0),
'radius': 100, 'angle': 0}])]
solar_cell = SolarCell(ARC + [Layer(material=GaAs, width=si('80nm'))] + grating)
output = rcwa(solar_cell, size, orders, options, incidence=Air, substrate=Ag, only_incidence_angle=True,
front_or_rear='front', surf_name='OPTOS')
A_GaAs = interp1d(wavelengths * 1e9, output['A_layer'].todense()[:, 1, :][:, 0])
Jsc = 0.1 * (q / (h * c)) * np.trapz(EQE_wl * A_GaAs(EQE_wl) * AM0(EQE_wl), EQE_wl) / 1e9
Jscs.append(Jsc)
#plt.figure()
#plt.plot(wavelengths, output['A_layer'].todense()[:, 0, :])
#plt.plot(wavelengths, output['A_layer'].todense()[:, 1, :])
plt.plot(wavelengths, output['A_layer'].todense()[:, 1, :], color=pal[i1], label=str(orders))
plt.plot(wavelengths, output['A_layer'].todense()[:, 2, :], '--', color=pal[i1])
to_save = np.vstack((wavelengths, output['A_layer'].todense()[:, 1, :][:, 0],
output['A_layer'].todense()[:, 2, :][:, 0],
output['R'][:,0],
output['T'][:,0])).T
np.savetxt('A_GaAs_' + str(orders) +'.csv', to_save, delimiter=',')
plt.plot(wavelengths, output['R'][:,0], '-.', color=pal[i1])
#plt.plot(wavelengths, output['T'][:,0])
#plt.legend(['ARC1', 'ARC2', 'GaAS', 'grting', 'R', 'T'])
plt.title('Orders')
plt.legend()
plt.show()
else:
load_orders = [5, 10, 20, 40, 75, 100, 125, 150]
plt.figure()
for i1, orders in enumerate(load_orders):
A_GaAs = np.loadtxt('A_GaAs_' + str(orders) + '.csv', delimiter=',')
plt.plot(A_GaAs[:, 0] * 1e9, A_GaAs[:, 1], color=pal[i1], label=str(orders))
plt.plot(A_GaAs[:, 0] * 1e9, A_GaAs[:, 2], '--', color=pal[i1])
plt.plot(A_GaAs[:, 0] * 1e9, A_GaAs[:, 3], '-.', color=pal[i1])
A_GaAs = interp1d(wavelengths * 1e9, A_GaAs[:, 1])
Jsc = 0.1 * (q / (h * c)) * np.trapz(EQE_wl * A_GaAs(EQE_wl) * AM0(EQE_wl), EQE_wl) / 1e9
Jscs.append(Jsc)
# plt.plot(wavelengths, output['T'][:,0])
# plt.legend(['ARC1', 'ARC2', 'GaAS', 'grting', 'R', 'T'])
plt.title('Orders')
plt.legend()
plt.show()
# AM0 spectrum
plt.figure()
plt.plot(all_orders, Jscs)
plt.show()
Jscs = []
orders = 40
radii = [50, 100, 150, 200, 250]
pal = sns.cubehelix_palette(len(radii), start=.5, rot=-.9)
if calc:
plt.figure()
for i1, rad in enumerate(radii):
print(orders)
grating = [Layer(si('120nm'), SiN, geometry=[{'type': 'circle', 'mat': Ag, 'center': (0, 0),
'radius': rad, 'angle': 0}])]
solar_cell = SolarCell(ARC + [Layer(material=GaAs, width=si('80nm'))] + grating)
output = rcwa(solar_cell, size, orders, options, incidence=Air, substrate=Ag, only_incidence_angle=True,
front_or_rear='front', surf_name='OPTOS')
A_GaAs = interp1d(wavelengths * 1e9, output['A_layer'].todense()[:, 1, :][:, 0])
Jsc = 0.1 * (q / (h * c)) * np.trapz(EQE_wl * A_GaAs(EQE_wl) * AM0(EQE_wl), EQE_wl) / 1e9
Jscs.append(Jsc)
#plt.figure()
#plt.plot(wavelengths, output['A_layer'].todense()[:, 0, :])
#plt.plot(wavelengths, output['A_layer'].todense()[:, 1, :])
plt.plot(wavelengths, output['A_layer'].todense()[:, 1, :], color=pal[i1], label=str(rad))
plt.plot(wavelengths, output['A_layer'].todense()[:, 2, :], '--', color=pal[i1])
plt.plot(wavelengths, output['R'][:,0], '-.', color=pal[i1])
to_save = np.vstack((wavelengths, output['A_layer'].todense()[:, 1, :][:, 0],
output['A_layer'].todense()[:, 2, :][:, 0],
output['R'][:, 0],
output['T'][:, 0])).T
np.savetxt('A_GaAs_rad_' + str(rad) +'.csv', to_save, delimiter=',')
#plt.plot(wavelengths, output['R'][:,0])
#plt.plot(wavelengths, output['T'][:,0])
#plt.legend(['ARC1', 'ARC2', 'GaAS', 'grting', 'R', 'T'])
plt.legend()
plt.title('Radius')
plt.show()
else:
plt.figure()
for i1, rad in enumerate(radii):
A_GaAs = np.loadtxt('A_GaAs_rad_' + str(rad) + '.csv', delimiter=',')
plt.plot(A_GaAs[:, 0] * 1e9, A_GaAs[:, 1], color=pal[i1], label=str(rad))
plt.plot(A_GaAs[:, 0] * 1e9, A_GaAs[:, 2], '--', color=pal[i1])
plt.plot(A_GaAs[:, 0] * 1e9, A_GaAs[:, 3], '-.', color=pal[i1])
A_GaAs = interp1d(wavelengths * 1e9, A_GaAs[:, 1])
Jsc = 0.1 * (q / (h * c)) * np.trapz(EQE_wl * A_GaAs(EQE_wl) * AM0(EQE_wl), EQE_wl) / 1e9
Jscs.append(Jsc)
# plt.plot(wavelengths, output['T'][:,0])
# plt.legend(['ARC1', 'ARC2', 'GaAS', 'grting', 'R', 'T'])
plt.title('Circle radius')
plt.legend()
plt.show()
plt.figure()
plt.plot(radii, Jscs)
plt.show()
Jscs = []
orders = 40
thick = np.linspace(0, 75, 10)
pal = sns.cubehelix_palette(len(thick), start=.5, rot=-.9)
if calc:
plt.figure()
for i1, th in enumerate(thick):
print(th)
ARC = [Layer(si(str(th)+'nm'), SiN)]
grating = [Layer(si('120nm'), SiN, geometry=[{'type': 'circle', 'mat': Ag, 'center': (0, 0),
'radius': rad, 'angle': 0}])]
solar_cell = SolarCell(ARC + [Layer(material=GaAs, width=si('80nm'))] + grating)
output = rcwa(solar_cell, size, orders, options, incidence=Air, substrate=Ag, only_incidence_angle=True,
front_or_rear='front', surf_name='OPTOS')
A_GaAs = interp1d(wavelengths * 1e9, output['A_layer'].todense()[:, 1, :][:, 0])
Jsc = 0.1 * (q / (h * c)) * np.trapz(EQE_wl * A_GaAs(EQE_wl) * AM0(EQE_wl), EQE_wl) / 1e9
Jscs.append(Jsc)
#plt.figure()
#plt.plot(wavelengths, output['A_layer'].todense()[:, 0, :])
#plt.plot(wavelengths, output['A_layer'].todense()[:, 1, :])
plt.plot(wavelengths, output['A_layer'].todense()[:, 1, :], color=pal[i1], label=str(th))
plt.plot(wavelengths, output['A_layer'].todense()[:, 2, :], '--', color=pal[i1])
plt.plot(wavelengths, output['R'][:,0], '-.', color=pal[i1])
to_save = np.vstack((wavelengths, output['A_layer'].todense()[:, 1, :][:, 0],
output['A_layer'].todense()[:, 2, :][:, 0],
output['R'][:, 0],
output['T'][:, 0])).T
np.savetxt('A_GaAs_arc_' + str(th) +'.csv', to_save, delimiter=',')
#plt.plot(wavelengths, output['R'][:,0])
#plt.plot(wavelengths, output['T'][:,0])
#plt.legend(['ARC1', 'ARC2', 'GaAS', 'grting', 'R', 'T'])
plt.legend()
plt.title('ARC thick')
plt.show()
else:
plt.figure()
for i1, th in enumerate(thick):
A_GaAs = np.loadtxt('A_GaAs_arc_' + str(th) + '.csv', delimiter=',')
plt.plot(A_GaAs[:, 0] * 1e9, A_GaAs[:, 1], color=pal[i1], label=str(th))
plt.plot(A_GaAs[:, 0] * 1e9, A_GaAs[:, 2], '--', color=pal[i1])
plt.plot(A_GaAs[:, 0] * 1e9, A_GaAs[:, 3], '-.', color=pal[i1])
A_GaAs = interp1d(wavelengths * 1e9, A_GaAs[:, 1])
Jsc = 0.1 * (q / (h * c)) * np.trapz(EQE_wl * A_GaAs(EQE_wl) * AM0(EQE_wl), EQE_wl) / 1e9
Jscs.append(Jsc)
# plt.plot(wavelengths, output['T'][:,0])
# plt.legend(['ARC1', 'ARC2', 'GaAS', 'grting', 'R', 'T'])
plt.title('ARC thick')
plt.legend()
plt.show()
plt.figure()
plt.plot(thick, Jscs)
plt.show()