Hi meep users,
I have a question about generating source array.
To make random initialized field, I want to assign a field value at all grid
points.
But if I use source array, it took lots of time even though for setting some
value at the beginning time.
Could you help me to solve this difficulty?
The below is an example.
-------------------------------------------------------------
(set! count 0)
;random phase part
(do ((nn (* -1 nmax) (+ nn 1)))((> nn nmax))
(do ((mm (* -1 mmax) (+ mm 1)))((> mm mmax))
(vector-set! phig count (random:uniform))
(print " Random phase of G at ("mm ", "nn") is " (vector-ref phig count)"
[2pi] \n")
(set! count (+ count 1))
))
;creation of source array
(do ((yy (* isy -0.5) (+ yy (* 1 ds))))((> yy (* isy 0.499999)))
(do ((xx (* isx -0.5) (+ xx (* 1 ds))))((> xx (* isx 0.499999)))
;source phase summation
(set! count 0)
(set! amp 0)
(do ((nn (* -1 nmax) (+ nn 1)))((> nn nmax))
(do ((mm (* -1 mmax) (+ mm 1)))((> mm mmax))
(set! phi (+ (* (+ (/ (* 2pi mm) isx) kx) xx) (* (+ (/ (* 2pi nn) isy)
ky) yy)
(* 2pi (vector-ref phig count) ) ) )
(set! amp (+ amp (exp (* 0+1i phi))))
(set! count (+ count 1))
)
)
;source append part
(set! sources
(append sources (list
(make source (src (make continuous-src (frequency fcen)
(start-time 0.1) (end-time (+ 0.1 dt)) ))
(component Hz) (center xx yy) (amplitude amp)
))
)
)
))
------------------------------------------------------------
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss