Hi Andrew,
There is an easier and more elegant way to do this using meep sources
with non-point sizes (lines in 2d or surfaces in 3d).
To make a line source in meep, you just specify the source to have some
width (for periodic structures it is usually the lattice width). You
then specify an amplitude function that varies along the line.
See this thread:
http://www.mail-archive.com/[email protected]/msg01270.html
That thread discusses planewaves and not beams, but you can do the same
thing and use your amplitude function instead. That saves you the
trouble of making a loop and creating a large number of sources in the
source list.
Best,
Matt
On Mon, 16 Nov 2009, Andrew York wrote:
I needed a tilted, pulsed beam in one of my meep simulations, and I noticed
a few others on the mailing list have asked for something similar. I decided
to make my tilted-beam source out of a bunch of point sources, and it seemed
to work pretty well. Hopefully someone else finds this useful, or points out
an improvement. Here is my code:
(define-param pi 3.14159265)
(define-param dpml 3.0)
(define-param len (+ 20 dpml))
(define-param wid (+ 20 dpml))
(set! geometry-lattice (make lattice (size len wid no-size)))
(define-param beam-waist 2.5) ; beam sigma (gaussian beam width)
(define-param rotation-angle (* (/ 22.5 360) 2 pi)) ; Degrees if you like
them
(define-param source-points 60) ; should be a big number
(define-param source-size (* 4 beam-waist)) ; should be bigger than
beam-waist
(define-param src_list (list ))
(do
((
r_0
(/ source-size -2)
(+ r_0 (/ source-size (- source-points 1)))
))
((> r_0 (/ source-size 2)))
;for r_0 = -source-size/2 : source-size/source-points : source-size/2
(set! src_list (append src_list
(list (make source
(src (make gaussian-src
(wavelength 1)
(width 3)
))
(amplitude (exp (- 0 (/ (* r_0 r_0) (* 2 beam-waist beam-waist)))))
(component Ez)
(center (* r_0 (sin rotation-angle)) (* r_0 (cos rotation-angle)))
))
))
)
(set! sources src_list)
(set! pml-layers (list (make pml
(thickness dpml)
)))
(set! resolution 10)
(use-output-directory)
(run-until (* 2 len)
(to-appended "ez" (at-every 0.1 output-efield-z))
)
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss