On 10/24/2011 06:37 PM, Forrester A. wrote:
Hello

I have been trying to run a meep simulation using the ctl file below
without success.

When I try to run it I get the error message

"Wrong type of argument in position 2: 0"

I have tried to figure out what's going on, but all I have managed to
figure out is that it has something to do with the set! geometry code.

If anyone could explain what's going on that would be extremely helpful.

My ctl file:

; Some parameters to describe the geometry:
(define-param eps 13) ; dielectric constant of waveguide
(define-param yhex 8) ; size of hexagon in y
(define-param r 0.36) ; radius of holes


; The cell dimensions
(define-param sy 10) ; size of cell in y direction (perpendicular to
wvg.)
(define-param dpml 1) ; PML thickness

(define-param sx 16) ; size of cell in x direction

(define xhex (/ (* yhex 2) (+ 2 (sqrt 2))) ) ; 2yhex/(2+root2)

(define cx (/ yhex (+ 2 (sqrt 2)))) ; xcoord block centre

(define cy (* yhex (+ (/ 1 (+ 2 (* 2 (sqrt 2)) (/ 1 (+ 2 (sqrt 2)) ))
) )      ) ) ; yhex (1/(2+2root2) + 1/(root2 +2)) y coord block centre

(define block (/ yhex (+ 1 (sqrt 2))))

(set! geometry-lattice (make lattice (size sx sy no-size)))

(set! geometry
       (append
       (list
        (make block (center 0 0) (size xhex yhex infinity)
                   (material (make dielectric (epsilon eps))))
        (make block (center (* cx -1) cy) (size block block infinity)
                    (e1  1 -1 0) (e2 1 1 0) (material air))
        (make block (center cx cy) (size block block infinity)
                   (e1  1 1 0) (e2 1 -1 0) (material air))
        (make block (center (* cx -1) (* cy -1)) (size block block infinity)
                   (e1  1 1 0) (e2 1 -1 0)  (material air))
        (make block (center cx (* cy -1)) (size block block infinity)
                   (e1  1 -1 0) (e2 1 1 0) (material air))
        )
))

(set! pml-layers (list (make pml (thickness dpml))))
(set-param! resolution 20)

(define-param fcen 0.60) ; pulse center frequency
(define-param df 0.2)  ; pulse width (in frequency)

(set! sources (list
                (make source
                (src (make continuous-src
                        (wavelength fcen) (width df)))
                (component Ez)
                (center 0 0) (size 0.5 0.5)))
)



(use-output-directory)

(run-until (/ 100 fcen) (at-beginning output-epsilon) (at-every (/ 1
fcen 2) (synchronized-magnetic output-tot-pwr)))

Thanks,
Alan Forrester

Hi ho!

block is a name of geometric object. So don't use it to define numerical values, like this: (define block (/ yhex (+ 1 (sqrt 2)))).


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

Reply via email to