|
| 1 | +""" |
| 2 | +1x1 Coupler -- Base Workflow |
| 3 | +============================ |
| 4 | +""" |
| 5 | + |
| 6 | +# %% |
| 7 | +# Importing the script dependencies |
| 8 | +from SuPyMode.workflow import ( |
| 9 | + Profile, |
| 10 | + GenericFiber, |
| 11 | + Boundaries, |
| 12 | + BoundaryValue, |
| 13 | + DomainAlignment, |
| 14 | + BackGround, |
| 15 | + Geometry, |
| 16 | + SuPySolver, |
| 17 | + StructureType, |
| 18 | +) |
| 19 | + |
| 20 | +wavelength = 1550e-9 |
| 21 | + |
| 22 | +clad_structure = Profile() |
| 23 | + |
| 24 | +clad_structure.add_structure( |
| 25 | + structure_type=StructureType.CIRCULAR, |
| 26 | + number_of_fibers=2, |
| 27 | + fusion_degree=0.9, |
| 28 | + fiber_radius=62.5e-6, |
| 29 | +) |
| 30 | + |
| 31 | +clad_structure.refractive_index = 1.4444 |
| 32 | + |
| 33 | +fiber_0 = GenericFiber(position=clad_structure.cores[0]) |
| 34 | + |
| 35 | +fiber_0.create_and_add_new_structure( |
| 36 | + name="core", refractive_index=1.4480, radius=4.2 * 1e-6 |
| 37 | +) |
| 38 | + |
| 39 | +fiber_1 = GenericFiber(position=clad_structure.cores[1]) |
| 40 | + |
| 41 | +fiber_1.create_and_add_new_structure( |
| 42 | + name="core", refractive_index=1.4460, radius=6.2 * 1e-6 |
| 43 | +) |
| 44 | + |
| 45 | +background = BackGround(refractive_index=1.0) |
| 46 | + |
| 47 | +geometry = Geometry( |
| 48 | + x_bounds=DomainAlignment.LEFT, |
| 49 | + y_bounds=DomainAlignment.CENTERING, |
| 50 | + resolution=80, |
| 51 | + boundary_pad_factor=1.1, |
| 52 | +) |
| 53 | + |
| 54 | +geometry.add_structure(background, clad_structure, fiber_0, fiber_1) |
| 55 | + |
| 56 | +geometry.initialize() |
| 57 | + |
| 58 | +geometry.plot() |
| 59 | + |
| 60 | +solver = SuPySolver( |
| 61 | + mesh=geometry.mesh, |
| 62 | + x=geometry.coordinate_system.x_vector, |
| 63 | + y=geometry.coordinate_system.y_vector, |
| 64 | + tolerance=1e-20, |
| 65 | + max_iteration=5000, |
| 66 | + accuracy=2, |
| 67 | + debug_mode=False, |
| 68 | + extrapolation_order=2, |
| 69 | +) |
| 70 | + |
| 71 | +solver.init_superset( |
| 72 | + wavelength=wavelength, |
| 73 | + n_step=500, |
| 74 | + itr_initial=1.0, |
| 75 | + itr_final=0.05, |
| 76 | +) |
| 77 | + |
| 78 | +boundary = Boundaries(right=BoundaryValue.SYMMETRIC) |
| 79 | + |
| 80 | +solver.add_modes( |
| 81 | + n_added_mode=3, |
| 82 | + n_sorted_mode=2, |
| 83 | + boundaries=boundary, |
| 84 | + auto_label=True, |
| 85 | +) |
| 86 | + |
| 87 | +boundary = Boundaries(right=BoundaryValue.ANTI_SYMMETRIC) |
| 88 | + |
| 89 | +solver.add_modes( |
| 90 | + n_added_mode=3, |
| 91 | + n_sorted_mode=2, |
| 92 | + boundaries=boundary, |
| 93 | + auto_label=True, |
| 94 | +) |
| 95 | + |
| 96 | +superset = solver.superset |
| 97 | + |
| 98 | +_ = superset.plot(plot_type="geometry") |
| 99 | + |
| 100 | +# %% |
| 101 | +# Field computation: :math:`E_{i,j}` |
| 102 | +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 103 | +_ = superset.plot(plot_type="field", itr_list=[1.0, 0.1]) |
| 104 | + |
| 105 | +# %% |
| 106 | +# Effective index: :math:`n^{eff}_{i,j}` |
| 107 | +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 108 | +_ = superset.plot(plot_type="index") |
| 109 | + |
| 110 | +# %% |
| 111 | +# Modal normalized coupling: :math:`C_{i,j}` |
| 112 | +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 113 | +_ = superset.plot(plot_type="normalized-coupling") |
| 114 | + |
| 115 | +# %% |
| 116 | +# Adiabatic criterion: :math:`\tilde{C}_{i,j}` |
| 117 | +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 118 | +_ = superset.plot(plot_type="adiabatic") |
| 119 | + |
| 120 | +# - |
0 commit comments