(set-param! resolution 100) ; pixels/a (a = 1 um) (define-param lambda-min 0.4) ; minimum source wavelength (define-param lambda-max 0.8) ; maximum source wavelength (define fmin (/ lambda-max)) ; minimum source frequency (define fmax (/ lambda-min)) ; maximum source frequency (define fcen (* 0.5 (+ fmin fmax))) ; source frequency center (define df (- fmax fmin)) ; source frequency width (define-param tABS lambda-max) ; absorber/PML thickness (define-param tGLS 1) ; glass thickness (define-param tITO 0.1) ; ITO thickness (define-param tORG 0.1) ; organic thickness (define-param tAl 0.1) ; Al thickness ; length of computational cell along Z (define sz (+ tABS tGLS tITO tORG tAl)) ; length of non-absorbing region of computational cell in X and Y (define-param L 4) (define sxy (+ L (* 2 tABS))) (set! geometry-lattice (make lattice (size sxy sxy sz))) (set! pml-layers (list (make absorber (thickness tABS) (direction X)) (make absorber (thickness tABS) (direction Y)) (make pml (thickness tABS) (direction Z) (side High)))) (define ORG (make medium (index 1.75))) (define ITO (make medium (index 1.80))) (define GLS (make medium (index 1.45))) (set! geometry (list (make block (material GLS) (size infinity infinity (+ tABS tGLS)) (center 0 0 (- (* 0.5 sz) (* 0.5 (+ tABS tGLS))))) (make block (material ITO) (size infinity infinity tITO) (center 0 0 (- (* 0.5 sz) tABS tGLS (* 0.5 tITO)))) (make block (material ORG) (size infinity infinity tORG) (center 0 0 (- (* 0.5 sz) tABS tGLS tITO (* 0.5 tORG)))) (make block (material Al) (size infinity infinity tAl) (center 0 0 (- (* 0.5 sz) tABS tGLS tITO tORG (* 0.5 tAl)))))) ; random number generator: uniformly distributed in [-1,1] (define random-num (lambda () (let ((time (gettimeofday))) (set! *random-state* (seed->random-state (+ (car time) (cdr time))))) (if (> (random:uniform) 0.5) (random:uniform) (* -1 (random:uniform))))) (define-param perp-dipole? true) (define src-cmpt (if perp-dipole? Ez Ex)) ; current source component (define-param num-src 10) ; number of point sources (set! sources (map (lambda (cz) (make source (src (make gaussian-src (frequency fcen) (fwidth df))) (component src-cmpt) (center 0 0 (- (* 0.5 sz) tABS tGLS tITO (* 0.4 tORG) (* 0.2 cz tORG))) (amplitude (exp (* 0+2i pi (abs (random-num))))))) (arith-sequence (/ num-src) (/ num-src) num-src))) (set! force-complex-fields? true) (if (= src-cmpt Ex) (set! symmetries (list (make mirror-sym (direction X) (phase -1)) (make mirror-sym (direction Y) (phase +1))))) (if (= src-cmpt Ey) (set! symmetries (list (make mirror-sym (direction X) (phase +1)) (make mirror-sym (direction Y) (phase -1))))) (if (= src-cmpt Ez) (set! symmetries (list (make mirror-sym (direction X) (phase +1)) (make mirror-sym (direction Y) (phase +1))))) (define-param load-structure? false) (if load-structure? (begin (set! geometry '()) (init-structure) (meep-structure-load structure "oled-epsilon.h5"))) ; number of frequency bins for DFT fields (define-param nfreq 50) ; surround source with a six-sided box of flux planes (define srcbox-width 0.05) (define srcbox-top (add-flux fcen df nfreq (make flux-region (size srcbox-width srcbox-width 0) (direction Z) (center 0 0 (- (* 0.5 sz) tABS tGLS)) (weight +1)))) (define srcbox-bot (add-flux fcen df nfreq (make flux-region (size srcbox-width srcbox-width 0) (direction Z) (center 0 0 (- (* 0.5 sz) tABS tGLS tITO (* 0.8 tORG))) (weight -1)))) (define srcbox-xp (add-flux fcen df nfreq (make flux-region (size 0 srcbox-width (+ tITO (* 0.8 tORG))) (direction X) (center (* 0.5 srcbox-width) 0 (- (* 0.5 sz) tABS tGLS (* 0.5 (+ tITO (* 0.8 tORG))))) (weight +1)))) (define srcbox-xm (add-flux fcen df nfreq (make flux-region (size 0 srcbox-width (+ tITO (* 0.8 tORG))) (direction X) (center (* -0.5 srcbox-width) 0 (- (* 0.5 sz) tABS tGLS (* 0.5 (+ tITO (* 0.8 tORG))))) (weight -1)))) (define srcbox-yp (add-flux fcen df nfreq (make flux-region (size srcbox-width 0 (+ tITO (* 0.8 tORG))) (direction Y) (center 0 (* 0.5 srcbox-width) (- (* 0.5 sz) tABS tGLS (* 0.5 (+ tITO (* 0.8 tORG))))) (weight +1)))) (define srcbox-ym (add-flux fcen df nfreq (make flux-region (size srcbox-width 0 (+ tITO (* 0.8 tORG))) (direction Y) (center 0 (* -0.5 srcbox-width) (- (* 0.5 sz) tABS tGLS (* 0.5 (+ tITO (* 0.8 tORG))))) (weight -1)))) ; padding for flux box to fully capture waveguide mode (define fluxbox-dpad 0.05) ; upward flux into glass substrate (define glass-flux (add-flux fcen df nfreq (make flux-region (size L L 0) (direction Z) (center 0 0 (- (* 0.5 sz) tABS (- tGLS fluxbox-dpad))) (weight +1)))) ; surround ORG/ITO waveguide with four-sided box of flux planes ; NOTE: waveguide mode extends partially into Al cathode and glass substrate (define wvgbox-xp (add-flux fcen df nfreq (make flux-region (size 0 L (+ fluxbox-dpad tITO tORG fluxbox-dpad)) (direction X) (center (* 0.5 L) 0 (- (* 0.5 sz) tABS tGLS (* 0.5 (+ tITO tORG)))) (weight +1)))) (define wvgbox-xm (add-flux fcen df nfreq (make flux-region (size 0 L (+ fluxbox-dpad tITO tORG fluxbox-dpad)) (direction X) (center (* -0.5 L) 0 (- (* 0.5 sz) tABS tGLS (* 0.5 (+ tITO tORG)))) (weight -1)))) (define wvgbox-yp (add-flux fcen df nfreq (make flux-region (size L 0 (+ fluxbox-dpad tITO tORG fluxbox-dpad)) (direction Y) (center 0 (* 0.5 L) (- (* 0.5 sz) tABS tGLS (* 0.5 (+ tITO tORG)))) (weight +1)))) (define wvgbox-ym (add-flux fcen df nfreq (make flux-region (size L 0 (+ fluxbox-dpad tITO tORG fluxbox-dpad)) (direction Y) (center 0 (* -0.5 L) (- (* 0.5 sz) tABS tGLS (* 0.5 (+ tITO tORG)))) (weight -1)))) (run-sources+ (stop-when-fields-decayed 50 src-cmpt (vector3 0 0 (- (* 0.5 sz) tABS tGLS tITO (* 0.5 tORG))) 1e-8)) (if (not load-structure?) (meep-structure-dump structure "oled-epsilon.h5")) (display-fluxes srcbox-top srcbox-bot srcbox-xp srcbox-xm srcbox-yp srcbox-ym glass-flux wvgbox-xp wvgbox-xm wvgbox-yp wvgbox-ym)