Dear Steven and meep users,

I did some further testing related to my post from January 7th and at this 
point I think that either there is something that I am doing completely 
wrong, or there might be a problem with using the variable "Dielectric" in 
integrate-field-function in meep 0.20.3.

I attach a simple test program that I created (see below). The geometry 
just a silicon slab with a hole in the middle. I excite the system with am 
Hz pulse. At the end, I calculate the integral of the sample function 
Ey*eps along a line.

If I use meep 0.10.1, everything works fine and I get a result. However, if 
I use exactly the same .ctl file with meep 0.20.3, the program exits when 
it tries to compute the integral.

The curious part is that if I compute the integral of Ey instead of Ey*eps, 
namely use the function

(define (f1 r ey) ey)   ; define sample function Ey*eps

(define (do-function) (set! Evar 
         (integrate-field-function (list Ey) f1 (volume (size size_l 0 0) 
(center 0))) ))

instead of the one in the file below, I get an answer with both meep 0.20.3 
and meep 0.10.1. If I run that function multiple times with meep 0.20.3, I 
always get the same answer, and if I run it multiple times with meep 
0.10.1, I always get the same answer as well, however these two answers 
from the different versions are different. This really puzzles me.

I also tried running the same control file on a supercomputer, which has 
meep-mpi installed on it. Again, I observe the same behavior. When a 
function involves "Dielectric" in it, if I use meep-mpi 0.20.3, the program 
exits with an error, and if I use meep-mpi 0.10.1, then the result is 
computed fine. When the function does not involve "Dielectric" in it, then 
both meep-mpi 0.20.3 and meep-mpi 0.10.1 produce a numerical result, 
however the results are different.

As an additional note, although the results from 0.20.3 and 0.10.1 are 
different, I get the same result using 0.20.3 no matter whether I use the 
supercomputer or my PC (the same is true for version 0.10.1).

I'm thinking that the differences between 0.20.3 and 0.10.1 can be 
explained with the fact that the two versions initialize the fields 
differently. However, I cannot find an explanation why 0.20.3 does not want 
to compute the result of function which include the variable "Dielectric". 
no matter whether I use my own PC or meep-mpi on a supercomputer.

If anyone has any suggestions, please let me know.

Sincerely,
George

PS. Here is the sample .ctl file which I am using:

(define Si (make dielectric (epsilon 11.9)))    ; create material silicon

(define-param ra 1)     ; radius of the hole
(define-param h 1)      ; thickness of the slab

(define-param pad 2)    ; padding
(define-param dpml 1)   ; dpml thickness

(define s (* 2 (+ ra pad dpml)))        ; size of the cell in x and y 
directions        
(define sz (+ h (* 2 (+ pad dpml))))    ; size of the cell in z direction

(set! geometry-lattice (make lattice (size s s sz)))

(define crystal_geometry (list
        (make block
                (center 0) (size infinity infinity h)
                (material Si)
        )
        (make cylinder
                (center 0) (height infinity)    
                (radius ra) (material air)
        )
))

(set! geometry crystal_geometry)
(set! pml-layers (list (make pml (thickness dpml))))

(set-param! resolution 5)
(set! eps-averaging? false)

(set! sources (list
        (make source
                (src (make gaussian-src (frequency 0.4) (fwidth 0.1)))
                (component Hz) (center 0.17 0 0)
        )
))

(set! symmetries (list
        (make mirror-sym (direction Y) (phase -1))
        (make mirror-sym (direction Z))
))

; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
; sample simple function with integrate-filed-function
; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(define Evar 0)         ; sample function to compute

(define size_l (+ (* 2 ra) pad))        ; length of the integral

(define (f1 r ey eps) (* ey eps))       ; define sample function Ey*eps

(define (do-function) (set! Evar 
         (integrate-field-function (list Ey Dielectric) f1 (volume (size 
size_l 0 0) (center 0))) ))

(define (print-all) (list (print "Evar = "  Evar  "\n")))

; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(run-sources+ 50
        (at-beginning output-epsilon)
        (at-end print-all do-function print-all)
)

On Jan 7 2009, G. O. Nikiforov wrote:

>Dear Steven and meep users,
>
>I have a question regarding the MEEP field-function examples as given in
>
>http://ab-initio.mit.edu/wiki/index.php/Meep_field-function_examples
>
>On  my personal computer I have meep 0.10 and on a cluster computer I 
>have access to meep-mpi 0.20-3. When I run the example functions from 
>the above website, they work just fine on meep 0.10, namely
>
>> (define (f r ex hz eps)
>>    (- (+ (* (vector3-x r) (vector3-norm r)) ex) (* eps hz)))
>> (print "The integral of our weird function is: "
>>        (integrate-field-function (list Ex Hz Dielectric) f) "\n")
>
>
>gives a number as a result. However, when I run the same code on the 
>cluster computer, I get "##,###,##i" instead of a number. If I remove 
>the dependence of the function on "Dielectric", then everything works 
>fine on the cluster computer as well:
>
>> (define (f r ex hz)
>>    (- (+ (* (vector3-x r) (vector3-norm r)) ex) h)))
>> (print "The integral of our weird function is: "
>>        (integrate-field-function (list Ex Hz) f) "\n")
>
>Could it be that meep 0.20-3 has problems with "Dielectric"? (I'm still 
>in the process of trying to install 0.20 on my own computer to do do the 
>testing) Or is it the fact that on the cluster I am using meep-mpi?
>
>I checked the Meep release notes 
>(http://ab-initio.mit.edu/wiki/index.php/Meep_release_notes) and found 
>out that in meep 0.20, the following change was made: <Renamed 
>"|dielectric|" to "|medium|" in libctl interface,> That is why in the 
>above code, I tried using "Medium" instead of "Dielectric", however in 
>that case Meep exits with an error saying that "Medium" is an unbound 
>variable.
>
>Any suggestions will be greatly appreciated.
>
>As a side question, on the same field-function example website above the 
>following example is given:
>
>> (print "The integral of our weird function from (-1,0,0) to (1,0,0) is: "
>>        (integrate-field-function (list Ex Hz Dielectric) f (volume 
>> (size 1 0 0) (center 0 0 0))) "\n")
>>   
>My question is if (volume (size 1 0 0) (center 0 0 0)), doesn't that 
>give the integral from (-0.5, 0, 0) to (0.5, 0, 0) as opposed to (-1, 0, 
>0) to (1, 0, 0)? I was just wondering if that is a typo, or a 
>misunderstanding on my part.
>
>Thanks a lot,
>George
>
>_______________________________________________
>meep-discuss mailing list
>[email protected]
>http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
>


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

Reply via email to