Amit Rotem
Subscriber

I'm running on a Windows 11 Pro 23H2.

You can get somthing more reproducible by moving the rectangle (or the solver region) along the wide axis.
Here I moved the solver region so the coordinates of the mode won’t change.

 


clc;
cleardcard;
closeall;
newproject;
## design
addrect;
set("x",0);set("x span",1e-6);
set("y",0);set("y span",1e-6);
set("z",0);set("z span",0.2e-6);
set("material", "Si (Silicon) - Palik");
## solver
addfde;
set("solver type", "2D X normal");
set("x",0);
set("y",0);set("y span",2e-6);
set("z",0);set("z span",1e-6);
set("number of trial modes", 3);
set("mesh cells z", 50);
set("mesh cells y", 50);
## get mode
K = 5;
for (k=0:K){
    setnamed("FDE", "y", (k/K-0.5)*0.5e-6);
    #setnamed("rectangle", "y", (k/K-0.5)*0.5e-6);
    findmodes;
    copydcard("mode2", "m"+num2str(k));
    switchtolayout;
}
## get neff and expand modes
neff_list = matrix(K);
Smat = matrix(K,K);
for (k=1:K){
    neff_list(k) = getdata("m"+num2str(k), "neff");
    for (j=1:K){
        X = expand("m"+num2str(k),"m"+num2str(j));
        Smat(j,k) = X(1); # should be 1
    }
}
## modes have minus signs
image(real(Smat));

Â