/* * METRIC-Application: * Guided wave propagation along a slab waveguide */ #include #include #include #include"metric.h" #define Pol TE // light polarization #define WPnb 1.0 // background refractive index #define WPng 2.0 // core refractive index #define WPw 0.4 // core width /mum #define Wavel 1.55 // vacuum wavelength /mum #define DWx 2.0 // half widths of the display window, symmetric #define DWz 3.0 // /* ------------------------------------------------------------------------ */ /* a slab waveguide */ Waveguide wgdef() { Waveguide wg(1); wg.hx(0) = -WPw/2.0; wg.hx(1) = WPw/2.0; wg.n(0) = WPnb; wg.n(1) = WPng; wg.n(2) = WPnb; wg.lambda = Wavel; return wg; } /* ------------------------------------------------------------------------ */ /* guided wave simulation */ int main() { fprintf(stderr, "\nWaveguide:\n"); fprintf(stderr, "----------\n"); fprintf(stderr, "lambda = %g mum\n", Wavel); fprintf(stderr, "n_b = %g\n", WPnb); fprintf(stderr, "n_g = %g\n", WPng); fprintf(stderr, "w = %g mum\n\n", WPw); // the structure under investigation Waveguide wg = wgdef(); // find the guided modes ModeArray ma; modeanalysis(wg, Pol, ma); // illustrate the propagation of the fundamental mode Cvector af(ma.num); Cvector ab(ma.num); af.init(CC0); ab.init(CC0); af(0) = CC1; Mlop_Print = NO; Mlop_Colour = YES; char pc = polchr(Pol); Fcomp fc = principalcomp(Pol); ma.viewer(af, ab, -DWx, DWx, -DWz, DWz, 150, 150, 't', pc); ma.plot(af, ab, fc, REP, -DWx, DWx, -DWz, DWz, 150, 150, 't', pc); ma.plot(af, ab, fc, IMP, -DWx, DWx, -DWz, DWz, 150, 150, 't', pc); ma.plot(af, ab, fc, MOD, -DWx, DWx, -DWz, DWz, 150, 150, 't', pc); ma.phasemap(af, ab, fc, -DWx, DWx, -DWz, DWz, 150, 150, 't', pc); ma.movie(af, ab, -DWx, DWx, -DWz, DWz, 150, 150, 30, 't', pc); ma.fplot(af, ab, fc, -DWx, DWx, -DWz, DWz, 150, 150, 't', pc); ma.fmovie(af, ab, -DWx, DWx, -DWz, DWz, 150, 150, 30, 't', pc); fprintf(stderr, "\nOk.\n"); return 0; }