So currently the only solution is NOT to define the geometry within a function 
and just include everything inside the loop, this works (but can have some 
limitations). Steven why does it work with MPB but not Meep?

Thanks,

Fred

On Aug 13 2007, F.S.F. Brossard wrote:

>Hi Sean,
>
>Thanks but this does not seem to work neither, still the same error message. 
>Also, why would you change the source?
>
>Cheers,
>
>Fred
>
>
>On Aug 9 2007, Sean Hennessee wrote:
>
>>The way I do stuff like this would be:
>>
>>(define (structure r-local)
>>              (append
>>                      (list (make block (center 0) (size sx sy h)
>>                              (material (make dielectric (index n)))))
>>                      (geometric-objects-lattice-duplicates
>>                              (list
>>                              (make cylinder (center 0) (radius r-local) 
>> (height h)
>>                              (material air))))))
>>
>>(do ((r rstart (+ r rstep))) ((> r rstop))
>>
>>                      (set! geometry (structure r))
>>
>>                      (run-until 200 (at-beginning output-epsilon)))
>>
>>However from the look of your error message, I would consider using the 
>>functions restart-fields, and change-sources! within the loop.
>>
>>>From: "F.S.F. Brossard" <[EMAIL PROTECTED]>
>>>To: meep-discuss <[email protected]>
>>>Subject: [Meep-discuss] Error new-meep-fields
>>>Date: 09 Aug 2007 13:00:29 +0100
>>>
>>>Hi Steven and Meep users,
>>>
>>>I would like to implement a loop in Meep in order to calculate the Q, 
>>>frequency, etc of a cavity for different values of hole radius for example. 
>>>In MPB, I first define the structure in a function such as
>>>(define (structure r) (set! geometry...)) then  create a (do loop for 
>>>different values of r) in which I call the function (structure r) and call 
>>>(run-te) within the loop and it works fine. However in Meep an error is 
>>>returned:
>>>In procedure new-meep-fields:
>>>No matching method for generic function 'new_meep_fields'
>>>It seems that in meep we can't define the geometry within a function in the 
>>>same way as in MPB, so what is the correct procedure?
>>>
>>>Below is an example in meep which fails, the run function is just a test 
>>>(no source).
>>>
>>>Thanks for your help,
>>>
>>>Fred
>>>
>>>; square lattice
>>>
>>>; define cell size
>>>
>>>(define-param sx 8)
>>>(define-param sy 6)
>>>(define-param sz 3)
>>>(define-param res 20) ; resolution
>>>
>>>(define-param h 0.75) ; thickness of waveguide
>>>(define-param r 0.2) ; radius of holes
>>>(define-param n 3.46) ; index of waveguide
>>>
>>>(define rstart 0.2)
>>>(define rstep 0.05)
>>>(define rstop 0.3)
>>>
>>>(set! eps-averaging? false)
>>>
>>>(set! geometry-lattice (make lattice (size sx sy sz)))
>>>
>>>; define periodic array
>>>
>>>(define (structure r)
>>>
>>>     (set! geometry
>>>             (append
>>>                     (list (make block (center 0) (size sx sy h)
>>>                             (material (make dielectric (index n)))))
>>>                     (geometric-objects-lattice-duplicates
>>>                             (list
>>>                             (make cylinder (center 0) (radius r) (height h)
>>>                             (material air)))))))
>>>
>>>
>>>
>>>(set! k-point (vector3 0))
>>>
>>>(set-param! resolution 20)
>>>
>>>; set-up symmetry
>>>
>>>(set! symmetries (list (make mirror-sym (direction Y) (phase -1))
>>>                                     (make mirror-sym (direction X) (phase 
>>> -1))))
>>>
>>>(do ((r rstart (+ r rstep))) ((> r rstop))
>>>
>>>                     (structure r)
>>>
>>>                     (run-until 200 (at-beginning output-epsilon)))
>>>
>>>
>>>--
>>>Frederic Brossard
>>>Hitachi Cambridge Laboratory
>>>Cavendish Laboratory
>>>J J Thomson Avenue
>>>Cambridge CB3 0HE
>>>
>>>
>>>_______________________________________________
>>>meep-discuss mailing list
>>>[email protected]
>>>http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
>>
>>_________________________________________________________________
>>Booking a flight? Know when to buy with airfare predictions on MSN Travel. 
>>http://travel.msn.com/Articles/aboutfarecast.aspx&ocid=T001MSN25A07001
>>
>>
>>_______________________________________________
>>meep-discuss mailing list
>>[email protected]
>>http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
>>
>
>

-- 
Frederic Brossard
Hitachi Cambridge Laboratory
Cavendish Laboratory
J J Thomson Avenue
Cambridge CB3 0HE



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

Reply via email to