I'm looking to build a layered quarter wave stack structure in a FDTD simulation. I've tried both 2-D and 3-D and it hasn't worked. I'm able to do a block of solid material but not layers. The incident source that should be reflected is passing straight through.
Here's the code I'm using to build the structure:
/* build the substrate*/
for (mm = 1; mm < SizeX - 1; mm++) {
xmin = 1000;
xmax = 2900;
for (nn = 1; nn < SizeY - 1; nn++) {
ymin = 10;
ymax = 70;
if (((mm > xmin)&&(mm < xmax))&&((nn> ymin)&&(nn < ymax))) {
printf("mm is %d, nn is %d \n",mm, nn);
Cexe(mm, nn) = 1.0;
Cexh(mm, nn) =(Cdtds*imp0)/(1.46*1.46) ;
Cexe(mm, nn + 1) = 1.0;
Cexh(mm, nn + 1) = (Cdtds*imp0)/(1.46*1.46);
Ceye(mm + 1, nn) = 1.0;
Ceyh(mm + 1, nn) = (Cdtds*imp0)/(1.46*1.46);
Ceye(mm, nn) = 1.0;
Ceyh(mm, nn) = (Cdtds*imp0)/(1.46*1.46);
}
}
}
/* add the 15 layers of higher index material*/
int count = 0;
while(count xmin)&&(mm < xmax))&&((nn> ymin)&&(nn < ymax))) {
// printf("mm is %d, nn is %d \n",mm, nn);
Cexe(mm, nn) = 1.0;
Cexh(mm, nn) =(Cdtds*imp0)/(2.1*2.1) ;
Cexe(mm, nn + 1) = 1.0;
Cexh(mm, nn + 1) = (Cdtds*imp0)/(2.1*2.1);
Ceye(mm + 1, nn) = 1.0;
Ceyh(mm + 1, nn) = (Cdtds*imp0)/(2.1*2.1);
Ceye(mm, nn) = 1.0;
Ceyh(mm, nn) = (Cdtds*imp0)/(2.1*2.1);
}
}
}
count++;
}