def test_inc_coh_tmm(): GaInP = material("GaInP")(In=0.5) GaAs = material("GaAs")() Ge = material("Ge")() optical_struct = SolarCell([ Layer(material=GaInP, width=si("5000nm")), Layer(material=GaAs, width=si("200nm")), Layer(material=GaAs, width=si("5um")), Layer(material=Ge, width=si("50um")), ]) wl = np.linspace(400, 1200, 5) * 1e-9 options = State() options.wavelength = wl options.optics_method = "TMM" options.no_back_reflection = False options.BL_correction = True options.recalculate_absorption = True c_list = [ ["c", "c", "c", "c"], ["c", "c", "c", "i"], ["c", "i", "i", "c"], ["i", "i", "i", "i"], ] results = [] for i1, cl in enumerate(c_list): options.coherency_list = cl solar_cell_solver(optical_struct, "optics", options) results.append(optical_struct.absorbed) A_calc = np.stack(results) A_data = np.array( [[0.5742503, 0.67956899, 0.73481184, 0.725372, 0.76792856], [0.5742503, 0.67956899, 0.73481184, 0.725372, 0.76792856], [0.5742503, 0.67956899, 0.73474943, 0.70493469, 0.70361194], [0.5742503, 0.67956899, 0.70927724, 0.71509221, 0.71592772]]) assert A_calc == approx(A_data)
], sn=1, sp=1, kind='DA') ] # And, finally, we put everything together, adding also the surface recombination velocities sn and sp. # setting kind = 'DA' in the Junction definition tells the electrical solver later to use the depletion approximation optical_struct = SolarCell(ARC + top_junction + middle_junction + DBRa + DBRb + DBRc + bottom_junction, shading=0.05) wl = np.linspace(250, 1700, 400) * 1e-9 options = State() options.wavelength = wl options.optics_method = 'TMM' options.no_back_reflection = False options.pol = 'p' options.BL_correction = True options.coherency_list = 111 * ['c'] options.theta = 30 solar_cell_solver(optical_struct, 'qe', options) plt.figure() plt.plot( wl * 1e9, optical_struct[0].layer_absorption + optical_struct[1].layer_absorption) plt.plot(wl * 1e9, optical_struct[2].layer_absorption) plt.plot(wl * 1e9, optical_struct[3].layer_absorption) plt.plot(wl * 1e9, optical_struct[100].layer_absorption) plt.plot(wl * 1e9, optical_struct.absorbed, '--')
default_options.wavelength = np.linspace(300, 1800, 251) * 1e-9 default_options.light_source = LightSource(source_type='standard', version='AM1.5g', x=default_options.wavelength, output_units='photon_flux_per_m') # IV control default_options.voltages = np.linspace(0, 1.2, 100) default_options.mpp = False default_options.light_iv = False default_options.internal_voltages = np.linspace(-6, 4, 1000) default_options.position = None default_options.radiative_coupling = False # Optics control default_options.optics_method = 'BL' default_options.recalculate_absorption = False default_options = merge_dicts(default_options, ASC.db_options, PDD.pdd_options, rcwa_options) def solar_cell_solver(solar_cell, task, user_options=None): """ Solves the properties of a solar cell object, either calculating its optical properties (R, A and T), its quantum efficiency or its current voltage characteristics in the dark or under illumination. The general options for the solvers are passed as dicionaries. :param solar_cell: A solar_cell object :param task: Task to perform. It has to be "optics", "iv", "qe", "equilibrium" or "short_circuit". The last two only work for PDD junctions :param user_options: A dictionary containing the options for the solver, which will overwrite the default options. :return: None """ if type(user_options) in [State, dict]:
Layer(material=GaInP, width=si("5000nm")), Junction( [ Layer(material=GaAs, width=si("200nm")), Layer(material=GaAs, width=si("5um")), ], kind="DA", ), Layer(material=Ge, width=si("50um")), ]) wl = np.linspace(250, 1700, 300) * 1e-9 options = State() options.wavelength = wl options.optics_method = "TMM" options.no_back_reflection = False options.BL_correction = True options.recalculate_absorption = True options.positions = [1e-8, 1e-9, 1e-8, 1e-7] options.theta = 0 c_list = [ ["c", "c", "c", "c"], ["c", "c", "c", "i"], ["c", "i", "i", "c"], ["i", "i", "i", "i"], ] titles = [ "All coherent",
ropt = dict(LatticeTruncation='Circular', DiscretizedEpsilon=True, DiscretizationResolution=4, PolarizationDecomposition=False, PolarizationBasis='Default', LanczosSmoothing=True, SubpixelSmoothing=True, ConserveMemory=False, WeismannFormulation=True) light_source = LightSource(source_type='standard', version='AM0') options = State() options['rcwa_options'] = ropt options.optics_method = 'RCWA' options.wavelength = wavelengths options.light_source = light_source options.pol = 's' options.mpp = True options.light_iv = True options.position = 1e-10 options.voltages = np.linspace(-1.5, 1.5, 100) options.size = size options.orders = 20 options.parallel = True window_material = InGaP(In=0.485, Na=si(5e18, 'cm-3')) # window_material.n_data = np.stack([wavelengths, InGaP_nk.n(wavelengths)]) # window_material.k_data = np.stack([wavelengths, InGaP_nk.k(wavelengths)]) # window_material.n_path = '/home/phoebe/Documents/rayflare/examples/data/InGaP_n.txt'