[Meep-discuss] Question about using map to set up object with any shapes

2007-06-27 Thread adrian
Hi everyone:
   I refer to one of archives as below to build up the
object:

On Tue, 14 Nov 2006, Pascual Munoz Munoz wrote:
> I've been looking to the 'loop' howto on the wiki,
but I cannot manage
> how to make a loop that makes a list of objects in
different positions
> and with different widths, depending on the loop
variable.
>
> I've tried several things, the one making more sense
to me (but not
> working) is (not changing the width of the slices):
> (set! geometry
>(list
>(make block (center 0 0) (size W L)
>(material (make dielectric
(index nde
>(do ((x (* -1 Gp) (+ x 1))) ((> x
Gp))
>(make block (center 0 (* x
0.12)) (size W 0.12)
>(material (make
dielectric (index
> 1.0 ) ) )

A "do" loop does not return a list of objects, which
is what you want to 
do here.

   To create a list, the easiest thing is to use
"map".  For example,

(set! geometry
   (cons
(make block (center 0 0) (size W L)
  (material (make dielectric (index
nde
(map
 (lambda (x)
   (make block (center 0 (* x 0.12)) (size W
0.12)
 (material (make
dielectric (index 1.0)
 (arith-sequence (- Gp) 1 (round (+ (* 2 Gp)
1))

Of course, this does not change the width of the
slices (they are all W), 
but neither does your example.  You can easily
substitute some arbitrary 
function of x here.

(Note that (cons a B) prepends an element "a" to the
list "B".)


   It works pretty well. But I found out within map,
it can only make one object. If I want to make another
object,i.e. different epsilon and shape but related to
x, the previous one won't be executed but only the
later. 
  e.g.:
   ( map
(lambda (x)
  (make block )
  (make cylinder)
 ...
   the block won't be produced.
   can anyone give me any hint to build up more than
two objects with any shape using map?
   Thank you very much!

Adrian

   



  

想及時通知通訊錄裡的所有親朋好友好消息,就來 Yahoo!奇摩電子信箱發簡訊!
http://tw.mobile.yahoo.com/texts/mail.php

___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Re: [Meep-discuss] unwanted dispersive behavior?

2007-06-27 Thread matt


I'm happy that I found the problem, but extremely embarassed at my 
mistake and how long it took me to find it.

I mistakenly used index of refraction data in place of permittivity 
data.  Maybe I should consider a career in the aerospace industry.

Thanks again for your help.

Best Regards,
Matt



On Wed, 27 Jun 2007, matt wrote:

>
>
> That's not it.  I set the resolution early in the script, and I'm able
> to confirm via h5ls that increasing the resolution in the script
> increases the size of problem.
>
> Best,
> Matt
>
>> The problem turned out to be that they were calling (set! resolution ...)
>> too late in the file.  When you call add-flux to add a flux plane the
>> fields are initialized and the resolution etc. is set; changing the
>> resolution etc. after that point has no effect (unless you call
>> reset-meep! or similar).  Perhaps your problem is similar?
>>
>
> ___
> meep-discuss mailing list
> meep-discuss@ab-initio.mit.edu
> http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
>

___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss


Re: [Meep-discuss] unwanted dispersive behavior?

2007-06-27 Thread matt


That's not it.  I set the resolution early in the script, and I'm able 
to confirm via h5ls that increasing the resolution in the script 
increases the size of problem.

Best,
Matt

> The problem turned out to be that they were calling (set! resolution ...)
> too late in the file.  When you call add-flux to add a flux plane the
> fields are initialized and the resolution etc. is set; changing the
> resolution etc. after that point has no effect (unless you call
> reset-meep! or similar).  Perhaps your problem is similar?
>

___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss


Re: [Meep-discuss] unwanted dispersive behavior?

2007-06-27 Thread Steven G. Johnson
On Wed, 27 Jun 2007, matt wrote:
> I'm solving a simple multilayer loss-free dielectric slab scattering problem, 
> for the case of normal incidence.
>
> The problem is simple enough that it can be solved analytically.  The 
> analytic solution matches published results, so I have confidence in its 
> correctness.
>
> As you can see in the attached plot, the resonance in the reflectivity is 
> frequency shifted by about 10 percent, and the scaling isn't quite right.

Hi Matt,

The Meep solution should definitely converge to the exact result as you 
increase resolution etc.  (In fact, transmission through a multilayer film 
is one of the test cases: see tests/bragg_transmission.cpp.)

Someone posted with a similar problem in March - they were comparing the 
transmission through a thin film to the analytical formula, and weren't 
getting convergence:


http://thread.gmane.org/gmane.comp.science.electromagnetism.meep.general/746

The problem turned out to be that they were calling (set! resolution ...) 
too late in the file.  When you call add-flux to add a flux plane the 
fields are initialized and the resolution etc. is set; changing the 
resolution etc. after that point has no effect (unless you call 
reset-meep! or similar).  Perhaps your problem is similar?

Regards,
Steven G. Johnson

___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss


[Meep-discuss] unwanted dispersive behavior?

2007-06-27 Thread matt




Hello,

I'm solving a simple multilayer loss-free dielectric slab scattering 
problem, for the case of normal incidence.


The problem is simple enough that it can be solved analytically.  The 
analytic solution matches published results, so I have confidence in its 
correctness.


As you can see in the attached plot, the resonance in the reflectivity 
is frequency shifted by about 10 percent, and the scaling isn't quite 
right.


The meep result doesn't change when I
1) increase the resolution
2) calculate over a more narrowband frequency range
3) increase pml thickness
4) increase spacing between scatterer and flux planes
5) increase spacing between source and flux planes/scatterer
6) set eps-averaging? to false
7) increase "decay-by" (and run the sim longer)
8) change the gaussian excitation center frequency
9) change the gaussian excitation cutoff
10) calculate reflectivity based on a flux point instead of a flux plane


Just looking at the curve width make me think there's some kind of 
dispersive behavior, but I have no idea where it could be coming from. 
Any ideas?


Best Regards,
Matt



compare.png
Description: meep_vs_analytic
___
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss