Hello meep-discussion list,

I'm trying to simulate a 3D rectangular waveguide (one could say I 
should do it in 2D but it's just some steps from what I really want to 
do...). My .ctl - file looks a follows (I'm not sure if I messed with 
the meep units and the cutoff freqeuncy):

------------------snip----------------------------------------------------------

; define some constants and measures
(define-param length_z 24) ; already added some space for pml
(define-param width_x 7)
(define-param height_y 1)
(define-param pml-size 2.0)
(define-param inner_block 5)
(define-param inner_eps 4)
(define-param center_freq 0.5) ; with a = 1m and c = 1 I get w_c = 
pi*c/width_x < 0.5
(define-param freq-samples 25)
(define-param df 0.1)

; create a lattice with proper size
(set! geometry-lattice (make lattice (size width_x height_y length_z)))

(define-param no-block? false) ; to get transmission spectra one can set 
this variable from the command-line

(set! geometry
(if no-block? ;if the variable is set from outside there are two 
implementations!
  (list
   (make block
    (center 0 0)
    (size width_x height_y length_z)
    (material (make dielectric (epsilon 1)))))
  (list
   (make block
    (center 0 0)
    (size width_x height_y length_z)
    (material (make dielectric (epsilon 1))))
   (make block
    (center 0 0)
    (size width_x height_y inner_block)
    (material (make dielectric (epsilon inner_eps)))))))

(define-param absolute-flux-position (-(- (/ length_z 2) 1) pml-size) )

; create a source
(set! sources (list (make source
                 (src (make gaussian-src
                  (frequency center_freq)(width 6)))
                  (component Ey)
                  (center (+ absolute-flux-position 1) 0)
                  (size 0 (* height_y 0.95) 0)))); this source should 
not touch the boundaries

; apply the pml in z - direction (the others will be handled later)
(set! pml-layers
  (list
   (make pml (thickness pml-size) (direction Z))
   (make pml (thickness 0) (direction X)); electric boundary in X direction
   (make pml (thickness 0) (direction Y)))) ; electric boundary in Y 
direction

; create Flux planes (like ports, but no input!)
(define trans ; transmitted flux
       (add-flux center_freq df freq-samples
                 (make flux-region
                      (center 0 0 absolute-flux-position)
                       (size width_x height_y 0))))
(define refl ; reflected flux
       (add-flux center_freq df freq-samples
                  (make flux-region
                    (center 0 0 (- absolute-flux-position 0))
                    (size width_x height_y 0))))

; boundary conditions for hollow guide
;(init-fields) ; fields need no init if fluxes added before; not sure if 
those are needed (all metallic)
;(meep-fields-set-boundary fields High Y Metallic)
;(meep-fields-set-boundary fields Low  Y Metallic)
;(meep-fields-set-boundary fields High X Metallic)
;(meep-fields-set-boundary fields Low  X Metallic)

; set the resolution to some value
(set! resolution 20)

; if there is an older computation load the spectrum for the input 
(produces bad error when file not there!)
(if (not no-block?) (load-minus-flux "refl-flux" refl))

; really start the simulation
(run-sources+ 100
   (at-beginning output-epsilon)
   (to-appended "ey" (at-every 0.6 output-efield-y)))

; save the flux for later transmission tricks
(if no-block? (save-flux "refl-flux" refl))

; show the values to get them into matlab
(display-fluxes trans refl)

--------------------snap-----------------------------------------------

so far this script is partly adopted from the tutorial's page. Now 
running this script with:

~> meep no-block?=true waveguide.ctl | tee out.log

and extracting some graphics via

~> h5topng -0y0 -t 100 -Zc bluered waveguide-ey.h5 -o Pic_y.png

I only get black bricks (the same for x and z direction) in 
Pic_x,y,z.png. Whats my mistake? Is the source somehow not working 
right? I think putting in a single e_y component sould somehow exite the 
TE_10 - Mode. Any Ideas? Thanks in advance for your help,

greetings

Tobias

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

Reply via email to