"Fossies" - the Fresh Open Source Software Archive

Member "meep-1.10.0/scheme/examples/parallel-wvgs-force.ctl" (10 Nov 2018, 2298 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. See also the last Fossies "Diffs" side-by-side code changes report for "parallel-wvgs-force.ctl": 1.6_vs_1.7.0.

    1 (set-param! resolution 30)   ; pixels/um
    2 
    3 (define Si (make medium (index 3.45)))
    4 
    5 (define-param dpml 1.0)
    6 (set! pml-layers (list (make pml (thickness dpml))))
    7 
    8 (define-param sx 5)
    9 (define-param sy 3)
   10 (set! geometry-lattice
   11       (make lattice (size (+ sx (* 2 dpml)) (+ sy (* 2 dpml)) no-size)))
   12 
   13 (define-param a 1.0)  ; waveguide width
   14 (define-param s 1.0)  ; waveguide separation distance
   15 (set! geometry (list
   16 		(make block (center (* -0.5 (+ s a)) 0)
   17 		      (size a a infinity) (material Si))
   18 		(make block (center (* 0.5 (+ s a)) 0)
   19 		      (size a a infinity) (material Si))))
   20 
   21 (define-param xodd? true)
   22 (set! symmetries (list
   23 		  (make mirror-sym (direction X) (phase (if xodd? -1 +1)))
   24 		  (make mirror-sym (direction Y) (phase -1))))
   25 
   26 (set! k-point (vector3 0 0 0.5))
   27 
   28 (define-param fcen 0.22)
   29 (define-param df 0.06)
   30 (set! sources (list
   31 	       (make source (src (make gaussian-src (frequency fcen) (fwidth df)))
   32 		     (component Ey) (center (* -0.5 (+ s a)) 0) (size a a 0))
   33 	       (make source (src (make gaussian-src (frequency fcen) (fwidth df)))
   34 		     (component Ey) (center (* 0.5 (+ s a)) 0) (size a a 0)
   35 		     (amplitude (if xodd? -1.0 1.0)))))
   36 
   37 (run-sources+ 200
   38 	      (after-sources (harminv Ey (vector3 (* 0.5 (+ s a)) 0) fcen df)))
   39 
   40 (define f (harminv-freq-re (car harminv-results)))
   41 (print "freq:, " s ", " f "\n")
   42 
   43 (reset-meep)
   44 (change-sources! (list
   45 		  (make eigenmode-source
   46 		    (src (make gaussian-src (frequency f) (fwidth df)))
   47 		    (size a a 0)
   48 		    (center (* -0.5 (+ s a)) 0)
   49 		    (eig-kpoint k-point)
   50 		    (eig-match-freq? true)
   51 		    (eig-parity ODD-Y))
   52 		  (make eigenmode-source
   53 		    (src (make gaussian-src (frequency f) (fwidth df)))
   54 		    (size a a 0)
   55 		    (center (* 0.5 (+ s a)) 0)
   56 		    (eig-kpoint k-point)
   57 		    (eig-match-freq? true)
   58 		    (eig-parity ODD-Y)
   59 		    (amplitude (if xodd? -1.0 1.0)))))
   60 
   61 (define wvg-flux (add-flux f 0 1
   62 			  (make flux-region (direction Z) (center 0 0)
   63 				(size (* 1.2 (+ (* 2 a) s)) (* 1.2 a) 0))))
   64 (define wvg-force (add-force f 0 1
   65 			     (make force-region (direction X) (weight +1.0)
   66 				   (center (* 0.5 s) 0) (size 0 a))
   67 			     (make force-region (direction X) (weight -1.0)
   68 				   (center (+ (* 0.5 s) a) 0) (size 0 a))))
   69 
   70 (run-sources+ 5000)
   71 
   72 (display-fluxes wvg-flux)
   73 (display-forces wvg-force)