(set-param! resolution 40) ; pixels/unit length (1 um) (define-param a-start 0.43) ; starting periodicity (define-param a-end 0.33) ; ending periodicity (define-param s-cav 0.146) ; cavity length (define-param r 0.28) ; hole radius (units of "a") (define-param h 0.22) ; waveguide height (define-param w 0.50) ; waveguide width (define-param dair 1.00) ; air padding (define-param dpml 1.00) ; PML thickness (define-param Ndef 3) (define a-taper (interpolate Ndef (list a-start a-end))) ; Ndef + 2 elements (define a-last (list-ref a-taper (+ Ndef 1))) (define dgap (- a-last (* 2 r a-last))) (define-param Nwvg 8) (define sx (+ (* 2 (+ (* Nwvg a-start) (fold-left + 0 a-taper))) (- dgap) s-cav)) (define sy (+ dpml dair w dair dpml)) (define sz (+ dpml dair h dair dpml)) (set! geometry-lattice (make lattice (size sx sy sz))) (set! pml-layers (list (make pml (thickness dpml)))) (define-param nSi 3.5) (define Si (make medium (index nSi))) (set! geometry (list (make block (center 0 0 0) (size infinity w h) (material Si)))) (define holes (list '())) (set! holes (append holes (map (lambda (mm) (list (make cylinder (center (+ (* -0.5 sx) (* 0.5 a-start) (* mm a-start)) 0 0) (radius (* r a-start)) (height infinity) (material air)) (make cylinder (center (- (* 0.5 sx) (* 0.5 a-start) (* mm a-start)) 0 0) (radius (* r a-start)) (height infinity) (material air)))) (arith-sequence 0 1 Nwvg)))) (set! holes (apply append holes)) (set! geometry (append geometry holes)) (set! holes (list '())) (set! holes (append holes (map (lambda (mm) (list (make cylinder (center (+ (* -0.5 sx) (* Nwvg a-start) (if (> mm 0) (fold-left + 0 (map (lambda (nn) (list-ref a-taper nn)) (arith-sequence 0 1 mm))) 0) (* 0.5 (list-ref a-taper mm))) 0 0) (radius (* r (list-ref a-taper mm))) (height infinity) (material air)) (make cylinder (center (- (* 0.5 sx) (* Nwvg a-start) (if (> mm 0) (fold-left + 0 (map (lambda (nn) (list-ref a-taper nn)) (arith-sequence 0 1 mm))) 0) (* 0.5 (list-ref a-taper mm))) 0 0) (radius (* r (list-ref a-taper mm))) (height infinity) (material air)))) (arith-sequence 0 1 (+ Ndef 2))))) (set! holes (apply append holes)) (set! geometry (append geometry holes)) (define-param lambda-min 1.46) ; minimum source wavelength (define-param lambda-max 1.66) ; 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 (set! sources (list (make source (src (make gaussian-src (frequency fcen) (fwidth df))) (component Ey) (center 0 0 0)))) (set! symmetries (list (make mirror-sym (direction X) (phase +1)) (make mirror-sym (direction Y) (phase -1)) (make mirror-sym (direction Z) (phase +1)))) (define-param src-time 500) (run-sources+ src-time (after-sources (harminv Ey (vector3 0 0 0) fcen df)) (in-volume (volume (center 0 0 0) (size sx sy 0)) (at-end output-epsilon output-efield-y)))