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 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404
| import numpy as np import matplotlib.pyplot as plt from scipy.special import jv
h = 6.626e-34 c = 3e8 eV = 1.602e-19
class MetasurfaceSolarCell: """ 超表面增强太阳能电池模拟器 采用等效介质近似计算亚波长结构的光学响应 """ def __init__(self, wavelength_range=(300e-9, 1200e-9), n_points=200): """ 初始化模拟参数 Parameters: ----------- wavelength_range : tuple 波长范围 (m) n_points : int 波长采样点数 """ self.wavelengths = np.linspace(wavelength_range[0], wavelength_range[1], n_points) self.omega = 2 * np.pi * c / self.wavelengths def silicon_refractive_index(self, wavelength): """ 硅的色散模型 (基于Sellmeier方程修正) Parameters: ----------- wavelength : float or ndarray 波长 (m) Returns: -------- n, k : complex refractive index """ lambda_um = wavelength * 1e6 A = 3.41696 B = 0.138497 C = 0.013924 n = np.sqrt(A + B * lambda_um**2 / (lambda_um**2 - C)) k = 0.1 * np.exp(-(lambda_um - 0.8)**2 / 0.5) + 0.01 return n + 1j * k def tio2_refractive_index(self, wavelength): """ 二氧化钛(TiO2)折射率 TiO2是一种高折射率介质材料 (n≈2.5-2.7), 常用于构建全介质超表面结构 """ lambda_um = wavelength * 1e6 n = 2.5 + 0.1 / (lambda_um**2) k = 0.001 return n + 1j * k def effective_medium_approximation(self, f_metal, n_host, n_inclusion): """ Maxwell-Garnett等效介质近似 计算复合材料的等效介电常数: ε_eff = ε_host * (ε_inclusion + 2ε_host + 2f(ε_inclusion - ε_host)) / (ε_inclusion + 2ε_host - f(ε_inclusion - ε_host)) Parameters: ----------- f_metal : float inclusion的体积分数 (0 < f < 1) n_host : complex 基质材料折射率 n_inclusion : complex inclusion材料折射率 """ eps_host = n_host**2 eps_inclusion = n_inclusion**2 eps_eff = eps_host * (eps_inclusion + 2*eps_host + 2*f_metal*(eps_inclusion - eps_host)) / \ (eps_inclusion + 2*eps_host - f_metal*(eps_inclusion - eps_host)) return np.sqrt(eps_eff) def transfer_matrix(self, n1, n2, d, wavelength, theta=0): """ 计算单层膜的传输矩阵 M = [cos(δ) -i*sin(δ)/η; -i*η*sin(δ) cos(δ)] 其中 δ = (2π/λ) * n * d * cos(θ) Parameters: ----------- n1, n2 : complex 入射侧和薄膜的折射率 d : float 薄膜厚度 (m) wavelength : float 波长 (m) theta : float 入射角 (弧度) """ k0 = 2 * np.pi / wavelength theta2 = np.arcsin(n1 * np.sin(theta) / n2) delta = k0 * n2 * d * np.cos(theta2) eta = n2 * np.cos(theta2) M = np.array([[np.cos(delta), -1j*np.sin(delta)/eta], [-1j*eta*np.sin(delta), np.cos(delta)]]) return M def calculate_absorption(self, structure, theta=0): """ 计算多层膜结构的吸收光谱 Parameters: ----------- structure : list of dict 每层的参数 [{'n': refractive_index, 'd': thickness}, ...] theta : float 入射角 (弧度) Returns: -------- absorption : ndarray 吸收光谱 (0-1) """ n_air = 1.0 absorption = np.zeros(len(self.wavelengths)) for i, lam in enumerate(self.wavelengths): M_total = np.eye(2) for layer in structure: n = layer['n'](lam) if callable(layer['n']) else layer['n'] d = layer['d'] M = self.transfer_matrix(n_air, n, d, lam, theta) M_total = M_total @ M A = M_total[0, 0] B = M_total[0, 1] C = M_total[1, 0] D = M_total[1, 1] n_sub = structure[-1]['n'](lam) if callable(structure[-1]['n']) else structure[-1]['n'] r = (A + B*n_sub - C/n_air - D*n_sub/n_air) / \ (A + B*n_sub + C/n_air + D*n_sub/n_air) R = np.abs(r)**2 T = 1 - R absorption[i] = 1 - R - T return absorption def simulate_metasurface_cell(self, grating_period=500e-9, pillar_height=200e-9, pillar_radius=150e-9, si_thickness=2e-6): """ 模拟带有TiO2纳米柱超表面的硅太阳能电池 Parameters: ----------- grating_period : float 光栅周期 (m) pillar_height : float 纳米柱高度 (m) pillar_radius : float 纳米柱半径 (m) si_thickness : float 硅吸收层厚度 (m) """ f_pillar = np.pi * pillar_radius**2 / grating_period**2 print(f"超表面结构参数:") print(f" 光栅周期: {grating_period*1e9:.0f} nm") print(f" 纳米柱高度: {pillar_height*1e9:.0f} nm") print(f" 纳米柱半径: {pillar_radius*1e9:.0f} nm") print(f" 填充因子: {f_pillar:.3f}") print(f" 硅层厚度: {si_thickness*1e6:.1f} μm") def n_eff_layer(lam): n_tio2 = self.tio2_refractive_index(lam) n_air_layer = 1.0 return self.effective_medium_approximation(f_pillar, n_air_layer, n_tio2) structure = [ {'n': n_eff_layer, 'd': pillar_height}, {'n': self.silicon_refractive_index, 'd': si_thickness}, ] absorption_meta = self.calculate_absorption(structure) structure_ref = [ {'n': self.silicon_refractive_index, 'd': si_thickness}, ] absorption_ref = self.calculate_absorption(structure_ref) return absorption_meta, absorption_ref def calculate_jsc(self, absorption, am15_spectrum=None): """ 计算短路电流密度 J_sc J_sc = q ∫∫ (λ/hc) * I(λ) * A(λ) dλ Parameters: ----------- absorption : ndarray 吸收光谱 am15_spectrum : ndarray, optional AM1.5光谱辐照度 (W/m²/nm) """ if am15_spectrum is None: am15_spectrum = np.ones_like(self.wavelengths) * 1000 wavelengths_nm = self.wavelengths * 1e9 photon_flux = am15_spectrum * self.wavelengths / (h * c) j_sc = np.trapz(photon_flux * absorption, wavelengths_nm) * 1e-3 return j_sc
def main(): """ 主程序: 模拟并可视化超表面增强太阳能电池性能 """ print("=" * 60) print("超表面增强太阳能电池光学模拟") print("=" * 60) cell = MetasurfaceSolarCell(wavelength_range=(300e-9, 1100e-9), n_points=300) configs = [ {"name": "结构A: 小周期", "period": 400e-9, "radius": 120e-9, "height": 150e-9}, {"name": "结构B: 中周期", "period": 600e-9, "radius": 180e-9, "height": 200e-9}, {"name": "结构C: 大周期", "period": 800e-9, "radius": 250e-9, "height": 250e-9}, ] fig, axes = plt.subplots(2, 2, figsize=(14, 10)) ax1 = axes[0, 0] _, absorption_ref = cell.simulate_metasurface_cell( grating_period=600e-9, pillar_height=0, pillar_radius=0 ) ax1.plot(cell.wavelengths*1e9, absorption_ref, 'k--', linewidth=2, label='参考电池 (无超表面)') colors = ['#E74C3C', '#3498DB', '#2ECC71'] jsc_results = [] for idx, config in enumerate(configs): absorption_meta, _ = cell.simulate_metasurface_cell( grating_period=config["period"], pillar_height=config["height"], pillar_radius=config["radius"] ) jsc = cell.calculate_jsc(absorption_meta) jsc_results.append((config["name"], jsc)) ax1.plot(cell.wavelengths*1e9, absorption_meta, color=colors[idx], linewidth=2, label=f'{config["name"]} (Jsc={jsc:.1f} mA/cm²)') ax1.set_xlabel('波长 (nm)', fontsize=12) ax1.set_ylabel('吸收率', fontsize=12) ax1.set_title('超表面增强吸收光谱', fontsize=14, fontweight='bold') ax1.legend(loc='best') ax1.set_xlim(300, 1100) ax1.grid(True, alpha=0.3) ax2 = axes[0, 1] n_si = [cell.silicon_refractive_index(lam).real for lam in cell.wavelengths] k_si = [cell.silicon_refractive_index(lam).imag for lam in cell.wavelengths] ax2.plot(cell.wavelengths*1e9, n_si, 'b-', linewidth=2, label='n (实部)') ax2.plot(cell.wavelengths*1e9, k_si, 'r--', linewidth=2, label='k (虚部)') ax2.set_xlabel('波长 (nm)', fontsize=12) ax2.set_ylabel('折射率', fontsize=12) ax2.set_title('硅材料色散特性', fontsize=14, fontweight='bold') ax2.legend() ax2.grid(True, alpha=0.3) ax3 = axes[1, 0] names = [r[0].split(':')[1].strip() for r in jsc_results] jscs = [r[1] for r in jsc_results] bars = ax3.bar(names, jscs, color=colors, alpha=0.8, edgecolor='black') ax3.axhline(y=cell.calculate_jsc(absorption_ref), color='k', linestyle='--', linewidth=2, label='参考电池') for bar, jsc in zip(bars, jscs): height = bar.get_height() enhancement = (jsc / cell.calculate_jsc(absorption_ref) - 1) * 100 ax3.text(bar.get_x() + bar.get_width()/2., height + 0.5, f'{jsc:.1f}\n(+{enhancement:.1f}%)', ha='center', va='bottom', fontsize=10, fontweight='bold') ax3.set_ylabel('短路电流密度 Jsc (mA/cm²)', fontsize=12) ax3.set_title('不同超表面结构的Jsc对比', fontsize=14, fontweight='bold') ax3.legend() ax3.grid(True, alpha=0.3, axis='y') ax4 = axes[1, 1] ax4.axis('off') mechanism_text = """ 超表面增强机制分析: 1. 导模共振 (GMR) • 纳米柱阵列作为耦合光栅 • 将自由空间光耦合到波导模式 • 显著延长光程长度 2. 米氏共振增强 • 高折射率TiO2纳米柱 • 电/磁偶极子共振 • 强近场局域化效应 3. 抗反射效应 • 渐变等效折射率 • 减少菲涅尔反射损失 • 宽带增透特性 4. 光散射管理 • 将垂直入射光散射到横向 • 增加有效吸收路径 • 突破4n²极限的可能性 """ ax4.text(0.1, 0.9, mechanism_text, transform=ax4.transAxes, fontsize=11, verticalalignment='top', fontfamily='monospace', bbox=dict(boxstyle='round', facecolor='wheat', alpha=0.3)) plt.tight_layout() plt.savefig('metasurface_solar_cell_analysis.png', dpi=150, bbox_inches='tight') print("\n可视化结果已保存至: metasurface_solar_cell_analysis.png") print("\n" + "=" * 60) print("性能总结") print("=" * 60) jsc_ref = cell.calculate_jsc(absorption_ref) print(f"参考电池 (无超表面): Jsc = {jsc_ref:.2f} mA/cm²") for name, jsc in jsc_results: enhancement = (jsc / jsc_ref - 1) * 100 print(f"{name}: Jsc = {jsc:.2f} mA/cm² (增强: +{enhancement:.1f}%)") print("=" * 60)
if __name__ == "__main__": main()
|