def setup_module(module): ################ Light parameters ##################### # Set up light objects wl_super = 500.0 wavelengths = np.array([wl_super]) light_list = [ objects.Light(wl, theta=20, phi=40, max_order_PWs=1) for wl in wavelengths ] light = light_list[0] ################ Scattering matrices (for distinct layers) ############## """ Calculate scattering matrices for each distinct layer. Calculated in the order listed below, however this does not influence final structure which is defined later """ # period must be consistent throughout simulation!!! period = 600 NW_diameter = 120 num_BM = 20 NW_array = objects.NanoStruct('2D_array', period, NW_diameter, height_nm=2330, inclusion_a=materials.Si_c, background=materials.Air, loss=True, make_mesh_now=False, mesh_file='600_120.mail') sim_NW_array = NW_array.calc_modes(light, num_BM=num_BM) superstrate = objects.ThinFilm(period=period, height_nm='semi_inf', material=materials.Air, loss=False) sim_superstrate = superstrate.calc_modes(light) substrate = objects.ThinFilm(period=period, height_nm='semi_inf', material=materials.SiO2_a, loss=False) sim_substrate = substrate.calc_modes(light) ################ Construct & solve for full solar cell structure ############## """ Now when defining full structure order is critical and solar_cell list MUST be ordered from bottom to top! """ stack = Stack((sim_substrate, sim_NW_array, sim_superstrate)) stack.calc_scat() module.stack_list = [stack] last_light_object = light_list.pop() param_layer = NW_array # Specify the layer for which the parameters should be printed on figures. params_string = plotting.gen_params_string(param_layer, last_light_object, max_num_BMs=num_BM) active_layer_nu = 1 plotting.t_r_a_write_files(stack_list, wavelengths)
def setup_module(module): ################ Light parameters ##################### # Set up light objects wavelengths = np.array([700]) light_list = [ objects.Light(wl, max_order_PWs=2, theta=0.0, phi=0.0) for wl in wavelengths ] light = light_list[0] #period must be consistent throughout simulation!!! period = 500 NW_diameter = 120 num_BMs = 40 NW_array = objects.NanoStruct('2D_array', period, NW_diameter, height_nm=2330, inclusion_a=materials.InP, background=materials.Air, loss=True, make_mesh_now=True, force_mesh=True, lc_bkg=0.07, lc2=1.5, lc3=2.0) superstrate = objects.ThinFilm(period=period, height_nm='semi_inf', material=materials.Air, loss=False) substrate = objects.ThinFilm(period=period, height_nm='semi_inf', material=materials.SiO2, loss=False) ################ Evaluate each layer individually ############## sim_superstrate = superstrate.calc_modes(light) sim_NW_array = NW_array.calc_modes(light, num_BMs=num_BMs) sim_substrate = substrate.calc_modes(light) stack = Stack((sim_substrate, sim_NW_array, sim_superstrate)) stack.calc_scat(pol='TE') module.stack_list = [stack] plotting.t_r_a_write_files(stack_list, wavelengths)
def simulate_stack(light): ################ Evaluate each layer individually ############## sim_cover = cover.calc_modes(light) sim_NWs = NWs.calc_modes(light) # Loop over substrates stack_list = [] for s in sub_ns: sub = objects.ThinFilm(period=period, height_nm='semi_inf', material=materials.Material(s + 0.0j), loss=False) sim_sub = sub.calc_modes(light) # Loop over heights to wash out sharp FP resonances average_t = 0 average_r = 0 average_a = 0 num_h = 21 for h in np.linspace(2180, 2480, num_h): stackSub = Stack((sim_sub, sim_NWs, sim_cover), heights_nm=([h])) stackSub.calc_scat(pol='TE') average_t += stackSub.t_list[-1] / num_h average_r += stackSub.r_list[-1] / num_h average_a += stackSub.a_list[-1] / num_h stackSub.t_list[-1] = average_t stackSub.r_list[-1] = average_r stackSub.a_list[-1] = average_a stack_list.append(stackSub) return stack_list
def setup_module(module): ################ Light parameters ##################### wl_1 = 1.11 * 940 wl_2 = 1.15 * 940 no_wl_1 = 1 # Set up light objects wavelengths = np.linspace(wl_1, wl_2, no_wl_1) light_list = [ objects.Light(wl, max_order_PWs=4, theta=5.0, phi=0.0) for wl in wavelengths ] light = light_list[0] #period must be consistent throughout simulation!!! period = 940 diameter = 266 NHs = objects.NanoStruct('2D_array', period, diameter, height_nm=200, inclusion_a=materials.Air, background=materials.Au, loss=True, square=True, make_mesh_now=False, mesh_file='940_266_sq.mail') superstrate = objects.ThinFilm(period=period, height_nm='semi_inf', material=materials.Air, loss=False) substrate = objects.ThinFilm(period=period, height_nm='semi_inf', material=materials.Air, loss=False) num_BM = 100 ################ Evaluate each layer individually ############## sim_NHs = NHs.calc_modes(light, num_BM=num_BM) sim_superstrate = superstrate.calc_modes(light) sim_substrate = substrate.calc_modes(light) stack = Stack((sim_substrate, sim_NHs, sim_superstrate)) stack.calc_scat(pol='TM') module.stack_list = [stack]
def simulate_stack(Re): ################ Evaluate each layer individually ############## sim_superstrate = superstrate.calc_modes(light) sim_substrate = substrate.calc_modes(light) # Re_stack = [] # for Re in Re_n: Im_stack = [] for Im in Im_n: TF_1 = objects.ThinFilm(period, height_nm=10, material=materials.Material(Re + Im * 1j)) sim_TF_1 = TF_1.calc_modes(light) stack = Stack((sim_substrate, sim_TF_1, sim_superstrate)) stack.calc_scat(pol='TM') Im_stack.append(stack) # Re_stack.append(Im_stack) return Im_stack
# Remove results of previous simulations plotting.clear_previous() ################ Light parameters ##################### azi_angles = np.linspace(-89, 89, 91) wl = 1600 light_list = [objects.Light(wl, max_order_PWs = 10, theta = p, phi = 0.0) \ for p in azi_angles] ################ Grating parameters ##################### # The period must be consistent throughout a simulation! period = 700 superstrate = objects.ThinFilm(period, height_nm='semi_inf', material=materials.Air, loss=False, world_1d=True) substrate = objects.ThinFilm(period, height_nm='semi_inf', material=materials.Air, loss=False, world_1d=True) absorber = objects.ThinFilm(period, height_nm=10, material=materials.Material(1.0 + 0.05j), loss=True, world_1d=True)
light_list = [ objects.Light(wl, max_order_PWs=1, theta=0.0, phi=0.0) for wl in wavelengths ] ################ Scattering matrices (for distinct layers) ############## """ Calculate scattering matrices for each distinct layer. Calculated in the order listed below, however this does not influence final structure which is defined later """ # period must be consistent throughout simulation!!! period = 1 superstrate = objects.ThinFilm(period=period, height_nm='semi_inf', material=materials.Material(3.5 + 0.0j), loss=False) homo_film1 = objects.ThinFilm(period=period, height_nm=50, material=materials.Material(3.6 + 0.27j), loss=True) homo_film2 = objects.ThinFilm(period=period, height_nm=200, material=materials.Si_c, loss=True) mirror = objects.ThinFilm(period=period, height_nm=100, material=materials.Ag,
plotting.clear_previous() ################ Simulation parameters ################ # Select the number of CPUs to use in simulation. num_cores = 8 ################ Light parameters ##################### wl = 700 light = objects.Light(wl, max_order_PWs=0, theta=0.0, phi=0.0) # The period must be consistent throughout a simulation! period = 660 # Define each layer of the structure. superstrate = objects.ThinFilm(period, height_nm='semi_inf', material=materials.Air, world_1d=True) substrate = objects.ThinFilm(period, height_nm='semi_inf', material=materials.Air, loss=False, world_1d=True) n_min = 1 n_max = 10 num_n_re = 51 num_n_im = num_n_re Re_n = np.linspace(n_min, n_max, num_n_re) Im_n = np.linspace(n_max, n_min, num_n_im) # Having lists run this way will ease plotting, as matshow plots from top left
# Number of CPUs to use in simulation num_cores = 7 # Remove results of previous simulations plotting.clear_previous() ################ Light parameters ##################### wl = 615 light_list = [objects.Light(wl, max_order_PWs=10, theta=0.0, phi=0.0)] # Period must be consistent throughout simulation!!! period = 600 superstrate = objects.ThinFilm(period, height_nm='semi_inf', world_1d=True, material=materials.Air, loss=False) substrate = objects.ThinFilm(period, height_nm='semi_inf', world_1d=True, material=materials.Air, loss=False) spacer = objects.ThinFilm(period, height_nm=200, world_1d=True, material=materials.SiO2_a, loss=True)
period = 600 NW_diameter = 120 num_BM = 40 NW_array = objects.NanoStruct('2D_array', period, NW_diameter, height_nm=2330, inclusion_a=materials.Si_c, background=materials.Air, loss=True, make_mesh_now=False, mesh_file='600_120.mail') superstrate = objects.ThinFilm(period=period, height_nm='semi_inf', material=materials.Air, loss=False) substrate = objects.ThinFilm(period=period, height_nm='semi_inf', material=materials.SiO2_a, loss=False) stack_list = [] def simulate_stack(light): ################ Evaluate each layer individually ############## sim_superstrate = superstrate.calc_modes(light) sim_NW_array = NW_array.calc_modes(light, num_BM=num_BM)
num_cores = 2 ################ Light parameters ##################### wl_1 = 400 wl_2 = 800 no_wl_1 = 4 wavelengths = np.linspace(wl_1, wl_2, no_wl_1) light_list = [objects.Light(wl, max_order_PWs = 1, theta = 0.0, phi = 0.0) \ for wl in wavelengths] # The period must be consistent throughout a simulation! period = 300 # Define each layer of the structure. superstrate = objects.ThinFilm(period, height_nm='semi_inf', material=materials.Air) # Define a thin film with (finite) thickness in nm and constant refractive index TF_1 = objects.ThinFilm(period, height_nm=100, material=materials.Material(1.0 + 0.05j)) # EMUstack calculation time is independent dispersion and thickness of layer! # This layer is made of Indium Phosphide, the tabulated refractive index of which # is stored in EMUstack/data/ # We artificially set the imaginary part of the layer to zero for all wavelengths. TF_2 = objects.ThinFilm(period, height_nm=5e6, material=materials.InP, loss=False) # By default loss = True TF_3 = objects.ThinFilm(period, height_nm=52, material=materials.Si_a)
# Set up light objects, starting with the wavelengths, wavelengths = np.linspace(wl_1, wl_2, no_wl_1) # and also specifying angles of incidence and refractive medium of semi-infinite # layer that the light is incident upon (default value is n_inc = 1.0). # Fields in homogeneous layers are expressed in a Fourier series of diffraction # orders,where all orders within a radius of max_order_PWs in k-space are included. light_list = [objects.Light(wl, max_order_PWs = 1, theta = 0.0, phi = 0.0, \ n_inc=1.5) for wl in wavelengths] # Our structure must have a period, even if this is artificially imposed # on a homogeneous thin film. What's more, # it is critical that the period be consistent throughout a simulation! period = 300 # Define each layer of the structure. superstrate = objects.ThinFilm(period, height_nm = 'semi_inf', material = materials.Material(1.5 + 0.0j)) substrate = objects.ThinFilm(period, height_nm = 'semi_inf', material = materials.Material(3.0 + 0.0j)) def simulate_stack(light): ################ Evaluate each layer individually ############## sim_superstrate = superstrate.calc_modes(light) sim_substrate = substrate.calc_modes(light) ###################### Evaluate structure ###################### """ Now define full structure. Here order is critical and stack list MUST be ordered from bottom to top! """ stack = Stack((sim_substrate, sim_superstrate)) # Calculate scattering matrices of the stack (for all polarisations). stack.calc_scat(pol = 'TE') # Incident light has TE polarisation,
n_kxs = 40 freq_list = np.linspace(max_freq, min_freq, n_freqs) wl_list = (c_speed / freq_list) kx_list = np.linspace(min_kx, max_kx, n_kxs) light_list = [] for kx in kx_list: for wl in wl_list: light_list.append((wl, kx)) # period must be consistent throughout simulation!!! period = 0.012e9 n = 1 L = 0.4e9 strate = objects.ThinFilm(period, height_nm='semi_inf', material=materials.Air, loss=False) NW_rads = 0.0015e9 dummy_diameter = 1 NW_diameter = NW_rads * 2 NW_array = objects.NanoStruct('2D_array', period, NW_diameter, height_nm=wl_0 / (2 * n), inclusion_a=materials.Material(0.0 + 1e6j), background=materials.Material(n), loss=True, hyperbolic=True, make_mesh_now=True, force_mesh=True,
def setup_module(module): # Remove results of previous simulations plotting.clear_previous('.log') plotting.clear_previous('.pdf') plotting.clear_previous('.txt') ################ Light parameters ##################### wavelengths = np.linspace(800, 1600, 1) light_list = [ objects.Light(wl, max_order_PWs=6, theta=0.0, phi=0.0) for wl in wavelengths ] light = light_list[0] period = 760 superstrate = objects.ThinFilm(period, height_nm='semi_inf', world_1d=True, material=materials.Air, loss=False) substrate = objects.ThinFilm(period, height_nm='semi_inf', world_1d=True, material=materials.Air, loss=False) grating_1 = objects.NanoStruct('1D_array', period, diameter1=int(round(0.25 * period)), diameter2=int(round(0.25 * period)), height_nm=150, inclusion_a=materials.Material(1.46 + 0.0j), inclusion_b=materials.Material(1.46 + 0.0j), background=materials.Material(3.61 + 0.0j), loss=True, lc_bkg=0.005) grating_2 = objects.NanoStruct('1D_array', period, int(round(0.25 * period)), height_nm=900, background=materials.Material(3.61 + 0.0j), inclusion_a=materials.Material(1.46 + 0.0j), loss=True, lc_bkg=0.005) ################ Evaluate each layer individually ############## sim_superstrate = superstrate.calc_modes(light) sim_substrate = substrate.calc_modes(light) sim_grating_1 = grating_1.calc_modes(light) sim_grating_2 = grating_2.calc_modes(light) ################ Evaluate full solar cell structure ############## """ Now when defining full structure order is critical and stack list MUST be ordered from bottom to top! """ stack = Stack( (sim_substrate, sim_grating_1, sim_grating_2, sim_superstrate)) stack.calc_scat(pol='TE') module.stack_list = [stack] plotting.t_r_a_plots(stack_list, save_txt=True)
wl_2 = 1127 no_wl_1 = 3 # Set up light objects wavelengths = np.linspace(wl_1, wl_2, no_wl_1) light_list = [objects.Light(wl, max_order_PWs = 3) for wl in wavelengths] # Single wavelength run # wl_super = 450 # wavelengths = np.array([wl_super]) # light_list = [objects.Light(wl) for wl in wavelengths] # period must be consistent throughout simulation!!! period = 600 max_num_BMs = 200 superstrate = objects.ThinFilm(period, height_nm = 'semi_inf', material = materials.Air, loss = True) substrate = objects.ThinFilm(period, height_nm = 'semi_inf', material = materials.Si_c, loss = False) ThinFilm2 = objects.ThinFilm(period, height_nm = 100, material = materials.SiO2_a, loss = True) ThinFilm4 = objects.ThinFilm(period, height_nm = 200, material = materials.Si_c, loss = True) NW_diameter = 120 NWs = objects.NanoStruct('2D_array', period, NW_diameter, height_nm = 2330, inclusion_a = materials.Si_c, background = materials.Air, loss = True, make_mesh_now = True, force_mesh = True, lc_bkg = 0.2, lc2= 1.0)
num_cores = 2 ################ Light parameters ##################### wl_1 = 400 wl_2 = 800 no_wl_1 = 4 wavelengths = np.linspace(wl_1, wl_2, no_wl_1) light_list = [objects.Light(wl, max_order_PWs = 1, theta = 0.0, phi = 0.0)\ for wl in wavelengths] # The period must be consistent throughout a simulation! period = 300 # Define each layer of the structure, as in last example. superstrate = objects.ThinFilm(period, height_nm='semi_inf', material=materials.Air) TF_2 = objects.ThinFilm(period, height_nm=5e6, material=materials.InP, loss=False) TF_3 = objects.ThinFilm(period, height_nm=52, material=materials.Si_a) # Realistically a few micron thick mirror would do the trick, # but EMUstack is height agnostic.... so what the hell. mirror = objects.ThinFilm(period, height_nm=1e5, material=materials.Ag) substrate = objects.ThinFilm(period, height_nm='semi_inf', material=materials.Air) def simulate_stack(light):
################ Light parameters ##################### wl_1 = 400 wl_2 = 800 no_wl_1 = 4 # Set up light objects (no need to specifiy n_inc as light incident from # Air with n_inc = 1.0). wavelengths = np.linspace(wl_1, wl_2, no_wl_1) light_list = [objects.Light(wl, max_order_PWs = 1, theta = 0.0, phi = 0.0) \ for wl in wavelengths] # The period must be consistent throughout a simulation! period = 300 # Define each layer of the structure, now with dispersive media. # The refractive indices are interpolated from tabulated data. superstrate = objects.ThinFilm(period, height_nm = 'semi_inf', material = materials.Air) substrate = objects.ThinFilm(period, height_nm = 'semi_inf', material = materials.SiO2_a) # Amorphous silica def simulate_stack(light): ################ Evaluate each layer individually ############## sim_superstrate = superstrate.calc_modes(light) sim_substrate = substrate.calc_modes(light) ###################### Evaluate structure ###################### """ Now define full structure. Here order is critical and stack list MUST be ordered from bottom to top! """ stack = Stack((sim_substrate, sim_superstrate)) stack.calc_scat(pol = 'TM') # This time TM polarised light is incident.
wavelengths = np.linspace(wl_1, wl_2, no_wl_1) light_list = [ objects.Light(wl, max_order_PWs=5, theta=0.0, phi=0.0) for wl in wavelengths ] # The period must be consistent throughout a simulation! period = 300 # Define each layer of the structure # We need to inform EMUstack at this point that all layers in the stack will # be at most be periodic in one dimension (i.e. there are no '2D_arrays's). # This is done with the Keyword Arg 'world_1d' and all homogenous layers are # calculated using the PW basis of 1D diffraction orders. superstrate = objects.ThinFilm(period, height_nm='semi_inf', world_1d=True, material=materials.Air) substrate = objects.ThinFilm(period, height_nm='semi_inf', world_1d=True, material=materials.Air) # Define 1D grating that is periodic in x. # The mesh for this is always made 'live' in objects.py the number of # FEM elements used is given by 1/lc_bkg. # See Fortran Backends section of tutorial for more details. grating = objects.NanoStruct('1D_array', period, int(round(0.75 * period)), height_nm=2900, background=materials.Material(1.46 + 0.0j),
plotting.clear_previous() ################ Light parameters ##################### wl_1 = 310 wl_2 = 1127 no_wl_1 = 3 # Set up light objects wavelengths = np.linspace(wl_1, wl_2, no_wl_1) light_list = [objects.Light(wl, max_order_PWs = 2, theta = 0.0, phi = 0.0) \ for wl in wavelengths] # Period must be consistent throughout simulation!!! period = 550 cover = objects.ThinFilm(period=period, height_nm='semi_inf', material=materials.Air, loss=True) sub_ns = np.linspace(1.0, 4.0, 100) NW_diameter = 480 NWs = objects.NanoStruct('1D_array', period, NW_diameter, height_nm=2330, inclusion_a=materials.Si_c, background=materials.Air, loss=True, make_mesh_now=True, force_mesh=True, lc_bkg=0.17,