/* * METRIC-Application: * Oblique guided wave propagation towards a step (double-90^o-kink) * in a slab waveguide, vQUEP solution */ #include #include #include #include"metric.h" #define MPng 3.4 // core refractive index #define MPnb 1.45 // substrate/cladding refractive index #define MPd 0.25 // core thickness /mum #define MPh 2.15 // kink height /mum #define MPth 68.0 // angle of incidence #define Wavel 1.55 // vacuum wavelength /mum #define Pol TE // polarization of the incoming mode #define CWxb -2.5 // computational window: border positions #define CWxt 2.5 #define CWzl -2.5 #define CWzr 2.5 // the discretized radiation field #define NumM 180 // number of expansion terms for both directions /* ------------------------------------------------------------------------ */ /* the step configuration */ SegWgStruct stdef() { Circuit stp(3, 1); stp.hx(0) = -(MPd+MPh+MPd)/2.0; stp.hx(1) = -MPh/2.0; stp.hx(2) = MPh/2.0; stp.hx(3) = (MPd+MPh+MPd)/2.0; stp.hz(0) = -MPd/2.0; stp.hz(1) = MPd/2.0; stp.n(4, 0) = MPnb; stp.n(4, 1) = MPnb; stp.n(4, 2) = MPnb; stp.n(3, 0) = MPnb; stp.n(3, 1) = MPng; stp.n(3, 2) = MPng; stp.n(2, 0) = MPnb; stp.n(2, 1) = MPng; stp.n(2, 2) = MPnb; stp.n(1, 0) = MPng; stp.n(1, 1) = MPng; stp.n(1, 2) = MPnb; stp.n(0, 0) = MPnb; stp.n(0, 1) = MPnb; stp.n(0, 2) = MPnb; stp.lambda = Wavel; SegWgStruct st(stp); return st; } /* ------------------------------------------------------------------------ */ int main() { // structure definition, control output to .m-file SegWgStruct stp = stdef(); stp.plot('0', '0'); // computational window Interval cwx(CWxb, CWxt); Interval cwz(CWzl, CWzr); // vQUEP setup QuepField qfld(stp, LEFT, Pol, 0, CC1, MPth, cwx, NumM, cwz, NumM); // ... and solution qfld.quepsim_s(5, 0.005, 0.01); // modal output Complex a; double r, phi; double zr = stp.hz(0); fprintf(stderr, "\nScattered fundamental mode amplitudes:\n"); a = qfld.Aout(LEFT, TE, 0, zr)/qfld.Ain(LEFT, Pol, 0, zr); r = a.sqabs(); phi = a.arg(); fprintf(stderr, "TE: R = %g, phi = %g\n", r, phi); a = qfld.Aout(LEFT, TM, 0, zr)/qfld.Ain(LEFT, Pol, 0, zr); r = a.sqabs(); phi = a.arg(); fprintf(stderr, "TM: R = %g, phi = %g\n\n", r, phi); a = qfld.Aout(RIGHT, TE, 0, zr)/qfld.Ain(LEFT, Pol, 0, zr); r = a.sqabs(); phi = a.arg(); fprintf(stderr, "TE: T = %g, phi = %g\n", r, phi); a = qfld.Aout(RIGHT, TM, 0, zr)/qfld.Ain(LEFT, Pol, 0, zr); r = a.sqabs(); phi = a.arg(); fprintf(stderr, "TM: T = %g, phi = %g\n\n", r, phi); // power balance double pb, pf, pd, pu; pb = qfld.Pout(LEFT); pf = qfld.Pout(RIGHT); pd = qfld.Pout(BOTTOM); pu = qfld.Pout(TOP); fprintf(stderr, "Total scattered power:\n"); fprintf(stderr, "P_back = %g\n", pb); fprintf(stderr, "P_forw = %g\n", pf); fprintf(stderr, "P_down = %g\n", pd); fprintf(stderr, "P_up = %g\n", pu); fprintf(stderr, "Sum P_out = %g\n", pb+pf+pd+pu); double pbTE, pfTE, pdTE, puTE; double pbTM, pfTM, pdTM, puTM; pbTE = qfld.Pout(LEFT, TE); pfTE = qfld.Pout(RIGHT, TE); pdTE = qfld.Pout(BOTTOM, TE); puTE = qfld.Pout(TOP, TE); pbTM = qfld.Pout(LEFT, TM); pfTM = qfld.Pout(RIGHT, TM); pdTM = qfld.Pout(BOTTOM, TM); puTM = qfld.Pout(TOP, TM); fprintf(stderr, "... per polarization:\n"); fprintf(stderr, "TE: P_back = %g\n", pbTE); fprintf(stderr, " P_forw = %g\n", pfTE); fprintf(stderr, " P_down = %g\n", pdTE); fprintf(stderr, " P_up = %g\n", puTE); fprintf(stderr, " Sum = %g\n", pbTE+pfTE+pdTE+puTE); fprintf(stderr, "TM: P_back = %g\n", pbTM); fprintf(stderr, " P_forw = %g\n", pfTM); fprintf(stderr, " P_down = %g\n", pdTM); fprintf(stderr, " P_up = %g\n", puTM); fprintf(stderr, " Sum = %g\n", pbTM+pfTM+pdTM+puTM); fprintf(stderr, "Sum = %g\n\n", pbTE+pfTE+pdTE+puTE+pbTM+pfTM+pdTM+puTM); // display window double dwl, dwr, dwb, dwt; dwl = -3.2; dwr = 3.2; dwb = -2.2; dwt = 2.2; // field viewer and static field plots, .m-files, // absolute values of electric and magnetic fields, energy density int ndpx, ndpz; ndpx = 150; ndpz = 200; char id1, id2; id1 = 't'; id2 = polchr(Pol); qfld.viewer(dwb, dwt, dwl, dwr, ndpx, ndpz, id1, id2); qfld.plot(mW, dwb, dwt, dwl, dwr, ndpx, ndpz, id1, id2); qfld.plot(mE, dwb, dwt, dwl, dwr, ndpx, ndpz, id1, id2); qfld.plot(mH, dwb, dwt, dwl, dwr, ndpx, ndpz, id1, id2); fprintf(stderr, "\nOk.\n"); return 0; }