def lsc(): """ Compares an LSC simulation to 3D thermodynamic radiative transfer model A.J, Chatten et al. https://doi.org/10.1134/1.1787111 Expected fractions: - edge = 0.25 - escape = 0.66 - loss = 0.09 """ x = np.arange(400, 801, dtype=np.float) size = (l, w, d) = (4.8, 1.8, 0.250) # cm-1 lsc = LSC(size, wavelength_range=x) lsc.add_luminophore( 'Fluro Red', np.column_stack((x, fluro_red.absorption(x) * 11.387815)), # cm-1 np.column_stack((x, fluro_red.emission(x))), quantum_yield=0.95) lsc.add_absorber( 'PMMA', 0.02 # cm-1 ) def lamp_spectrum(x): """ Fit to an experimentally measured lamp spectrum with long wavelength filter. """ def g(x, a, p, w): return a * np.exp(-(((p - x) / w)**2)) a1 = 0.53025700136646192 p1 = 512.91400020614333 w1 = 93.491838802960473 a2 = 0.63578999789955015 p2 = 577.63100003089369 w2 = 66.031706473985736 return g(x, a1, p1, w1) + g(x, a2, p2, w2) lamp_dist = Distribution(x, lamp_spectrum(x)) wavelength_callable = lambda: lamp_dist.sample(np.random.uniform()) position_callable = lambda: rectangular_mask(l / 2, w / 2) lsc.add_light( "Oriel Lamp + Filter", (0.0, 0.0, 0.5 * d + 0.01), # put close to top surface rotation=(np.radians(180), (1, 0, 0)), # normal and into the top surface wavelength=wavelength_callable, # wavelength delegate callable position=position_callable # uniform surface illumination ) throw = 300 lsc.simulate(throw, emit_method='redshift') return lsc
def test2(): x = np.arange(400, 801, dtype=np.float) size = (l, w, d) = (4.8, 1.8, 0.250) # cm-1 lsc = LSC(size, wavelength_range=x) lsc.add_luminophore( "Fluro Red", np.column_stack((x, fluro_red.absorption(x) * 11.387815)), # cm-1 np.column_stack((x, fluro_red.emission(x))), quantum_yield=0.95, ) lsc.add_absorber("PMMA", 0.02) # cm-1 def lamp_spectrum(x): """ Fit to an experimentally measured lamp spectrum with long wavelength filter. """ def g(x, a, p, w): return a * np.exp(-(((p - x) / w)**2)) a1 = 0.53025700136646192 p1 = 512.91400020614333 w1 = 93.491838802960473 a2 = 0.63578999789955015 p2 = 577.63100003089369 w2 = 66.031706473985736 return g(x, a1, p1, w1) + g(x, a2, p2, w2) lamp_dist = Distribution(x, lamp_spectrum(x)) wavelength_callable = lambda: lamp_dist.sample(np.random.uniform()) position_callable = lambda: rectangular_mask(l / 2, w / 2) lsc.add_light( "Oriel Lamp + Filter", (0.0, 0.0, 0.5 * d + 0.01), # put close to top surface rotation=(np.radians(180), (1, 0, 0)), # normal and into the top surface wavelength=wavelength_callable, # wavelength delegate callable position=position_callable, # uniform surface illumination ) lsc.add_solar_cell({"left", "right", "near", "far"}) lsc.add_air_gap_mirror(lambertian=False) lsc.show() throw = 300 lsc.simulate(throw, emit_method="redshift") lsc.report()
def test1(): x = np.arange(400, 801, dtype=np.float) size = (l, w, d) = (4.8, 1.8, 0.250) # cm-1 lsc = LSC(size, wavelength_range=x) lsc.add_luminophore( "Fluro Red", np.column_stack((x, fluro_red.absorption(x) * 11.387815)), # cm-1 np.column_stack((x, fluro_red.emission(x))), quantum_yield=0.95, ) lsc.add_absorber("PMMA", 0.02) # cm-1 def lamp_spectrum(x): """ Fit to an experimentally measured lamp spectrum with long wavelength filter. """ def g(x, a, p, w): return a * np.exp(-(((p - x) / w)**2)) a1 = 0.53025700136646192 p1 = 512.91400020614333 w1 = 93.491838802960473 a2 = 0.63578999789955015 p2 = 577.63100003089369 w2 = 66.031706473985736 return g(x, a1, p1, w1) + g(x, a2, p2, w2) lamp_dist = Distribution(x, lamp_spectrum(x)) wavelength_callable = lambda: lamp_dist.sample(np.random.uniform()) position_callable = lambda: rectangular_mask(l / 2, w / 2) lsc.add_light( "Oriel Lamp + Filter", (0.0, 0.0, 0.5 * d + 0.01), # put close to top surface rotation=(np.radians(180), (1, 0, 0)), # normal and into the top surface wavelength=wavelength_callable, # wavelength delegate callable position=position_callable, # uniform surface illumination ) lsc.show() throw = 2500 lsc.simulate(throw, emit_method="redshift") edge = lsc.spectrum(facets={"left", "right", "near", "far"}, source="all") escape = lsc.spectrum(facets={"top", "bottom"}, source="all") lost = lsc.spectrum(source="all", events={"absorb"}) import matplotlib.pyplot as plt plt.hist(edge, bins=np.linspace(400, 800, 10), label="edge") plt.hist(escape, bins=np.linspace(400, 800, 10), label="escape") plt.hist(lost, bins=np.linspace(400, 800, 10), label="lost") plt.show() # number of lamp rays hitting the top surface incident = lsc.spectrum(source={"Oriel Lamp + Filter"}, kind="first", facets={"top"}) hitting = len(incident) counts = {"edge": len(edge), "escape": len(escape), "lost": len(lost)} fractions = { "edge": counts["edge"] / hitting, "escape": counts["escape"] / hitting, "lost": counts["lost"] / hitting, } print(counts, "sum", np.sum(list(counts.values()))) print(fractions, "sum", np.sum(list(fractions.values())))