some question about the grating coupler on your website

dear all
recently I have learnt the grating coupler on your website.

In the 2D simulation,I find that you set two parameter in the sweep source position.
I dont know why you set the second parameter because you set the value to be always zero.can you explain why you set the parameter.
In the 3D simulation,I find the fiber go through the grating coupler.Is it right ?because in reality,although the fiber is close to the grating coupler ,there still be a distance between(such as the 2D simulation)? So can you help me solve the question.
Hope to get your feedback.Thanks a lot.

Dear @jbwei

Thank you for reaching out.

Before I answer the question, let’s see where we used fiber analysis. If you chosee model from object tree and click on the edit button under Analysis-> variables you will see two Parameters: output and fiber analysis and on the Results section we have S, T, and T-avg and under Analysis->Script we have this script:

T = getresult("waveguide","expansion for T");
Tfund = -T.getattribute("T_backward");
lambda = T.lambda;
?T_avg = integrate(Tfund,1,lambda)/integrate(matrix(length(lambda))+1,1,lambda);

if(!%fiber analysis%) {

if(havedata("fiber::top")) { # fiber turned on
  fiber = getresult("fiber::fiber modes","expansion for top");

S = matrixdataset;

if(output) { 
  S22 = T.b/T.a;
  S12 = fiber.a*sqrt(fiber.N)/(T.a*sqrt(T.N));
} else {
  S11 = fiber.a/fiber.b;
  S21 = (T.b*sqrt(T.N))/(fiber.b*sqrt(fiber.N));

In the script, you can see how we defined T, T-avg and S as well as two parameters (fiber analysis and output). When you set fiber analysis to 0, the calculations will stop at line 8, and it won’t calculate the S parameters. For the sweeping purposes, since we are only interested to get the T-avg data not the S parameters, we ask the simulation to set this parameter to zero every time to speed up the sweep. Set this value to 0 and run the simulation, if you try to calculate S by clicking on the model-> Result View window, it will return a message box of “Failed to calculate results!”. However, it will give you the results if it is set to 1. I hope this clarifies the purpose of having the parameter.

The output is used in parameter-extraction-2D.lsf script file since we are dealing with two cases fiber in or waveguide in and bases on output value (1 or 0), it will calculate the S parameter differently.

Regarding your second question, every material has a mesh order which defines the ordering of devices in your geometry. You can read more about it here. If you want to see which geometries you are simulating, you can use a Refractive Index monitor which will give you a colour plot bases on the material refractive index. So, to summarize, even if it looks like it is crossing the geometry, in simulation it is ignored because of high mesh order.

Best of luck using Lumerical!

1 Like

dear bkhanaliloo
I have understood what you mean.Thanks very much for your great help.:smiley:

1 Like

dear bkhanaliloo
when I have learnt the S parameter extracted from the model analysis script about the grating coupler,I am confused about the two sentences.
,as depicted below.

first question:what is the meaning of the fiber.N and T.N?
second question:why the S12 and S21 is extracted from the two formula?
Hope to get you feedback. Thanks a lot.

Dear @jbwei

The script uses expansion for T in the first line that returns N. N is the power at mode m and here are used for normalizng the power. Please refer to this link for more information about Mode Expansion Monitors.

In this case we are dealing with two cases: 1st when we inject the light from fiber (or lens) and second when the light is injected from the waveguide. Thus, the definition for reflected and transmitted light changes based on how you inject the light into system. I guess the webinar will be a good place to learn more about these two cases. Also, I found out there was a similar link regarding grating coupler that might be useful to view.

Also, please note that in the recent release of software, we have introduced port to calculate S-parameters. You can read more about this here.

I hope this could answer your question.