Hello meep users,

I tried to calculate the transmittance and reflectance of glass (eps=2.25). However, the result was strange; the resulting transmittance and reflectance were fluctuated according to the frequency as the figure in the link below.

So, I would be grateful if someone would point out my mistakes in my script or some misunderstandings.

The simulation space has PMLs at the both Y+ and Y- sides, and two flux-regions: "trans" and "refl" are attached on these PMLs (Y+ and Y-, respectively). Note that there is periodic boundary conditions. To subtract the direct incident to the "refl" flux-region, I did two simulations with and without the glass. The illustration of the configuration is available in the following URL.

As for the scheme script, please see the following.

; test.scm
;-----------------------------------------------------------------------------(define-param obj? 1)
(set-param! resolution 30)
(define-param sx 4)
(define-param sy 8)
(define-param dpml 1)
(set! geometry-lattice (make lattice (size sx (+ sy (* 2 dpml)) no-size)))
(set! k-point (vector3 0 0 0))
(set! pml-layers (list
  (make pml (thickness dpml)(direction Y)(side Low))
  (make pml (thickness dpml)(direction Y)(side High))))
(if (= obj? 1)
    (set! geometry (list
                    (make block (center 0 1) (size sx 2)
                          (material (make dielectric (epsilon 2.25)))))))
(define-param fcen 1.0)
(define-param df 0.6)
(define-param fnpont 101)
(define-param src-cmpt Ex)
(set! sources (list (make source
    (src (make gaussian-src (frequency fcen) (fwidth df)))
    (center 0 -2)
    (size sx 0 0)
    (component src-cmpt))))
(define trans
    (add-flux fcen df fnpont
    (make flux-region (center 0 (* 0.5 sy)) (size sx 0))))
(define refl
    (add-flux fcen df fnpont
    (make flux-region (center 0 (* 0 -0.5 sy)) (size sx 0) (weight -1))))
(if (= obj? 1) (load-minus-flux "refl-flux" refl))
(run-until 200)
(if (= obj? 0)(save-flux "refl-flux" refl))
(display-fluxes trans refl)

To run the code, please hit the following:
meep obj?=0 test.scm
meep obj?=1 test.scm | tee a.out
grep flux1: a.out>a.csv

To plot the result please use the following matlab script:

filename  = 'a.csv'; fid = fopen(filename);
data = [];
while ~feof(fid)
    tline = fgetl(fid);
    C = strsplit(tline);
    add_tmp = [str2double(C(2)); str2double(C(3)); str2double(C(4))]';
    data = [data; add_tmp];
fclose all;
f = data(:,1);
trans = data(:,2)./(data(:,2)+data(:,3));
ref = data(:,3)./(data(:,2)+data(:,3));
plot(f, trans, 'r', f, ref, 'b');
legend('Trans.', 'Refl.'); xlabel('frequency');
set( gca,'FontSize',16 );
xlim([0.7, 1.3]), ylim([0 1]);

Hirokazu Ishida

meep-discuss mailing list

Reply via email to