Skip to content

Instantly share code, notes, and snippets.

@GCBallesteros
Last active March 5, 2018 21:33
Show Gist options
  • Save GCBallesteros/98b48a594e8c80b1226b1357ce78a329 to your computer and use it in GitHub Desktop.
Save GCBallesteros/98b48a594e8c80b1226b1357ce78a329 to your computer and use it in GitHub Desktop.
Return a list of blocks that makes the DBR
(define* (add-DBR n1 n2 n-pairs wl y-pos #:optional (growth-dir +) (dbr-width infinity))
(let
((layer1-t (* 0.25 (/ wl n1)))
(layer2-t (* 0.25 (/ wl n2)))
(make-layer (lambda (layer-t index pos) (make block
(center 0 (growth-dir pos (/ layer-t 2)) 0)
(material (make dielectric (epsilon (* index index))))
(size dbr-width layer-t dbr-width)))))
(let
((make-pair (lambda (pos) (list
(make-layer layer1-t n1 pos)
(make-layer layer2-t n2 (growth-dir pos layer1-t))))))
(do
((ii 0 (+ ii 1))
(pos y-pos (growth-dir pos layer1-t layer2-t))
(layer-list '() (append layer-list (make-pair pos))))
((= ii n-pairs) layer-list)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment