Dear Colleages:
    I hope to use the loop,but it does not work,what is wrong with it,thank
you.
*Here is my loop:*
         (define (loop x)
          (volume    (center   (/ (+ w  space) -2)  (- 2 (/ sy 2) )  (- (+ (
/ wz1 2) (/ wz2 2) ) (+ (/ wz4 2)  (/ wz5 2))) )   (size w x wz3 ) ))

       (run-until 100
       (at-time 100
        (do ((x 0 (+ x 0.1))) ((> x 10))   (display-flux-in-box Y (loop
x)))))

*The following is the whole  program:
*

(define-param n 3.42) ; index of Si
(define-param n1 1.46) ; index of  SiO2
(define-param n2 1.98) ; index of  ZnO

(define  nzn (+  n2 (*  0.0003 n2))) ; index change of ZnO
(define  nwa1 (+  n  (*  0.0002  n))) ; index change  of waveguide Si
(define  nwa2 (+  n1  (*  0.0002  n1))) ; index change  of waveguide SiO2
(define  ncl  (+  n1  (*  0.0002  n1))) ; index change  of clading SiO2

(define-param pad 2) ; padding between waveguide and edge of PML
(define-param dpml 1) ; thickness of PML

(set! resolution 10)
(define-param fcen 0.6452) ; pulse center frequency
(define-param df 0.01)  ; pulse width (in frequency)

(define-param l  10)
(define-param w 0.5)  ; width of waveguide Si
(define-param space 0.18) ;space  between edge of direct WG and edge of ring
WG

(define-param wz1 0.3)  ; height of ZnO
(define-param wz2  0.2)  ; height of upcladding SiO2
(define-param wz3  0.22)  ; height of waveguide  Si and SiO2
(define-param wz4  2)  ; height of downcladding SiO2
(define-param wz5  1)  ; height of  Substrate

(define sx  (+  (* 2 w)  space (* 2 (+ pad dpml)))) ; cell size
(define sy (+  l  (* 2 (+ pad dpml)))) ; cell size
(define sz (+  wz1   wz2  wz3 wz4 wz5 (* 2 (+ pad dpml)))) ; cell size

(define-param x 0)
(set! geometry-lattice (make lattice (size sx sy sz)))
(set! pml-layers (list (make pml (thickness dpml))))

(set! geometry

(list
           (make block (center  0 0  (*   -1 (+  (/ wz2 2)  (/ wz3 2) (/ wz4
2) (/ wz5 2)))    ) (size infinity  infinity  wz1)
          (material(make dielectric (index n2)) ))
           (make block (center  0 0  (- ( / wz1 2) (+ (/ wz3 2) (/ wz4 2) (/
wz5 2)))  ) (size infinity  infinity  wz2)
           (material(make dielectric (index n1)) ))
         (make block (center  0 0 (- (+ ( / wz1 2) (/ wz2 2) ) (+ (/ wz4 2)
(/ wz5 2))) )  (size infinity  infinity  wz3)
          (material(make dielectric (index n1)) ))
          (make block (center (/ (+ w  space) 2) 0 (- (+ ( / wz1 2) (/ wz2
2) ) (+ (/ wz4 2)  (/ wz5 2)))) (size  w  infinity  wz3)
        (material (make dielectric (index n)) ))
      (make block (center (/ (+ w  space) -2) 0 (- (+ ( / wz1 2) (/ wz2 2) )
(+ (/ wz4 2)  (/ wz5 2)))) (size  w  infinity  wz3)
       (material (make dielectric (index n)) ))
          (make block (center  0 0  (- (+ ( / wz1 2) (/ wz2 2) (/ wz3 2)) (/
wz5 2))) (size infinity  infinity  wz4)
            (material(make dielectric (index n1)) ))
            (make block (center  0 0  (+ ( / wz1 2) (/ wz2 2) (/ wz3 2) ( /
wz4 2))) (size infinity  infinity  wz5)
            (material(make dielectric (index n)) )) ) )

(set! sources
              (list   (make source
   (src (make gaussian-src (frequency fcen) (fwidth df)))   (component Ex)
   (center   (/ (+ w  space) 2)  (- (/ sy 2) 2) (- (+ ( / wz1 2) (/ wz2 2) )
(+ (/ wz4 2)  (/ wz5 2)) ))  )))

(define ((display-flux-in-box dir box))
 (print "flux:, " (meep-time) ", " (flux-in-box dir box) "\n"))


(define (loop x)
        (volume
        (center   (/ (+ w  space) -2)  (- 2 (/ sy 2) )  (- (+ ( / wz1 2) (/
wz2 2) ) (+ (/ wz4 2)  (/ wz5 2))) )
       (size w x wz3 )))


 (run-until 100
 (at-time 100
(do ((x 0 (+ x 0.1))) ((> x 10))

  (display-flux-in-box Y

(loop x)))))
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to