Hi Guys,

I am a new comer in terms of Meep and Scheme language. I have a question
regarding the following program. In it I tried to construct a 1D photonic
crystal structure which is basically a solid waveguide with equally spaced
multiple air holes on it. This is a fairly easy structure but Meep kept
poping errors.  I tried to make cylinders multiple times using a do
construct but the program reported error. I checked my code and now I am
certain that one section of my code has errors but I really don't know how
to change it. I posted my code down and highlighted the error section in
red.Please view it and email me back telling me how I need to change it.

The error is: ERROR: Wrong type (expecting pair): #<unspecified>

Thanks a lot,
Ben



--------------------------------------------------------------------------------------------------

;;;a 1DPhC is composed of
;;;a straight waveguide with multiple periodical holes in it

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;paramters
;dielectric parameters
(define Si-epsilon 11.2)
(define air-epsilon 1)

;computational cell length and width, 2D simulation
(define comp-cell-len 100)
(define comp-cell-wid 20)

;pml boundary
(define pml-thickness 2)

;straight waveguide parameters
(define StraWG-len 200)
(define StraWG-wid 10)
(define StraWG-centerX 0)
(define StraWG-centerY 0)

;holes parameters
(define num-of-holes 5)
(define hole-radius 5)
(define hole-spacing 10)
(define first-hole-centerX (- 0 (* hole-spacing (/ (- num-of-holes 1) 2))))
(define hole-centerY StraWG-centerY)

;calculate hole-centerX as a list
(define hole-centerX (make-vector num-of-holes 0)) ;using vector data type
(define i 0) ;iteration mark
(do ((i 0 (+ i 1))) ((= i num-of-holes)) ;vertor index starts from 0
    (vector-set! hole-centerX i (+ first-hole-centerX (* i hole-spacing))))

;source parameters
(define freq 0.2)
(define source-centerX (+ (- StraWG-centerX (/ comp-cell-len 2))
pml-thickness))
(define source-centerY StraWG-centerY)
(define source-sizeX 0)
(define source-sizeY StraWG-wid)

;resolution
(define reso 20)

;running time and output step
(define run-time 20)
(define run-step 0.5)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(set! geometry-lattice
    (make lattice
        (size comp-cell-len comp-cell-wid no-size)))

(set! geometry
    (list
        (make block                                   ;straight waveguide
            (center StraWG-centerX StraWG-centerY)
            (size StraWG-len StraWG-wid infinity)
            (material
                (make dielectric
                    (epsilon Si-epsilon))))

        (do ((i 0 (+ i 1))) ((= i num-of-holes))    ;THIS SECTION HAS
PROBLEM!!!!
            (make cylinder                                ;air holes
                (center (vector-ref hole-centerX i) hole-centerY)
                (height infinity)
                (radius hole-radius)
                (material
                    (make dielectric
                        (epsilon air-epsilon)))))))

(set! pml-layers
    (list
        (make pml
            (thickness pml-thickness))))

(set! sources
    (list
        (make source
            (src
                (make continuous-src
                    (frequency freq)))
            (component Ez)
            (center source-centerX source-centerY)
            (size source-sizeX source-sizeY))))

(set! resolution reso)

(run-until run-time
    (at-beginning output-epsilon)
    (to-appended
        "ez"
        (at-every run-step output-efield-z)))
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to