Closed adamjermyn closed 10 years ago
Here is a simplified 2d example that works fine for me (prints a nonzero energy converging to about 1.58):
(define-param xSize 6.0)
(define-param ySize 6.0)
(define-param pmlSize 2.0)
(define-param freq 1)
(define-param res 10)
(set! geometry-lattice (make lattice (size xSize ySize no-size)))
(set! pml-layers (list (make pml (thickness pmlSize))))
(set! sources (list (make source (src (make continuous-src (frequency freq)))
(component Ex) (center 0 0))))
(set! resolution res)
(set! force-complex-fields? true)
(define (netE)
(print "E:" (field-energy-in-box (meep-fields-total-volume fields)) "\n"))
(run-until 10 (at-every 1 netE))
Could you verify that this works? Then try modifying to be closer to your case until the problem appears.
(Note that a frequency of 0.002 looks very odd. That corresponds to a wavelength of 500, which is more than 10 times the diameter of your computational cell. It doesn't really make sense to do electrodynamics in this regime, as opposed to quasi-static simulations, and Meep may not be the right tool for you.)
Resolved. Placing the source inside the pml layer was the error on my part.
I am running Meep in fdtd mode, with a plane wave hitting a sphere and pml coating the computational box. I am interested in the point at which transients die down, and so wanted to have Meep output the total field energy in the box. Following the example in the reference guide I was able to get it to output 0.0 at every stage (which is incorrect given that there is energy in the system). Here's my control code:
(define-param xSize 6.0) (define-param ySize 6.0) (define-param zSize 30.0) (define-param pmlSize 2.0) (define-param sphereSize 0.5) (define-param realeps -2.00868962) (define-param freq (* 1 0.002099383)) (define-param imageps 3.48099144) (define-param res 5)
(set! geometry-lattice (make lattice (size xSize ySize zSize)))
(set! geometry (list (make sphere (center 0 0 (- 10)) (radius sphereSize) (material (make dielectric (epsilon realeps) (D-conductivity (/ (* 2 pi freq imageps) realeps)))))))
(set! pml-layers (list (make pml (thickness pmlSize))))
(set! sources (list (make source (src (make continuous-src (frequency freq))) (component Ex) (center 0 0 15) (size xSize ySize 0) (amplitude 1))))
(set! resolution res)
(set! force-complex-fields? true)
(define (netE) (print "Net Energy:" (field-energy-in-box (meep-fields-total-volume fields)) "\n" ))
(run-until 10000 (at-every 1 netE) )