|
| 1 | + |
| 2 | +import siepic_contradc |
| 3 | +from siepic_contradc.ContraDC import ContraDC |
| 4 | +from siepic_contradc.modules import * |
| 5 | + |
| 6 | + |
| 7 | +def examples(num): |
| 8 | + """ Function implements 4 use-case examples """ |
| 9 | + |
| 10 | + """ Example 1: regular SOI Contra-DC """ |
| 11 | + if num ==1: |
| 12 | + |
| 13 | + # instantiate, simulate and show result |
| 14 | + device = ContraDC().simulate().displayResults() |
| 15 | + |
| 16 | + # calculate thimpe group delay |
| 17 | + device.getGroupDelay() |
| 18 | + |
| 19 | + # plot group delay |
| 20 | + plt.figure() |
| 21 | + plt.plot(device.wavelength*1e9, device.group_delay*1e12) |
| 22 | + plt.xlabel("Wavelength (nm)") |
| 23 | + plt.ylabel("Tg (ps)") |
| 24 | + |
| 25 | + plt.show() |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + """ Example 2: Full chirped example. |
| 30 | + Create a CDC with chirped w1, w2, period, temperature. |
| 31 | + """ |
| 32 | + if num == 2: |
| 33 | + |
| 34 | + # Waveguide chirp |
| 35 | + w1 = [.56e-6, .56e-6] |
| 36 | + w2 = [.44e-6, .44e-6] |
| 37 | + w_chirp_step = .1e-9 |
| 38 | + |
| 39 | + # Period chirp |
| 40 | + period = [310e-9, 320e-9] |
| 41 | + |
| 42 | + |
| 43 | + # apod shape |
| 44 | + apod_shape = "gaussian" |
| 45 | + |
| 46 | + N = 10000 |
| 47 | + |
| 48 | + device = ContraDC(N=N, w1=w1, w2=w2, apod_shape=apod_shape, period_chirp_step=1e-9, |
| 49 | + w_chirp_step=w_chirp_step, period=period, N_seg=1500, |
| 50 | + kappa = 10000, a=0, alpha=1.5, wvl_range=[1500e-9,1600e-9]) |
| 51 | + |
| 52 | + device.simulate().displayResults() |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + """ Example 3: defining custom chirp profiles |
| 57 | + """ |
| 58 | + if num == 3: |
| 59 | + |
| 60 | + device = ContraDC(apod_shape="tanh") |
| 61 | + |
| 62 | + z = np.linspace(0, device.N_seg, device.N_seg) |
| 63 | + device.w1_profile = device.w1*np.cos(z/600) |
| 64 | + device.w2_profile = device.w2*np.cos(z/600) |
| 65 | + |
| 66 | + device.simulate().displayResults() |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + """ Example 4: using custom supermode indices. |
| 71 | + You might want to use this if you are designing |
| 72 | + with silicon nitride, of using other waveguide specs than |
| 73 | + SOI, 100-nm gap. |
| 74 | + """ |
| 75 | + if num == 4: |
| 76 | + |
| 77 | + import os |
| 78 | + current_dir = os.path.dirname(__file__) |
| 79 | + polyfit_file_path = os.path.join(current_dir, "SiN_1550_TE_w1_850nm_w2_1150nm_thickness_400nm.txt") |
| 80 | + device = ContraDC(polyfit_file=polyfit_file_path, period=335e-9) |
| 81 | + device.simulate().displayResults() |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + """Example 5: Lumerical-assisted flow |
| 86 | + """ |
| 87 | + if num == 5: |
| 88 | + |
| 89 | + apod_shape = "tanh" |
| 90 | + period = 318e-9 |
| 91 | + w1 = 560e-9 |
| 92 | + w2 = 440e-9 |
| 93 | + |
| 94 | + device = ContraDC(w1= w1, w2=w2, apod_shape=apod_shape, period=period) |
| 95 | + |
| 96 | + device.simulate() |
| 97 | + plt.plot(device.wavelength*1e9, device.drop) |
| 98 | + plt.plot(device.wavelength*1e9, device.thru) |
| 99 | + plt.show() |
| 100 | + |
| 101 | + # Generate compact model for Lumerical INTERCONNECT |
| 102 | + device.gen_sparams() # this will create a ContraDC_sparams.dat file to import into INTC |
| 103 | + |
| 104 | + """Example 6: Complete Lumerical flow - simulate coupling coefficient (not simulating mode profiles) |
| 105 | + """ |
| 106 | + if num == 6: |
| 107 | + |
| 108 | + apod_shape = "tanh" |
| 109 | + period = 318e-9 |
| 110 | + w1 = 560e-9 |
| 111 | + dw1 = 25e-9 |
| 112 | + w2 = 440e-9 |
| 113 | + dw2 = 50e-9 |
| 114 | + gap = 100e-9 |
| 115 | + |
| 116 | + device = ContraDC(w1= w1, dw1=dw1, w2=w2, dw2=dw2, gap=gap, apod_shape=apod_shape, period=period) |
| 117 | + |
| 118 | + device.simulate_kappa() |
| 119 | + device.simulate().displayResults() |
| 120 | + plt.plot(device.wavelength*1e9, device.drop) |
| 121 | + plt.plot(device.wavelength*1e9, device.thru) |
| 122 | + plt.show() |
| 123 | + |
| 124 | + # Generate compact model for Lumerical INTERCONNECT |
| 125 | + device.gen_sparams() # this will create a ContraDC_sparams.dat file to import into INTC |
| 126 | + |
| 127 | + |
| 128 | +if __name__ == "__main__": |
| 129 | + examples(3) |
| 130 | + |
| 131 | + |
| 132 | + |
0 commit comments