/* * METRIC-Application: * A three layer waveguide, complex permittivity: * mode analysis, mode object handling */ #include #include #include #include"metric.h" Complex Wgpns(1.5, 0.0); // substrate refractive index Complex Wgpnf(2.0, -0.1); // film refractive index, attenuating medium Complex Wgpnc(1.0, 0.0); // cover: air double Wgpt = 1.0; // slab thickness double Wavel = 1.55; // vacuum wavelength /* waveguide definition */ cWaveguide wgdef() { // a waveguide with one inner layer cWaveguide g(1); // positions of the dielectric interfaces g.hx(0) = 0.0; g.hx(1) = Wgpt; // refractive index values g.n(0) = Wgpns; g.n(1) = Wgpnf; g.n(2) = Wgpnc; // the vacuum wavelength g.lambda = Wavel; return g; } /* calculate bound modes, write profile data */ int main() { cModeArray ma; // define the waveguide cWaveguide wg = wgdef(); // display window Interval disp(wg.hx(0)-2.0, wg.hx(wg.nx)+2.0); // inspect the refractive index profile wg.plot(disp, '0', '0'); // find bound TE modes modeanalysis(wg, TE, ma); // mode data & plots of principal profiles for(int i=0; i<=ma.num-1; ++i) { fprintf(stderr, "[%d] %s: neff = ", i, ma(i).ids); ma(i).neff.nice(stderr); fprintf(stderr, ", beta = %g, alpha = %g", ma(i).beta, ma(i).alpha); if(ma(i).alpha > 0.0) fprintf(stderr, ", Lp = %g", ma(i).Lp()); fprintf(stderr, "\n"); ma(i).plot(EY, REP, disp, 500, dig10(i), dig1(i), 'L'); ma(i).plot(EY, IMP, disp, 500, dig10(i), dig1(i), 'V'); } // ... the same for the TM fields modeanalysis(wg, TM, ma); for(int i=0; i<=ma.num-1; ++i) { fprintf(stderr, "[%d] %s: neff = ", i, ma(i).ids); ma(i).neff.nice(stderr); fprintf(stderr, ", beta = %g, alpha = %g", ma(i).beta, ma(i).alpha); if(ma(i).alpha > 0.0) fprintf(stderr, ", Lp = %g", ma(i).Lp()); fprintf(stderr, "\n"); ma(i).plot(HY, REP, disp, 500, dig10(i), dig1(i), 'L'); ma(i).plot(HY, IMP, disp, 500, dig10(i), dig1(i), 'V'); } fprintf(stderr, "Ok.\n"); return 0; }