Hello to all,

I want to simulate the transmission through a 3D PhC and I 'll use a source 
with a various directions (for example (111) direction). I try this guile code, 
but it doesn't works. 




.......
;-------------------------------------------------------------------------
;--------------------angles for calculating direction---------------------
;-------------------------------------------------------------------------
        
(define-param phi 45)           ;PHI: 0< phi < 360 
(define-param theta 45)         ;THETA: 0< theta < 180


;-------------------------------------------------------------------------
;---------Starting configuration for propagation and sourcefield----------
;-------------------------------------------------------------------------
        
(define prop (vector3 0 0 1))           ;Starting propagation vector
(define field (vector3 0 1 0))          ;Starting components of the sourcefield


;-------------------------------------------------------------------------
;----------------axis for the rotation of phi and theta-------------------
;-------------------------------------------------------------------------

(define axisp (vector3 0.0 1.0 0.0))    ;phi
(define axist (vector3 1.0 0.0 0.0))    ;theta


;-------------------------------------------------------------------------
;----------------------rotation of the startvectors-----------------------
;-------------------------------------------------------------------------
        
(define newprop (rotate-vector3 axisp (deg->rad phi) (rotate-vector3 axist 
(deg->rad theta) prop)))     ;Propagation    
(define newfield (rotate-vector3 axisp (deg->rad phi) (rotate-vector3 axist 
(deg->rad theta) field)))   ;Sourcefield



;-------------------------------------------------------------------------
;----------------------------Setup  k-vector --------------------------
;-------------------------------------------------------------------------

(define p1 (vector3-x newprop))
(define p2 (vector3-y newprop))
(define p3 (vector3-z newprop))

(define-param kdir (vector3 p1 p2 p3 )) ;direction of k (lenght is irrelevant)
(define k (vector3-scale (* 2 pi 0.2)(unit-vector3 kdir))) ;k with the correct 
lenght


;--------------------------------------------------------------------------
;-------------------------------- Sources ---------------------------------
;--------------------------------------------------------------------------

(define-param f_top (/ 0.9 (sqrt 2)))
(define-param f_bottom(/  0.3 (sqrt 2)))
(define w1 (* 2 pi f_bottom))
(define w2 (* 2 pi f_top))
(define f0 (/ (+ f_top f_bottom) 2))
(define sigma_f0 (- f_top f_bottom))
(define-param f_steps 1000)


(define e1 (vector3-x newfield))
(define e2 (vector3-y newfield))
(define e3 (vector3-z newfield))

(print "e1: "e1 "\n")
(print "e2: "e2 "\n")
(print "e3: "e3 "\n")

; boardband source (sync * window)  [This boardband source function works 
correctly]

(define ((flat_src f1 f2 on_time) t1)
(begin ;(print t1 "\n")
(let ((t (- t1 (/ on_time 2)))  (w1 (* 2 pi f1)) (w2 (* 2 pi f2)) )
        
(if (and (<= t1 on_time) (>= t1 0))
(*              0+1i (+ 0.42 (* 0+0.5i (cos (* 2 t1 pi (/ 1 on_time)))) (* 0.08 
(cos (* 4 t1 pi 
(/ 1 on_time)))))       ; zauber funktion alias blackman
                                (if (= t 0) (* 0+0.5i (- w1 w2))
                                                                (/ (- (exp (* 
0+1i w1 t)) (exp (* 0+1i w2 t))) (* 2 t))
                                                                ))
(+ 0 0))
                                                                )
                                                                )
)




;-------------------------
;-------------------------
;-------------------------


; sources for the e-field in Ex Ey Ez
(set! sources (list
               (make source
                (src    (make custom-src (end-time 200)
                                                (src-func (flat_src f_bottom 
f_top 200)  )))
                 (amplitude e1)
                 (component Ex)
                 (center 0 0 lzborder)
                 (size xsize ysize 0)
 )))
 (set! sources (list
               (make source
                (src    (make custom-src (end-time 200)
                                                (src-func (flat_src f_bottom 
f_top 200)  )))
                 (amplitude e2)
                 (component Ey)
                 (center 0 0 lzborder)
                 (size xsize ysize 0)
 )))
 (set! sources (list
               (make source
                (src    (make custom-src (end-time 200)
                                                (src-func (flat_src f_bottom 
f_top 200)  )))
                 (amplitude e3)
                 (component Ez)
                 (center 0 0 lzborder)
                 (size xsize ysize 0)
 )))
 
 

.................
I hope someone can help me, to solve the problem. 
Thanks in advance for your help.

Best regards 
    John



-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail

_______________________________________________
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