"Fossies" - the Fresh Open Source Software Archive

Member "meep-1.10.0/scheme/examples/holey-wvg-cavity.ctl" (12 May 2018, 3361 Bytes) of package /linux/privat/meep-1.10.0.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 ; Meep Tutorial: Hz-polarized transmission and reflection through a cavity
    2 ; formed by a periodic sequence of holes in a dielectric waveguide,
    3 ; with a defect formed by a larger spacing between one pair of holes.
    4 
    5 ; This structure is based on one analyzed in:
    6 ;    S. Fan, J. N. Winn, A. Devenyi, J. C. Chen, R. D. Meade, and
    7 ;    J. D. Joannopoulos, "Guided and defect modes in periodic dielectric
    8 ;    waveguides," J. Opt. Soc. Am. B, 12 (7), 1267-1272 (1995).
    9 
   10 ; Some parameters to describe the geometry:
   11 (define-param eps 13) ; dielectric constant of waveguide
   12 (define-param w 1.2) ; width of waveguide
   13 (define-param r 0.36) ; radius of holes
   14 (define-param d 1.4) ; defect spacing (ordinary spacing = 1)
   15 (define-param N 3) ; number of holes on either side of defect
   16 
   17 ; The cell dimensions
   18 (define-param sy 6) ; size of cell in y direction (perpendicular to wvg.)
   19 (define-param pad 2) ; padding between last hole and PML edge
   20 (define-param dpml 1) ; PML thickness
   21 
   22 (define sx (+ (* 2 (+ pad dpml N)) d -1)) ; size of cell in x direction
   23 (set! geometry-lattice (make lattice (size sx sy no-size)))
   24 
   25 (set! geometry
   26       (append ; combine lists of objects:
   27        (list (make block (center 0 0) (size infinity w infinity)
   28 		   (material (make dielectric (epsilon eps)))))
   29        (geometric-object-duplicates (vector3 1 0) 0 (- N 1)
   30 	(make cylinder (center (/ d 2) 0) (radius r) (height infinity)
   31 	      (material air)))
   32        (geometric-object-duplicates (vector3 -1 0) 0 (- N 1)
   33 	(make cylinder (center (/ d -2) 0) (radius r) (height infinity)
   34 	      (material air)))))
   35 
   36 (set! pml-layers (list (make pml (thickness dpml))))
   37 (set-param! resolution 20)
   38 
   39 (define-param fcen 0.25) ; pulse center frequency                            
   40 (define-param df 0.2)  ; pulse width (in frequency) 
   41 
   42 (define-param nfreq 500) ; number of frequencies at which to compute flux
   43 
   44 ; false = transmission spectrum, true = resonant modes:
   45 (define-param compute-mode? false)
   46 
   47 (if compute-mode?
   48     (begin
   49       (set! sources (list
   50 		     (make source
   51 		       (src (make gaussian-src (frequency fcen) (fwidth df)))
   52 		       (component Hz) (center 0 0))))
   53 
   54       (set! symmetries
   55 	    (list (make mirror-sym (direction Y) (phase -1))
   56 		  (make mirror-sym (direction X) (phase -1))))
   57 
   58       (run-sources+ 400
   59 		    (at-beginning output-epsilon)
   60 		    (after-sources (harminv Hz (vector3 0) fcen df)))
   61       (run-until (/ 1 fcen) (at-every (/ 1 fcen 20) output-hfield-z))      
   62       )
   63     (begin
   64       (set! sources (list
   65 		     (make source
   66 		       (src (make gaussian-src (frequency fcen) (fwidth df)))
   67 		       (component Ey)
   68 		       (center (+ dpml (* -0.5 sx)) 0)
   69 		       (size 0 w))))
   70 
   71       (set! symmetries (list (make mirror-sym (direction Y) (phase -1))))
   72       
   73       (let ((trans ; transmitted flux
   74 	      (add-flux fcen df nfreq
   75 		        (make flux-region
   76 		          (center (- (* 0.5 sx) dpml 0.5) 0) (size 0 (* w 2))))))
   77       
   78           (run-sources+ (stop-when-fields-decayed
   79 		        50 Ey
   80 		        (vector3 (- (* 0.5 sx) dpml 0.5) 0)
   81 		        1e-3)
   82 		        (at-beginning output-epsilon)
   83 		        (during-sources
   84                         (in-volume (volume (center 0 0) (size sx 0))
   85                                    (to-appended "hz-slice" (at-every 0.4 output-hfield-z)))))
   86       
   87           (display-fluxes trans) ; print out the flux spectrum
   88       )))