Hello MEEP Users,
I am trying to make a gaussian pulse train. So far I am successful in
creating one single pulse, but can't generate a pulse train. I have
attached the code and a bash file.
Make the code run by typing "bash run.sh" in the terminal.
If you remove semicolon before the gaussian-src line, you can see one
pulse travelling in -ve x-direction.
Whereas if you remove the semicolon before custom-src line, the pulse
train is not formed.
Thanks,
Jitendra
#!/bin/bash
time meep 2D.ctl &> 2D.out
cd 2D-out
h5topng -S3 -t 0:49 -Zc dkbluered -d electric-function.r enorm.h5
convert enorm.t*.png Enorm.gif
(reset-meep)
(set-param! resolution 5)
(define-param dpml 3.0); length scale is 1.0 micrometer
(define-param len (+ 34 dpml dpml))
(define-param wid (+ 34 dpml dpml))
(define-param wcen 0.8)
(define-param dw 3)
(define-param fcen (/ 1 wcen))
(define-param df (/ 1 dw))
(define-param k (vector3 1 0 0)) ; choosing direction
(define-param s 2) ; for width of pulse
(define-param w 0.1) ; for spatial width
(define (my-src width)
(lambda (t)
(exp (- 0 (/ (* t t) (* 2 width width))))
)
)
(define (my-amp sig k)
(lambda (x)
(exp (- (* 0+2i pi (vector3-dot k x))
(/ (vector3-dot x x) (* 2.0 sig
sig)s)
)
)
)
)
(set! geometry-lattice (make lattice (size len wid no-size)))
(set! pml-layers (list
(make absorber (thickness dpml))
))
(set! sources(list
(make source
; (src (make custom-src (src-func (my-src
w))))
(src (make gaussian-src (frequency
fcen)(fwidth df)))
(center 17 0)(size 0 34)(component Ez)
(amp-func (my-amp s k))
)
))
(init-fields)
(define (f_e r ex ey ez)
(sqrt (+ (* ex ex) (* ey ey) (* ez ez)))
)
(define (electric-output)
(output-field-function "electric-function" (list Ex Ey
Ez) f_e)
)
(use-output-directory)
(run-until 50 (to-appended "enorm" (at-every 1 electric-output)))
(meep-all-wait)
_______________________________________________
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss