Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treating quasi-TE mode in overlap with the mode of an optical fiber #114

Closed
KojaAMA opened this issue Dec 24, 2023 · 1 comment
Closed

Comments

@KojaAMA
Copy link

KojaAMA commented Dec 24, 2023

Hi everyone,

I was trying to get the overlap integral for both quasi-TE/TM modes as provided by the example but I am not sure if I did something wrong. Here is the result I got for the same example.
image

from collections import OrderedDict

import matplotlib.pyplot as plt
import numpy as np
from shapely import box
from skfem import Basis, ElementTriP0, ElementTriP1
from skfem.io import from_meshio
from tqdm import tqdm

from femwell.fiber import e_field_gaussian, overlap
from femwell.maxwell.waveguide import compute_modes
from femwell.mesh import mesh_from_OrderedDict




wl=1.55
core_w,core_h=0.2,0.3
clad_w,clad_h=15,15
num_modes=2

core = box(-core_w/2, -core_h/2, core_w/2, core_h/2)
polygons = OrderedDict(core=core, clad=core.buffer(clad_w, resolution=12))

resolutions = dict(core={"resolution": 0.02, "distance": 0.5})
mesh = from_meshio(mesh_from_OrderedDict(polygons, resolutions, default_resolution_max=5))
mesh.draw().show()

basis0 = Basis(mesh, ElementTriP0(), intorder=4)
epsilon = basis0.zeros().astype(complex)
epsilon[basis0.get_dofs(elements="core")] = 1.9963**2
epsilon[basis0.get_dofs(elements="clad")] = 1.444**2
basis0.plot(np.real(epsilon)**0.5, colorbar=True).show()

modes = compute_modes(basis0, epsilon, wavelength=wl, mu_r=1, num_modes=num_modes)

mfds = np.linspace(2, 20, 2**5)
TE_eff=np.zeros_like(mfds)
TM_eff=np.zeros_like(mfds)


#sort the modes as TE&TM
for i,mode in enumerate(modes):
    if mode.te_fraction >= 0.7:
        TE_mode=mode
        print(f"TE mode: {mode.te_fraction*100}%")
        modes[i].plot_intensity()
        plt.title("TE")
        plt.show()
        fig, axs = modes[i].plot(modes[i].E.real, direction="x")
            
    elif mode.te_fraction <= 0.3:
        
        TM_mode=mode
        print(f"TM mode: {100-mode.te_fraction*100}%")
        modes[i].plot_intensity()
        plt.title("TM")
        plt.show()
        fig, axs = modes[i].plot(modes[i].E.real, direction="x")
    else:
        print("Neither quasi-TE/TM modes")
        
for j,mfd in enumerate(tqdm(mfds)):
    basis_fiber = basis0.with_element(ElementTriP1())
    x_fiber = basis_fiber.project(
        lambda x: e_field_gaussian(np.sqrt(x[0] ** 2 + x[1] ** 2), 0, mfd / 2, 1, wavelength=wl),
        dtype=complex,
    )

    TE_eff[j] = overlap(
        basis_fiber, TE_mode.basis.interpolate(TE_mode.E)[0][0], basis_fiber.interpolate(x_fiber)
    )
    TM_eff[j] = overlap(
        basis_fiber, TM_mode.basis.interpolate(TM_mode.E)[0][1], basis_fiber.interpolate(x_fiber)
    )

plt.figure()
plt.plot(mfds, TE_eff,label="TE")
plt.plot(mfds, TM_eff,label="TM")
plt.xlabel("Mode field diameter / um")
plt.ylabel("Coupling efficiency")
plt.legend()
plt.tight_layout()
plt.show()
@HelgeGehring
Copy link
Owner

On the first glance it makes sense to me what you're doing.
But we should first benchmark this example to some literature and reproduce their results to make sure we didn't miss something in the implementation. (I'm wondering right now if we need to square the overlap)
https://doi.org/10.1109/JPHOT.2016.2600037 would probably be a good paper for comparison.

The assumption that the field is only in E_x/y is also something to double check, but according to https://apps.dtic.mil/sti/pdfs/AD1124366.pdf it should be fine. Whatever, eventually we should also consider having some distance between the edge coupler and the fiber (as in reality we will for sure have some gap there), so we'd need to add z in the equation for the Gaussian and I'd guess we'd need to calculate for that full-vectorial.

@KojaAMA KojaAMA closed this as completed Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants