Dear Dr. Oskooi, Thank you for your reply. Your few line example code was very easy to work with. I was able to use it with a few changes to reproduce the problem. The original source does not shut off after change-sources.
My modified code follows, but first, my changes. Your example was a 2-D lattice. I changed it to 3D by setting the lattice z size value to 3 instead of no-size. I also doubled your run time. The problem appears immediately, but I also removed the in-volume code, because in-volume seems to inhibit HDFView functionality. That is, I cannot view time slices in the HDF5 appended file when using the in-volume output function. In fairness, after the source turn-off, the fields do quit propagating but the field energy at the point of the source is pretty consistently -8.2 whereas prior to turn-off it reaches 45.7 . Those numbers were obtained by using HDFView, image value option and confirmed by looking at the spreadsheet. The problem I have of course, is the presentation of believable graphics, png and gif files. Of course the csv files show the same numerical result. The code, as I modified it, follows. (set-param! resolution 20) (set! geometry-lattice (make lattice (size 10 10 3))) ;(set! geometry-lattice (make lattice (size 10 10 no-size))) (set! pml-layers (list (make pml (thickness 1)))) (set! symmetries (list (make mirror-sym (direction X)) (make mirror-sym (direction Y)))) (use-output-directory "Ardavan-out") (set! sources (list (make source (src (make continuous-src (frequency 1.0))) (component Ez) (center 0 0 0)))) (define src-on? true) (run-until 200 (lambda () (if (and (> (meep-round-time) 40) src-on?) (begin (change-sources! '()) (set! src-on? false)))) (at-beginning output-epsilon) ; (in-volume (volume (center 0 0 0) (size 9 9 0)) (to-appended "hz" (at-every 2.3 output-efield-z)) ) ; ) ; h5utils post processing for e.g., change-sources.ctl: ; h5topng -vRZc bluered change-sources-ez-000*.h5 ;~$ export GUILE_WARN_DEPRECATED="no" ;~$ time mpirun -np 3 -quiet meep-mpi ./Ardavan-post.ctl ;~$ h5topng -t 0:85 -0 -z 0 -S2 -R -c -dkbluered -o ./Ardavan- out/Ezy.png ./Ardavan-out/hz.h5 ;~$ convert ./Ardavan-out/hz.t*.png ./Ardavan-out/hz.gif Thank you for your simple code example, it was very helpful. Steve On Wed, 2017-07-05 at 12:06 -0700, Ardavan Oskooi wrote: > On 06/30/2017 11:33 AM, Steve wrote: > > > > The problem with the gaussian-src is that it does not turn off when > > I > > change sources. I thought it was supposed to simply go away when I > > change source, but it doesn't. This leads me to think that I need > > to > The change-sources! routine does indeed turn off the previous source > in > order to initialize a new one. Here is a simple demonstration. This > example involves a point source in vacuum placed at the center of a > 2d > computational cell surrounded by PML. There is an initial > continuous-wave (CW) source which is abruptly turned off. The scalar > electric field over the non-PML region is output which can be viewed > in > post processing using h5utils. Note that abruptly turning off a > source > will introduce high-frequency artifacts into the simulation. > > Scheme/libctl control script: > > (set-param! resolution 20) > > (set! geometry-lattice (make lattice (size 10 10 no-size))) > > (set! pml-layers (list (make pml (thickness 1)))) > > (set! symmetries (list (make mirror-sym (direction X)) > (make mirror-sym (direction Y)))) > > (set! sources (list (make source (src (make continuous-src > (frequency > 1.0))) (component Ez) (center 0 0 0)))) > > (define src-on? true) > > (run-until 100 > (lambda () > (if (and (> (meep-round-time) 40) src-on?) > (begin (change-sources! '()) (set! src-on? > false)))) > (in-volume (volume (center 0 0 0) (size 9 9 0)) (at- > every > 2.3 output-efield-z))) > > h5utils post processing for e.g., change-sources.ctl: > > > h5topng -vRZc bluered change-sources-ez-000*.h5 > > _______________________________________________ > 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