Dear Steven,

Thanks so much for your help.
I have read meep.scm and found texts shown as follows:

; condition function, designed to be used in conjunction with run-sources+,
; that returns true when |field|^2 at a given point has decayed more than
; a certain amount, always running for at least steps of dT.
(define (stop-when-fields-decayed dT c pt decay-by)
  (if (null? fields) (init-fields))
  (let ((T0 (meep-time))
        (max-abs (sqr (magnitude (meep-fields-get-field fields c pt))))
        (cur-max 0))
    (lambda ()
      (let ((fabs (sqr (magnitude (meep-fields-get-field fields c pt)))))
        (set! cur-max (max cur-max fabs))
        (if (<= (meep-time) (+ T0 dT))
            false ; don't stop yet
            (let ((old-cur cur-max))
              (set! cur-max 0)
              (set! T0 (meep-time))
              (set! max-abs (max max-abs old-cur))
              (if (not (zero? max-abs))
                  (print "field decay(t = " (meep-time)"): "
                         old-cur " / " max-abs " = " (/ old-cur max-abs) "\n"))
              (<= old-cur (* max-abs decay-by))))))))

I am sorry but since I am still a green hand, could you please do me a favor to 
explain a little more of what I should base my function according to above?

Thanks a lot for your attention!

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

Reply via email to