Here is an example in 2d of setting up an object with a sinusoidally-varying permittivity profile. Note that even though subpixel smoothing is turned off, it still takes some time to initialize the grid. The material function involves callbacks between C++ and Scheme at each pixel which is slow. We are hoping to improve this in the upcoming Python interface.

(set-param! eps-averaging? false)
(set-param! resolution 50)

(define-param nglass 1.45)
(define-param nair 1.0)
(define myeps (lambda (p)
 (sqr (+ (* (- nglass nair) (sqr (sin (* 2 pi (vector3-x p))))) nair))))

(set! geometry-lattice (make lattice (size 5 5 no-size)))

(set! geometry (list
     (make block (size infinity 3 infinity) (center 0 0 0)
     (material (make material-function (epsilon-func myeps))))))

(run-until 0 (at-beginning output-epsilon))


_______________________________________________
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to