cqtavee
Subscriber
Hi! Below are my codes.



deleteall;#L1, L2, L_buffer refer to the different portions of the Si waveguide and are the lengths of the untapered input section, the tapered section, and the untapered end section, respectively
#L_lower_nitride_L_upper_nitride are the lengths of the 2 silicon nitride layers
#W is the width of ridge waveguide
#Wwindow is the width of the entire slab ? should be larger than simulation region
#d is the etch depth
#fine_dx is the finer mesh size (used in key regions). It controls dy and dz around the silicon waveguide, and dz in the nitride layers. It should never be larger than the thickness of the nitride layers or the conformal meshing will not work.
#height is the height of the silicon waveguide
#nSi, nSi3N4, nSiO2 are the refractive indices used for Si, Si3N4 and SiO2 (note that these could be changed to use a model from the database, but it does speed up the calculation to use a lossless dielectric and these materials have negligible loss at 1550nm)
#tBOX is the thickness of the bottom oxide
#tSi3N4 is the thickness of the silicon nitride layers
#tSiO2_1,tSiO2_2,tSiO2_3, tSiO2_4 are the thicknesses of the SiO2 layers from the top of the BOX to the bottom of the first nitride layer, between the first and second nitride layers, between the second and third nitride layers and from the upper nitride layer to the top of the waveguide.
#tw1 and tw2 are the widths of the input and output silicon waveguides, respectively

deleteall;

#input parameters
L1=50e-6;
nSiO2=1.444;
tSi3N4=0.02e-6;
tSiO2_1=2.72e-6;
tSiO2_2=2.72e-6;
tSiO2_3=2.72e-6;
tw1=0.15e-6;
tw3=0.27e-6;
L2=405e-6;
L_buffer=5e-6;
L_lower_nitride=400e-6;
L_upper_nitride=50e-6;
W=14.15e-6;
Wwindow=50e-6;
d=6.5e-6;
height=0.22e-6;
nSi=3.476;
nSi3N4=2.016;
tBOX=15e-6;
fine_dx=0.02e-6;
include_input_buffer=0;
L_middle_nitride=200e-6;
tSiO2_4=2.72e-6;



L_buffer_in = L_buffer;
if(!include_input_buffer) {
L_buffer_in = 0;
}



n_fiber_cladding=1.434816;
n_fiber_core=1.44;
radius_fiber_core=4.1e-6;
#Add fiber cladding
addcircle;set('name','fiber cladding');
set('x',-50e-6);set('z span',100e-6);
set('radius',20e-6);
set('material','');
set('index',n_fiber_cladding);
set('second axis','y');set('rotation 2',90);
set('override mesh order from material database',1);set('mesh order',3);

#Add fiber core
addcircle;set('name','fiber core');
set('x',-50e-6);set('z span',100e-6);
set('radius',radius_fiber_core);
set('material','');
set('index',n_fiber_core);
set('second axis','y');set('rotation 2',90);

select("fiber cladding");
addtogroup("SMF_fiber");
select("fiber core");
addtogroup("SMF_fiber");

select("SMF_fiber");
set('z',2.85e-6);

addrect;
set("x min",-L_buffer_in);
set("x max",L1+L2+L_buffer);
set("y",0);
set("y span",Wwindow);
set("z min",-2*tBOX);
set("z max",-tBOX);
set("index",nSi);
set("name","Si substrate");
set("alpha",0.2);
set("override mesh order from material database",true);
set("mesh order",3);

copy;
set("name","BOX");
set("index",nSiO2);
set("z min",-tBOX);
set("z max",0);

copy;
set("z min",0);
set("z max",tSiO2_1+tSiO2_2+tSiO2_3+tSiO2_4+3*tSi3N4-d);
set("index",nSiO2);
set("name","oxide1");
set("alpha",0.2);
set("override mesh order from material database",true);
set("mesh order",3);

copy;
set("name","oxide2");
set("z min",tSiO2_1+tSiO2_2+tSiO2_3+tSiO2_4+3*tSi3N4-d);
set("z max",tSiO2_1+tSiO2_2+tSiO2_3+tSiO2_4+3*tSi3N4);
set("y span",W);
set("alpha",0.5);


addrect;
set("name","lower nitride");
set("x min",0);
set("x max",L_lower_nitride);
set("y",0);
set("y span",Wwindow);
set("z min",tSiO2_1);
set("z max",tSiO2_1+tSi3N4);
Lstr = num2str(L_lower_nitride*1e6);
Lstr_half = num2str(L_lower_nitride*1e6/2);
?index_string = num2str(nSi3N4)+"-"+num2str(nSi3N4-nSiO2)+"*(x+"+Lstr_half+")/"+Lstr;
set("index",index_string);
set("alpha",0.3);
if(include_input_buffer) {
copy;
set("name","lower nitride input");
set("x min",-L_buffer_in);
set("x max",0);
set("index",nSi3N4);
}

copy;
set("name","middle nitride");
set("x min",0);
set("x max",L_middle_nitride);
set("y",0);
set("y span",W);
set("z min",tSiO2_1+tSiO2_2+tSi3N4);
set("z max",tSiO2_1+tSiO2_2+2*tSi3N4);
Lstr = num2str(L_middle_nitride*1e6);
Lstr_half = num2str(L_middle_nitride*1e6/2);
?index_string = num2str(nSi3N4)+"-"+num2str(nSi3N4-nSiO2)+"*(x+"+Lstr_half+")/"+Lstr;
set("index",index_string);
if(include_input_buffer) {
copy;
set("name","middle nitride input");
set("x min",-L_buffer_in);
set("x max",0);
set("index",nSi3N4);
}

copy;
set("name","upper nitride");
set("x min",0);
set("x max",L_upper_nitride);
set("y",0);
set("y span",W);
set("z min",tSiO2_1+tSiO2_2+tSiO2_3+2*tSi3N4);
set("z max",tSiO2_1+tSiO2_2+tSiO2_3+3*tSi3N4);
Lstr = num2str(L_upper_nitride*1e6);
Lstr_half = num2str(L_upper_nitride*1e6/2);
?index_string = num2str(nSi3N4)+"-"+num2str(nSi3N4-nSiO2)+"*(x+"+Lstr_half+")/"+Lstr;
set("index",index_string);
if(include_input_buffer) {
copy;
set("name","upper nitride input");
set("x min",-L_buffer_in);
set("x max",0);
set("index",nSi3N4);
}

addrect;
set("name","Si input");
set("x min",-L_buffer_in);
set("x max",L1);
set("y",0);
set("y span",tw1);
set("z min",0);
set("z max",height);
set("index",nSi);

copy;
set("name","Si output");
set("x min",L1+L2);
set("x max",L1+L2+L_buffer);
set("y span",tw3);

V = [0,-tw1/2;
0,tw1/2;
L2,tw3/2;
L2,-tw3/2];
addpoly;
set("name","Si taper");
set("index",nSi);
set("z min",0);
set("z max",height);
set("x",L1);
set("y",0);
set("vertices",V);

addmesh;
set("x min",-L_buffer_in);
set("x max",L1+L2+L_buffer);
set("y",0);
set("y span",Wwindow);
set("z min",-2*tBOX);
set("z max",-tBOX);
set("override x mesh",false);
set("override y mesh",false);
set("override z mesh",true);
set("set mesh multiplier",true);
set("z mesh multiplier",4);
set("name","Si substrate override");

addmesh;
set("name","mesh_Si");
set("x min",-L_buffer_in);
set("x max",L1+L2+L_buffer);
set("y",0);
set("y span",max([tw1,tw3]));
set("z min",0);
set("z max",height);
set("override x mesh",false);
set("override y mesh",true);
set("override z mesh",true);
set("dy",fine_dx);
set("dz",fine_dx);


addmesh;
set("name","mesh lower nitride");
set("x min",-L_buffer_in);
set("x max",L_lower_nitride);
set("y",0);
set("y span",Wwindow);
set("z min",tSiO2_1);
set("z max",tSiO2_1+tSi3N4);
set("override x mesh",false);
set("override y mesh",false);
set("override z mesh",true);
set("dz",fine_dx);


copy;
set("name","mesh middle nitride");
set("x max",L_middle_nitride);
set("y span",W);
set("z min",tSiO2_1+tSiO2_2+tSi3N4);
set("z max",tSiO2_1+tSiO2_2+2*tSi3N4);

copy;
set("name","mesh upper nitride");
set("x max",L_upper_nitride);
set("y span",W);
set("z min",tSiO2_1+tSiO2_2+tSiO2_3+2*tSi3N4);
set("z max",tSiO2_1+tSiO2_2+tSiO2_3+3*tSi3N4);


addfde;
set("solver type","2D X normal");
set('z min',-3.2e-6);set('z max',12e-6);
set("y",0);
set("y span",30e-6);
set("x", 0e-6);
set('mesh cells z', 100);set('mesh cells y', 100);
set('y min bc', 'Anti-Symmetric');

setanalysis("wavelength", 1.5e-6);
findmodes;