I guess your problem is that this: ((* dx -1) center 0) should be this:
(center (* dx -1) 0)
I'm not sure if you want the lattice-duplicates function; that would
fill the whole lattice with duplicates. If that is not what you want,
an alternative is to define a column of cylinders using one cylinder and
one call to geometric-object-duplicates, then define several columns by
wrapping that in a call to geometric-objects-duplicates (with an s).
Best,
Matt
On Sun, 7 Jun 2009, Tenner S Lee wrote:
Hi,
I just started using meep in order to do some simulations on photonic
crystals while away from campus. Meep so far is a very diverse and
useful tool, unfortunately i am having a hard time reading the
reference page. I am unable to debug my error that i am getting even
after reading though the mailing archive and examining the tutorial
syntax.
The error that i am getting is Error: wrong type to apply -3.84211. My
code is down below any help would be greatly appreciated. To be
specific the error occurs when i am generating my source and
specifying the center of the source. Academically i am more worried
about why i am getting this error rather then the error itself ^^ i
would love to hear an explaination and how you were able to deduce it
=D thank you. Also if you see any other errors it would be great to
hear of them.
(set! sources (list (make source (src (make gaussian-src (frequency fcen)
(fwidth df)))
(component Ey) ((* dx -1) center 0) (size 0 r))))
** Also i am definitely sure my code is very inefficent any tips on
generating periodic 2D or 3D structures would help alot. I noticed
that there is a geometric-objects-lattice-duplicate function that i
should be using but the generation of the lattice on a supercell
eludes me. Thank you again for any help. Any other reference on
generating photonic crystal structures using MEEP would help alot. I
am currently reading the textbook specified on the MEEP website but do
not see any reference to coding.
Sorry i hope i dont seem to be too pushy. Thanks for the help in
advance again.
Thank you,
Tenner Lee
; set the size of the simulation cell
(define-param sx (+ (* (+ 4 5 1) 2) 3)) ; size of cell in the x direction
2*(dx+n/2+pml)+2
(define-param sy (+ (* (+ 4 5 1) 2) 3)) ; size of cell in the y direction
2*(dx+n/2+pml)+2
(set! geometry-lattice (make lattice (size sx sy no-size)))
; set the geometry of the 10x10 wire array
(define dx 3.84211) ; width of spacing of the photonic crystal in the x dir
1.168 mm
(define dy 3.84211) ; width of spacing of the photonic crystal in the y dir
1.168 mm
(define r 1) ; radius of metal wires .304 mm base unit
(define h infinity) ; height of wire
(define eps -1e10) ; material epsilon copper
(define n 10) ; size of wire array
(set! geometry (append
(list (make block (center 0 0) (size (- sx 1) (- sy 1) infinity)
(material air)))
(geometric-object-duplicates (vector3 dx 0) 0 (- n 1)
(make cylinder (center (/ dy 2) 0) (radius r)
(height h)
(material (make dielectric (epsilon eps)))))
(geometric-object-duplicates (vector3 dx 0) 0 (- n 1)
(make cylinder (center (* dy 1.5) 0) (radius r)
(height h)
(material (make dielectric (epsilon eps)))))
(geometric-object-duplicates (vector3 dx 0) 0 (- n 1)
(make cylinder (center (* dy 2.5) 0) (radius r)
(height h)
(material (make dielectric (epsilon eps)))))
(geometric-object-duplicates (vector3 dx 0) 0 (- n 1)
(make cylinder (center (* dy 3.5) 0) (radius r)
(height h)
(material (make dielectric (epsilon eps)))))
(geometric-object-duplicates (vector3 dx 0) 0 (- n 1)
(make cylinder (center (* dy 4.5) 0) (radius r)
(height h)
(material (make dielectric (epsilon eps)))))
(geometric-object-duplicates (vector3 dx 0) 0 (- n 1)
(make cylinder (center (/ dy -2) 0) (radius r)
(height h)
(material (make dielectric (epsilon eps)))))
(geometric-object-duplicates (vector3 dx 0) 0 (- n 1)
(make cylinder (center (* dy -1.5) 0) (radius r)
(height h)
(material (make dielectric (epsilon eps)))))
(geometric-object-duplicates (vector3 dx 0) 0 (- n 1)
(make cylinder (center (* dy -2.5) 0) (radius r)
(height h)
(material (make dielectric (epsilon eps)))))
(geometric-object-duplicates (vector3 dx 0) 0 (- n 1)
(make cylinder (center (* dy -3.5) 0) (radius r)
(height h)
(material (make dielectric (epsilon eps)))))
(geometric-object-duplicates (vector3 dx 0) 0 (- n 1)
(make cylinder (center (* dy -4.5) 0) (radius r)
(height h)
(material (make dielectric (epsilon eps)))))))
; set the source parameters
(define fcen 3.04) ; center frequency in base units r/(3e8/3e12)
(define df 3.04) ; width frequency in base units r/(3e8/3e12)
(define fn 500) ; number of frequencies to compute flux
(set! sources (list (make source (src (make gaussian-src (frequency fcen)
(fwidth df)))
(component Ey) ((* dx -1) center 0) (size 0 r))))
; set simulation parameters
(set! resolution 32) ; set the resolution should be a number equal to 2^n
(set! pml-layers (list (make pml (thickness 1.0)))) ; make pml layer
(define trans (add-flux fcen df fn (make flux-region ((+ (* dx 10) 1) center 0)
(size 0 (* r 2)))))
; run script
(run-sources+ (stop-when-fields-decayed 50 Ey (vector3 0 0) 1e-3)
(at-beginning output-epsilon)
(to-append "ey" (at-every 0.5 output-efield-y))
(display-fluxes) ; print out the flux spectrum
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss