(args)
| 28 | |
| 29 | |
| 30 | def main(args): |
| 31 | cell_zmax = 0.5 * cell_thickness if args.three_d else 0 |
| 32 | cell_zmin = -0.5 * cell_thickness if args.three_d else 0 |
| 33 | si_zmax = 0.5 * t_Si if args.three_d else 10 |
| 34 | si_zmin = -0.5 * t_Si if args.three_d else -10 |
| 35 | |
| 36 | # read cell size, volumes for source region and flux monitors, |
| 37 | # and coupler geometry from GDSII file |
| 38 | upper_branch = mp.get_GDSII_prisms( |
| 39 | silicon, gdsII_file, UPPER_BRANCH_LAYER, si_zmin, si_zmax |
| 40 | ) |
| 41 | lower_branch = mp.get_GDSII_prisms( |
| 42 | silicon, gdsII_file, LOWER_BRANCH_LAYER, si_zmin, si_zmax |
| 43 | ) |
| 44 | |
| 45 | cell = mp.GDSII_vol(gdsII_file, CELL_LAYER, cell_zmin, cell_zmax) |
| 46 | p1 = mp.GDSII_vol(gdsII_file, PORT1_LAYER, si_zmin, si_zmax) |
| 47 | p2 = mp.GDSII_vol(gdsII_file, PORT2_LAYER, si_zmin, si_zmax) |
| 48 | p3 = mp.GDSII_vol(gdsII_file, PORT3_LAYER, si_zmin, si_zmax) |
| 49 | p4 = mp.GDSII_vol(gdsII_file, PORT4_LAYER, si_zmin, si_zmax) |
| 50 | src_vol = mp.GDSII_vol(gdsII_file, SOURCE_LAYER, si_zmin, si_zmax) |
| 51 | |
| 52 | # displace upper and lower branches of coupler (as well as source and flux regions) |
| 53 | if args.d != default_d: |
| 54 | delta_y = 0.5 * (args.d - default_d) |
| 55 | delta = mp.Vector3(y=delta_y) |
| 56 | p1.center += delta |
| 57 | p2.center -= delta |
| 58 | p3.center += delta |
| 59 | p4.center -= delta |
| 60 | src_vol.center += delta |
| 61 | cell.size += 2 * delta |
| 62 | for np in range(len(lower_branch)): |
| 63 | lower_branch[np].center -= delta |
| 64 | for nv in range(len(lower_branch[np].vertices)): |
| 65 | lower_branch[np].vertices[nv] -= delta |
| 66 | for np in range(len(upper_branch)): |
| 67 | upper_branch[np].center += delta |
| 68 | for nv in range(len(upper_branch[np].vertices)): |
| 69 | upper_branch[np].vertices[nv] += delta |
| 70 | |
| 71 | geometry = upper_branch + lower_branch |
| 72 | |
| 73 | if args.three_d: |
| 74 | oxide_center = mp.Vector3(z=-0.5 * t_oxide) |
| 75 | oxide_size = mp.Vector3(cell.size.x, cell.size.y, t_oxide) |
| 76 | oxide_layer = [mp.Block(material=oxide, center=oxide_center, size=oxide_size)] |
| 77 | geometry = geometry + oxide_layer |
| 78 | |
| 79 | sources = [ |
| 80 | mp.EigenModeSource( |
| 81 | src=mp.GaussianSource(fcen, fwidth=df), |
| 82 | volume=src_vol, |
| 83 | eig_parity=mp.NO_PARITY if args.three_d else mp.EVEN_Y + mp.ODD_Z, |
| 84 | ) |
| 85 | ] |
| 86 | |
| 87 | sim = mp.Simulation( |
no test coverage detected