Dear Meep users:
I am trying to get the distribution of time-averaged E square. (I believe many
users will look for this feature.)
After modifying previously posted ctl files for output-field-function (Jan. 15,
2007) and for summing h5 files, I wrote an example ctl file below. But the
result e2_avg.h5 shows only 0. What is wrong with my ctl file?
S.K. Kim
; -----------------------------------------------------------------------------
; Lattice and Boundaries ------------------------------------------------------
(define-param sx 50) ; the length of x of the lattice
(define-param sy 16) ; the length of y of the lattice
(define-param sz 16) ; the length of z of the lattice
(set! geometry-lattice (make lattice (size sx sy sz)))
(set-param! resolution 1)
; -------------------------------------------------------------------------
; Target
(define omega_d 7.05) ; plasma frequency of Au in Drude model
(define Au ; definition of material dispersion
(make dielectric (epsilon 5.967)
(polarizations
(make polarizability
(omega 1e-20) (gamma 5.310E-02)
(delta-epsilon (* (* omega_d omega_d) 1e+40)))
(make polarizability
(omega 2.168) (gamma 3.498E-01)
(delta-epsilon 1.09)))))
; -----------------------------------------------------------------------------
(set! geometry
(list
(make sphere (center -10 0 0) (radius 9.0) (material Au))
(make sphere (center 10 0 0) (radius 9.0) (material Au))))
(set! sources (list
(make source (src (make continuous-src (frequency 1.8)(fwidth 0.5)))
(component Ex) (center 0 0 (* -0.49 sz)) (size sx sy 0))))
; -----------------------------------------------------------------------------
; Run and outputs -------------------------------------------------------------
(set! filename-prefix false)
(set! output-single-precision? true)
(define-param T 50) ; run until
(define (my-E2)
(output-field-function "e2" (list Ex Ey Ez) (lambda (r ex ey ez)
(+ (* ex (conj ex)) (* ey (conj ey)) (* ez (conj ez))))))
(define (sum-h5 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-h5 true
(string-append "h5math -e \"d1\" " fname "")
step-func) to-do))
; otherwise, add the output file to fname
((convert-h5 true
(string-append "h5math -e \"d1 + d2 / 45 \" " fname " "
fname "")
step-func) to-do)))))
(run-until T (at-beginning output-epsilon)
(after-time 5 (at-every 1 (sum-h5 "e2_avg.h5" my-E2))))_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss