# TE TM propagator and MATLAB plotting of JPEG

Hi all

I have an inquiry regarding the evanescent waveguide coupler example: https://kb.lumerical.com/en/pic_passive_waveguide_couplers_evanescent.html

Here, one can export a JPEG of 100 repeated propagation image of E^2, intensity of E field using the script: waveguide_couplers.lsf

I am wondering how I can modify the script so that I can export TE mode propagation and TM mode propagation separately. It seems that the information is embedded in “mode1” but the current script compiles the E-intensity at default to iterate. Can I change this to Ey or Hy to iterate instead? So far, my attempt didn’t seem to make that change.

At the end, I get a JPEG image of 100-repeated propagation. I need to compare the coupling length of TE, TM mode to find the intersection point (coupling length) to make polarization-independent waveguide. Obviously, doing that over a picture isn’t as accurate as having line-curves. The output on lumerical currently only shows E_temp which is an individual component not the whole complied one. Can you recommend an example or script I can follow to take the final JPEG image to analyze on MATLAB?

I am relatively new to this, so any concrete help will be greatly appreciated.

Thank you

Dear @ymkim

If you want to select a different mode to propagate, you need to add it to dcard. For example in this case only mode1 is added to dcard:

findmodes;
cleardcard("E0");
copydcard("mode1","E0");


Then you can propagate modes and visualize them separately. This link might be of interest for you to review:

In this example, we want to see if we have a TE mode in the single waveguide, how it will behave in the presence of second waveguide. Thus, a mode in the first waveguide is selected. Then modes of coupled waveguide is calculated and first mode is decomposed into these modes to be propagated.

I didn’t understand what you meant by iterating Ey of Hy. Propagate command propagates E field which has all the field components and you need all the field components for this command. You can visualize field components after it has been propagate before the cleardcard(outmode); command. For example, ?getdata(outmode); will give you the list of available parameters that you can extract (which includes Ey and Hy). Please refer to these pages for more information:

The outmode has the accounted-transmission and accounted-reflection information that you can use to find out how much of the light in single waveguide is coupled to modes of coupled waveguide. My idea would be to use a similar approach as polarization rotator example in which you propagate TE (or TM) modes (of single waveguide) for a length of interest (coupling length) and then calculate the overlap of propagated mode with TE ™ mode of original single waveguide.

Please let me know if this helps.

Thank you very much for getting back to my inquiry.
I tried what you wrote me. I attached my MODE and script I’ve been using
thus far.
I tried to change between E0, (H0), getelectric (getmagnetic) but I am not
sure if I am getting the right result,
at least it’s not congruent with analytical calculation in a way that the
coupling length for TM is shorter than TE which should be the other way
around here.
Am I right to use H0 and getmagnetic here? I chose ‘mode 3’ as the first TM
mode in this calculation.

Thank you so much for your help

Youngmin ​
waveguide_couplers_SiN_test.lms

waveguide_couplers_SiN_H.lsf (1.78 KB)

Dear @ymkim

The simulation seems fine except that I had to select mode2 to properly choose the TM mode (the third mode is some higher order mode). Here are the two plots:

I guess these results make sense. If you calculate Δn for TE (Δn~0.0254) and TM mode (Δn=0.0289), you notice that TM has a smaller coupling length compared to TE (as you mentioned). As you can see in the plots, TM mode (right figure) couples more back and forth between waveguides than TE mode.

My question is why you think TE should have smaller coupling length compared to TE? Do you have a reference to prove your claim?

the script and parameter (mode 2 for TM) as attached, I was able to extract
the correct TE and TM mode:

Their coupling lengths correctly match with analytical solution: dn(TE)=
0.014824 => Lc=16.6um, dn™=0.01852 => Lc=13.3um.

However, then the question is, why does mode 2 represent TM mode when:

1. the eigensolver clearly indicates that TE-polarization is 99% for
mode2, and 1% for mode3.
2. I am positive that mode 1, 2 represent the even and odd modes of TE and
mode 3,4 for TM because of this:

This graph represents the neff for the same geometry but with 5 different
gap distance. You can see that at 250nm gap is the simulated result above.
Notice how the two modes (red, blue) converge to that of single-waveguide
as distance increases which should be the case in directional coupler. If I
assume mode 2 to be the first TM1 mode instead of TE2, this destroys this
analysis. Also, the analytical solution above showing oscillation is also
assuming mode 1, 2 are two even,odd TE mode, and mode 3, 4 are the two
even/odd TM mode. However, as you pointed out, using mode 2 DOES yield the
right propagation for TM.

I am trying to understand this discrepancy. Do you have any insight on how
the LUMERICAL takes the modes?

Best,

waveguide_couplers_SiN_TM.lms (335 KB)

waveguide_couplers_SiN_TM.lsf (1.78 KB)

Dear @ymkim

I am glad that our results match with what you were expecting.

I think that you need to look at the modes of the single waveguide. As I mentioned in my first comment, in these calculations we assume that light is propagated in the single waveguide and then it couples to the second waveguide (two waveguide case). So, when you select the modes to be added to d-card, you select the modes of the single waveguide. Here is the screenshot for the modes of the single waveguide (left to right: mode 1, mode 2, mode 3):

As you can see, the second mode is TM mode (with TE polarization of 1%).

I think this answers the second question 2. You are right the first and second mode (third and forth) for the two-waveguide case are the even and odd modes of TE ™, but again when we select the modes, we are selecting the modes of a single waveguide.

I hope this answered the question but please do let me know if you still have any problem.

This explains a lot and settles my inquiries thank you so much!

One minor thing, is it possible to get the final figure also as data? the
exported image doesn’t give me a whole lot of option to export to MATLAB or
work with the legends and etc.
I see the E2_temp but it’s not the same as the final image.

Thank you once again

Dear @ymkim

Im glad that confusion is resolved.

Yes, Please see this page for data export options.If you want to export them into a .mat file, you can use matlabsave command. Please note that we are visualizing (image command) E2 which takes the cross section of E2-temp at z=0. To get the same plot you need to save E2 data as well as y and L and then use image command in Matlab.

Thanks