Hello Meep users,

I am trying to measure the flux values just after the sources and before
the scattering structures (cylinders)to measure the input flux. I am
getting negative values for the low and high frequencies in the flux
spectrum. I think I provided enough distance for the flux line T2 on either
side and also multiplied with the weight of -1 to get the flux values
flowing towards negative Y direction. I searched almost everywhere in the
forum on how much distance from the scattering structure is enough for the
flux line not to measure negative values and I did not find any particular
answer. Is it integral multiple of wavelength inside the material? How far
is enough?

​Can anyone please help me on resolving this? I cannot seem to find a
reason for this. Here is the code in my control file:
----------CODE
STARTS--------------------------------------------------------------------------------------------------
(reset-meep)
(define-param n-saph 1.7)
(define-param n-gan 2.4)
(define-param r 0.175)
(define-param d 1.5)
(define-param h 1.2)
(define-param x1 (+(/ d 2) r))
(define-param x2 (+(+ r d) r))
(define-param res 53)

; The cell dimensions
(define-param sx 20)
(define-param sy 108)
(define-param t-gan 4.7)
(define-param t-saph 100)
(define-param pmlt 1) ; PML thickness

; Defining the size of the computational cell
(set! geometry-lattice (make lattice (size sx sy no-size)))

; Geometric objects to create structures in the computational cell
; cylinder axis parallel to y-axis
(print "Setting the geometries\n")
(set! geometry
(append
(list(make block (center 0 51.65) (size sx t-gan infinity) (material (make
dielectric (index n-gan))))
     (make block (center 0 -0.3) (size sx t-saph infinity) (material (make
dielectric (index n-saph))))
     (make cylinder (center x1 50.53) (radius r) (height h) (material air)
(axis 0 1 0))
 (make cylinder (center (+ x1 x2) 50.53) (radius r) (height h) (material
air) (axis 0 1 0))
 (make cylinder (center (+ x1 (* 2 x2)) 50.53) (radius r) (height h)
(material air) (axis 0 1 0))
 (make cylinder (center (+ x1 (* 3 x2)) 50.53) (radius r) (height h)
(material air) (axis 0 1 0))
 (make cylinder (center (+ x1 (* 4 x2)) 50.53) (radius r) (height h)
(material air) (axis 0 1 0))
 (make cylinder (center (* -1 x1) 50.53) (radius r) (height h) (material
air) (axis 0 1 0))
 (make cylinder (center (* -1 (+ x1 x2)) 50.53) (radius r) (height h)
(material air) (axis 0 1 0))
 (make cylinder (center (* -1 (+ x1 (* 2 x2))) 50.53) (radius r) (height h)
(material air) (axis 0 1 0))
 (make cylinder (center (* -1 (+ x1 (* 3 x2))) 50.53) (radius r) (height h)
(material air) (axis 0 1 0))
 (make cylinder (center (* -1 (+ x1 (* 4 x2))) 50.53) (radius r) (height h)
(material air) (axis 0 1 0)))))

(set! pml-layers (list (make pml (thickness pmlt)))) ;Try using absorbers
(set-param! resolution res)

(define-param fcen (/ 1 0.46)) ; center frequency in meep units
(define-param df 0.48) ; frequency width in meep units
(define-param nfreq 400) ;number of frequencies at which flux is calculated
(print "Setting up sources\n")
(set! sources (list
(make source
                 (src (make gaussian-src (frequency fcen) (fwidth df)))
                 (component Ex) (center 0 52.63) (size 0 0))
(make source
                 (src (make gaussian-src (frequency fcen) (fwidth df)))
                 (component Ex)(center x1 52.13) (size 0 0))
(make source
                 (src (make gaussian-src (frequency fcen) (fwidth df)))
                 (component Ex)(center (* -1 x1) 52.13) (size 0 0))))

;Defining the flux regions
(define T1 (add-flux fcen df nfreq(make flux-region (center 0 52.8) (size
sx 0))))
(define T2 (add-flux fcen df nfreq(make flux-region (center 0 51.63) (size
sx 0) (weight -1))))
(define S1 (add-flux fcen df nfreq
(make flux-region (center 0 -50.3) (size sx 0) (weight -1))
(make flux-region (center -8.5 -0.3) (size 0 t-saph) (weight -1))
(make flux-region (center 8.5 -0.3) (size 0 t-saph))))
(define B1 (add-flux fcen df nfreq(make flux-region (center 0 -52.8) (size
sx 0) (weight -1))))

; Output the fields
(use-output-directory "Withex_10voidssameD")
(run-sources+
             (stop-when-fields-decayed 20 Ex
 (vector3 0 -50.3) 1e-3)
             (at-beginning output-epsilon)
 (during-sources
 (to-appended "ex" (at-every 5 output-efield-x))))
(display-fluxes T1 T2 S1 B1)
(print "Simulation done!\n")
(print "dt= " (meep-fields-dt-get fields) "\n")
---------------------END OF
CODE------------------------------------------------------------------------------------------​
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to