We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.

Ansys Learning Forum Forums Discuss Simulation Photonics Lumerical help, dielectric slab waveguide Reply To: Lumerical help, dielectric slab waveguide

Amrita Pati
Ansys Employee

Hi Marton,

My response was cut off:

Thanks for sharing additional details! The script that I have uses a structure group to create 5 layers. Since I can not share the file itself, I will share screenshot and the code. First you can add a structure group to your simulation:

Then you can edit the structure group, and go to the "Properties" tab of the structure group, and add 5 parameters which will be the thickness of each layer as shown below. Please note that the "Type" and the "Unit" of the paramters are accurate. You can change the thickness of each layers depending upon your requirements, I have used alternating layers of thickess 0.1 um and 0.05 um randomly:

Then you can copy the code below and paste it in the "Script" tab of Structure Group.

deleteall;

x_span = 1e-06;
z_span = 1e-06;
d = [d1,d2,d3,d4,d5];

y = matrix(length(d),1);
y(1) = 0e-06;
addrect;
set("x span",x_span);
set("z span",z_span);
set("y",y(1));
set("y span",d(1));
set("name","layer_"+num2str(1));

for (i = 2:1:length(d)){
addrect;
y(i) = y(i-1)+(d(i-1)+d(i))/2;
set("x span",x_span);
set("z span",z_span);
set("y",y(i));
set("y span",d(i));
set("name","layer_"+num2str(i));
}


You can change the code itself to suit you requirements. Note that I haven't changed the default material, you can do it from the Material properties of each rectangle. If you want to change the thickness of each layer you can do that from the "Properties" tab (instead of individual rectangle objects). You will see that if you change the thickness of any layer, the other layers are automatically shifted. 

Please let me know if you have any questions or face any issues.

Regards,
Amrita