Steven G. Johnson wrote:
On Sun, 30 Apr 2006, X. Y. AO wrote:

How to define a source to generate a beam (e.g. tilted Gaussian beam in free space) in meep?


Just provide an amplitude function (amp-func property) that gives the field amplitude as a function of space to make a Gaussian envelope. To tilt the beam, add an exp(ikx) phase. e.g. do:

(define ((my-amp sigma k) x)
   (exp (- (* 0+2i pi (vector3-dot k x))
           (/ (vector3-dot x x) (* 2 sigma sigma)))))

and then create a source with (amp-func (my-amp s k)) where you pass it the desired width s and k-vector k.

(Note that the syntax (define ((foo x) y) ...) defines a function (foo x) that returns a function of y.)

Cordially,
Steven G. Johnson
Hi Steven:
Could you give a breif corresponsding part to c++ interface if possible? How can I use self defiend source amplitude function in c++ interface?

I want to compute a ATR prism with Gaussian beam in 2D.

Thanks,

Regards,
Paul




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

Reply via email to