def bragg_lumapi(args): num_periods = args.num_periods # Number of Periods for Bragg Grating length = args.length # Length of each segment of BG, Period = Length * 2 num_wavelengths = args.num_wavelengths # Number of wavelengths to sweep wl_lower = args.wl_lower # Lower wavelength bound wl_upper = args.wl_upper # Upper wavelength bound num_modes = args.num_modes # Number of Modes mesh = args.mesh # Number of mesh points width1 = args.width1 # Width of first core block width2 = args.width2 # Width of second core block thickness = args.thickness # Thicnkess of the core modesolver = MSLumerical # Which modesolver to use t = [ ] # Array that holds the transmission coefficients for different wavelengths eme = LumEME(num_periods=num_periods) for wavelength in np.linspace(wl_lower, wl_upper, num_wavelengths): eme.reset() mode_solver1 = modesolver( wavelength * 1e-6, width1 * 1e-6, thickness * 1e-6, mesh=mesh, num_modes=num_modes, mode=eme.mode, eme_modes=True, ) # First half of bragg grating mode_solver2 = modesolver( wavelength * 1e-6, width2 * 1e-6, thickness * 1e-6, mesh=mesh, num_modes=num_modes, mode=eme.mode, eme_modes=True, ) # Second half of bragg grating eme.add_layer( Layer(mode_solver1, num_modes, wavelength * 1e-6, length * 1e-6)) # First half of bragg grating eme.add_layer( Layer(mode_solver2, num_modes, wavelength * 1e-6, length * 1e-6)) # Second half of bragg grating eme.propagate() # propagate at given wavelength t.append(np.abs((eme.s_parameters() ))[0, 0, num_modes]**2) # Grab the transmission coefficient return t
def taper_lumerical(print_s=True, start=0, finish=10): # This dictionary stores the information used by the benchmark scripts taper_lumerical_dict = {"density": [], "time": [], "s_params": []} # Cross sectional parameters (computational complexity determined here) ModeSolver = MSLumerical # Choose a modesolver object that will calculate the 2D field profile mesh = 128 # Mesh density of 2D field profiles num_modes = 1 # Geometric parameters width1 = 0.8e-6 # Width of left waveguide thickness1 = 0.3e-6 # Thickness of left waveguide width2 = 0.25e-6 # Width of right waveguide thickness2 = 0.15e-6 # Thickness of right waveguide wavelength = 1.55e-6 # Wavelength of light (m) length = 10e-6 # Length of the waveguides # taper_density = 10 # How many divisions in the taper where eigenmodes will be calculated taper_length = 2e-6 # The length of the taper wg_length = 0.5 * (length - taper_length ) # Length of each division in the taper eme = LumEME( ) # Choose either a normal eme or a periodic eme (PeriodicEME()) for taper_density in range(start, finish): # Ensure a new eme each iteration eme.reset() # first layer is a straight waveguide mode1 = ModeSolver(wl=wavelength, width=width1, thickness=thickness1, mesh=mesh, num_modes=num_modes, mode=eme.mode) straight1 = Layer(mode1, num_modes, wavelength, wg_length) eme.add_layer(straight1) # create the discrete taper with a fine enough taper density to approximate a continuous linear taper widths = np.linspace(width1, width2, taper_density) thicknesses = np.linspace(thickness1, thickness2, taper_density) taper_length_per = taper_length / taper_density if taper_density else None # add the taper layers for i in range(taper_density): solver = ModeSolver(wl=wavelength, width=widths[i], thickness=thicknesses[i], mesh=mesh, num_modes=num_modes, mode=eme.mode) taper_layer = Layer(solver, num_modes, wavelength, taper_length_per) eme.add_layer(taper_layer) # last layer is a straight waveguide of smaller geometry mode2 = ModeSolver(wl=wavelength, width=width2, thickness=thickness2, mesh=mesh, num_modes=num_modes, mode=eme.mode) straight2 = Layer(mode2, num_modes, wavelength, wg_length) eme.add_layer(straight2) # eme.draw() # Look at our simulation geometry t1 = time.time() eme.propagate() # Run the eme t2 = time.time() taper_lumerical_dict["time"].append(t2 - t1) taper_lumerical_dict["density"].append(taper_density) taper_lumerical_dict["s_params"].append(eme.s_parameters()) if print_s: print(taper_density, ": ", np.abs(eme.s_parameters())) # Extract s_parameters return taper_lumerical_dict
wavelength, mode=eme.mode, thickness=thickness, core_index=core_index, cladding_index=cladding_index, cladding_width=8e-6, cladding_thickness=8e-6, num_modes=num_modes_input, mesh=mesh, x=x, y=x, polygons=polygons[:], PML=PML, ) eme.add_layer(Layer(input_channel, num_modes_input, wavelength, input_length)) # Create taper into MMI for i in range(input_taper_num_steps): polygons = [] for out in range(num_inputs): starting_center = -0.5 * (num_inputs - 1) * (input_gap + input_width) n_input = np.ones(mesh) * cladding_index center = starting_center + out * (input_gap + input_width) width = input_width + (input_taper_width - input_width) * (i / input_taper_num_steps) left_edge = center - 0.5 * width right_edge = center + 0.5 * width n_input = np.where((left_edge <= x) * (x <= right_edge), core_index, n_input)
mesh = 128 # Number of mesh points in each xy dimension eme = LumEME() # Choose either a normal eme or a periodic eme (PeriodicEME()) # first layer is a straight waveguide mode1 = MSLumerical1D( wavelength, width1, thickness1, num_modes=3, cladding_width=10e-6, cladding_thickness=10e-6, mesh=mesh, mode=eme.mode, ) straight1 = Layer(mode1, 3, wavelength, length) eme.add_layer(straight1) # create the discrete taper with a fine enough taper density to approximate a continuous linear taper widths = taper_func(width1, width2, taper_density) thicknesses = np.linspace(thickness1, thickness2, taper_density) taper_length_per = taper_length / taper_density # add the taper layers for i in range(taper_density): num_modes = num_modes_first_half if i < taper_density / 2.0 else num_modes_second_half solver = MSLumerical1D( wavelength, widths[i], thicknesses[i], num_modes=num_modes,
0.22e-6, mesh=mesh, num_modes=num_modes, lumapi_location="/Applications/Lumerical v202.app/Contents/API/Python", ) # First half of bragg grating mode_solver2 = modesolver( wavelength * 1e-6, 0.54e-6, 0.22e-6, mesh=mesh, num_modes=num_modes, lumapi_location="/Applications/Lumerical v202.app/Contents/API/Python", ) # Second half of bragg grating layer1 = Layer(mode_solver1, num_modes, wavelength * 1e-6, length * 1e-6) # First half of bragg grating layer2 = Layer(mode_solver2, num_modes, wavelength * 1e-6, length * 1e-6) # Second half of bragg grating eme = PeriodicEME( [layer1, layer2], num_periods ) # Periodic EME will save computational time for repeated geometry # eme.draw() # Draw the structure eme.propagate() # propagate at given wavelength t.append(np.abs((eme.s_parameters() )[0, 0, num_modes])**2) # Grab the transmission coefficient