Re: [Meep-discuss] time-averaged magnetic field amplitude

2008-06-18 Thread matt




Neat, thanks!

For the time average amplitude of a complex field, I changed the 
convert-h5 function as shown below.  It's very hokey because the field 
component is hard-coded into the function, but it works.  Also, it's not 
really an average but rather a sum, which is okay if you just want a 
pretty picture.


(define (convert-complex-h5 rm? convert-cmd . step-funcs)
   (define (convert fname)
 (if (and rm? (zero? (system (string-append convert-cmd  \ fname 
:hz.i\ \ fname :hz.r\
 (system (string-append rm \ fname \
   (lambda (to-do)
 (let ((hooksave output-h5-hook))
   (set! output-h5-hook convert)
   (map (lambda (f) (eval-step-func f to-do)) step-funcs)
   (set! output-h5-hook hooksave


(define (complex-time-avg fname step-func)
   (let ((first-step? true))
 (lambda (to-do)
   (if first-step?
 (begin ; just copy the output file to fname
(set! first-step? false)
((convert-complex-h5 true
  (string-append h5math -e \sqrt(d1*d1 + 
d2*d2)\  fname )
  step-func) to-do))
;; otherwise, add the output file to fname
((convert-complex-h5 true
  (string-append h5math -e \d1 + sqrt(d2*d2 + 
d3*d3)\  fname   fname )
  step-func) to-do)




On Tue, 17 Jun 2008, Steven G. Johnson wrote:

 On Jun 17, 2008, at 5:37 AM, matt wrote:
 I want meep to output the amplitude of the complex time-average
 magnetic
 field over the computation domain, as an h5 file.


 See e.g.

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

 but I'm not looking for for the instantaneous magnetic field.  I'm
 also
 not interested in the time-average flux or energy, which I could with
 flux-in-box or field-energy-in-box.

 Those two only give you time averages if you have time-harmonic
 complex fields (i.e. a CW source, with force-complex-fields?=true, and
 have waited for transients to disappear).

 But in the case of a time-harmonic source, the time-average field is
 simply zero.

 Steven

 ___
 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


[Meep-discuss] Question on h5tovtk

2008-06-18 Thread Alexander Sprafke
Dear Steven and meep community,

I created a hdf5-file with all E-field components using

...
(to-appended e (at-every 0.5 output-efield))
...

this seems to work, since h5ls gives:

h5ls test-e.h5
ex   Dataset {50, 50, 50, 200/Inf}
ey   Dataset {50, 50, 50, 200/Inf}
ez   Dataset {50, 50, 50, 200/Inf}

Now I want to convert this hdf5-file into the vtk format, a vector vtk  
file for mayavi (to get a vector plot with arrows), using

h5tovtk -t 150 -o test.vtk test-e.h5

But the produced vtk-file just contains the Ex component:
In Mayavi I can only choose to visualize ex, also the header of  
test.vtk is:

# vtk DataFile Version 2.0
Generated by h5tovtk.
BINARY
DATASET STRUCTURED_POINTS
DIMENSIONS 50 50 50
ORIGIN 0 0 0
SPACING 1 1 1
POINT_DATA 125000
SCALARS ex float 1--- shouldn't this be different if it was a  
vector vtk?
LOOKUP_TABLE default

What am I doing wrong?
Thank you very much for your help in advance!

Regards
Alex


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


[Meep-discuss] meep symmetry and looping

2008-06-18 Thread G. O. Nikiforov
Dear Steven and meep users,

I have two questions.

1. Regarding symmetry: if I have a symmetric slab lying in the z=0 plane 
and place a Gaussian Hz source at (0, 0, 0), then I can exploit the 
following symmetries

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

Right? However, when I run meep once exploiting symmetries and once 
without I get slightly different results (the frequencies and Q values 
of the identified modes are different within 1% or so, and in addition, 
when I run the program with symmetries I identify a couple of extra 
modes of low Q values). Why is that? I'm thinking that this is a 
numerical artefact, however I just wanted to check if I have 
misunderstood the symmetry principles.

2. If I want to optimize the structure using different slab thickness 
and so on, I have to write a loop, which runs through the different 
parameters. I use (restart-fields) in order to reinitialize the fields, 
however is there an analogous function to reinitialize the epsilon 
geometry? Or would it be enough to overwrite whatever I have with air 
and then start anew? In addition, the output files at every loop 
iteration have the same names. For example, the structure file is always 
called eps-00.00.h5. Is there a way to have a different prefix for 
the output files for different loop iterations in order for the data not 
to get overwritten every time?

Thanks a lot in advance,
George

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