On Mon, 4 Sep 2006, Andrea Locatelli wrote:
I have some problems to understand how to manipulate fields at each time
step. For example, I'm doing a 2D TM simulation, and I want to make some
processing on Ez in order to calculate the time-averaged |Ez|^2. I need
to define an auxiliary variable, and at each time step I should add the
calculated |Ez|^2 to this auxiliary variable, and finally I should
output the result. I think I should use the (before-time T
step-function) command, but I have many doubts on how to define the
proper step function, and in particular how I can define and manipulate
"field" variables. Do you have any examples on this topic?
You can get the value of the field just by calling get-field, as described
in the manual. Here is a quick example (hopefully with no typos) of
computing the average |Ez|^2 over 100 time units.
(define Ezsum 0)
(define (do-Ez-sum)
(set! Ezsum (+ Ezsum (sqr (magnitude
(get-field Ez (vector3 0 0 0)))))))
(run-until 100 do-Ez-sum)
(print "the mean |Ez|^2 at (0,0,0) = "
(* Ezsum (/ (meep-fields-dt-get fields) 100))
"\n")
Cordially,
Steven G. Johnson
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss