Hi:
I'd like to start the field accumulation for the flux spectra after the
source has been turned off, therefore the add-flux function has to be called
within run.
I first define a function to display the fluxes, FluxDisplay.
Then in run-sources+ I use "let" to initialize the respective flux regions
after the source is off.
However, I think this will give me a problem because the initialized
add-flux variables, totflux, radflux and nradflux are local variables.
I'm not sure what the scope of these variables are, if I define the function
FluxDisplay outside run-sources, in principle this will not display the
local variables?
How can I initialize the add-flux variables inside run-sources while
defining a function to display them outside run?
(define (FluxDisplay) (display-fluxes totflux radflux nradflux))
(run-sources+ num_step
(after-sources (let ( (totflux (add-flux fcen df nfreq
(make flux-region (center SourceX (+ SourceY
(* BoxSizeY -1))) (size (* BoxSizeX 2) 0 ) (weight -1)) ; -y
(make flux-region (center SourceX (+ SourceY
(* BoxSizeY 1))) (size (* BoxSizeX 2) 0 ) ) ; +y
(make flux-region (center (+ SourceX (*
BoxSizeX -1)) SourceY) (size 0 (* BoxSizeY 2) ) (weight -1)) ; -x
(make flux-region (center (+ SourceX (*
BoxSizeX 1)) SourceY) (size 0 (* BoxSizeY 2) ) ) ; +x
))
(radflux (add-flux fcen df nfreq
(make flux-region (center 0 (- (/ StripSizeY
-2) (* D 2))) (size (+ StripSizeX D D D D) 0) (weight -1)) ; -y
(make flux-region (center 0 (+ (/
StripSizeY 2) (* D 2))) (size (+ StripSizeX D D D D) 0) ) ;
+y
(make flux-region (center (- (/ StripSizeX
-2) (* D 2)) 0) (size 0 (+ StripSizeY D D D D)) (weight -1)) ; -x
(make flux-region (center (+ (/ StripSizeX
2) (* D 2)) 0) (size 0 (+ StripSizeY D D D D)) ) ; +x
))
(nradflux (add-flux fcen df nfreq
(make flux-region (center 0 (- (/ StripSizeY
-2) (/ D 2))) (size (+ StripSizeX D) 0) (weight -1)) ; -y
(make flux-region (center 0 (+ (/
StripSizeY 2) (/ D 2))) (size (+ StripSizeX D) 0) ) ; +y
(make flux-region (center (- (/ StripSizeX
-2) (/ D 2)) 0) (size 0 (+ StripSizeY D)) (weight -1)) ; -x
(make flux-region (center (+ (/ StripSizeX
2) (/ D 2)) 0) (size 0 (+ StripSizeY D)) ) ; +x
))
)
)
)
(at-end FluxDisplay)
)
Thank you.
Regards.
Kevin Chih-Yao Huang
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss