Dear Meep users,

The subject of 3D plane waves seems to have been discussed here before, but
I have some trouble implementing it.
In a previous discussion, three methods for generating 2D plane waves have
been presented.

For the two methods mentioned here
http://ab-initio.mit.edu/pipermail/meep-discuss/2007-December/001280.html ,
codes have been presented by Steven (where multiple sources are needed in
the 3D case), and by Matt and Ashifi (using one source and periodic boundary
conditions)

I modified their codes to try to generate 3D plane waves.

The code that appears below creates a wave that propagates in the Z
direction, with periodic Ey, Hx and Hz components and (almost) zero Ex, Ez
and Hy components.
That means that is could have been a plane wave, if only the Hz component
would be zero

Perhaps someone has a hint how to do this correctly?

best, avner

;;________________________________________________________________________________

(use-output-directory)            ; put all output in a new directory
(define-param source-component Ey) ; field component to use

(define-param kdir (vector3 1 0 0)) ;direction of PW equal phase lines

(define-param fcen 0.8) ; pulse center frequency
(define-param df 0.02) ; turn-on bandwidth
(define wlength (/ 1 fcen)) ; pulse wavelength

(define-param sxy 8) ; the size of the comp cell in X and Y, not including
PML
(define-param dpml 3) ; thickness of PML layers

; set periodicity in the X direction. The PML takes care of the
; non-desired Y periodicity that comes for free with the k-point declaration
(set! k-point (vector3 0 0 0))
(set! ensure-periodicity true)

(define sz (+ sxy (* 2 dpml))) ; cell size in Z direction, including PML
(set! geometry-lattice (make lattice (size sxy sxy sz)))

; we'll only have PML in the Y direction (top and bottom)
(set! pml-layers (list (make pml (thickness dpml) (direction Z))))

(set-param! resolution 5)

; pw-amp is a function that returns the amplitude exp(ik(x+x0)) at a
; given point x.  (We need the x0 because current amplitude functions
; in Meep are defined relative to the center of the current source,
; whereas we want a fixed origin.)  Actually, it is a function of k
; and x0 that returns a function of x ...
(define ((pw-amp k x0) x)
  (exp (* 0+1i (vector3-dot k (vector3+ x x0)))))

; k with correct length
(define k (vector3-scale (* 2 pi fcen) (unit-vector3 kdir)))

(set! sources (list
        (make source
     (src (make continuous-src (frequency fcen) (fwidth df)))
     (component source-component) (center (* -0.5 sxy) (* -0.5 sxy) (*
-0.5sxy) ) (size sxy sxy)
     (amp-func (pw-amp k (vector3  (* -0.5 sxy) (* -0.5 sxy) (* -0.5sxy)))))
))

(run-until 40
(at-end output-efield-z output-efield-y output-efield-x output-hfield-x
output-hfield-y output-hfield-z))


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

Reply via email to