Hello,

I use the following code snippet to generate a Gaussian (spatial) + sin**2
(time) source, also taken from this list and adapted. It's pretty
self-explanatory, maybe you find it useful. It generates a (focus of a)
gaussian beam of width 1 in +y direction.

Regards,
  Georg


; %%%%%%%%%%%% source %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  (define-param phasephi 0.500)
; spatial dependence - gaussian
(define ((my-amp sigma k) x)
  (exp (- (* 0+2i pi (vector3-dot k x))
  (/ (vector3-dot x x) (* 2 sigma sigma)))))
; time dependence
(define (laser_2 t)
  (define tau 1.9486509 )  ; 6.5 fs
  (define frequency 1.25)  ; 800 nm
  (define phase (* 2 pi (+ 0.50 0.25 phasephi) )) ; cosine+=0.
  (if (< t (* 2 tau) )
      (* (sin (+ (* 2 pi frequency (- t tau) ) phase)) 1.  (expt (sin (/ (*
pi t) (* 2 tau)) ) 2) )
      0.
  )
)

(set! sources (list
      ; "laser"
                (make source
                  (src (make custom-src (src-func laser_2)) )
                  (component Ex) (center 0 0 )
          (size 06 00 05.5) (amplitude 1.)               ; size (and box)
should be > width!
          (amp-func (my-amp 1. (vector3 0 1 0)))  ; set width here
                )
     ;  the second source is for aesthetic reasons, to cancel the "beam" in
-y direction
                (make source
                  (src (make custom-src (src-func laser_2)) )
                  (component Hz) (center 0 0)
              (size 06 00 05.5) (amplitude -1.)
              (amp-func (my-amp 1.  (vector3 0 1 0)))
                )
              )

)




On Wed, Jan 26, 2011 at 2:58 PM, Geethaka Devendra <gcdeven...@gmail.com>wrote:

> Hi Prof Steven and Meep users,
>
> Can someone please give me an example how to use the amp-func of the source
> to generate a gaussian source, which has a gaussian spatial profile. I read
> some of the earlier posts about using the amp-func, but didn't really
> understand the concept with k-vector and width. Can someone please explain
> me this and possibly show me an example, I think this feature of the source
> is really handy, but not knowing how to use is most frustrating.
>
> Thanks alot
> Geeth
>
> _______________________________________________
> meep-discuss mailing list
> meep-discuss@ab-initio.mit.edu
> http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
>
_______________________________________________
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to