Since you are modeling a flat/planar structure, you will need to use a 1d computational cell. The 2d cell you are using is a supercell which introduces unwanted additional modes due to band folding (for more details, see Section 4.6 of our book chapter <https://arxiv.org/abs/1301.5366>). Note that a 1d cell in Meep must be along the z direction with only the Ex and Hy field components permitted. This is explained in the documentation <http://meep.readthedocs.io/en/latest/Scheme_User_Interface/> (under the description for the "dimensions" variable).

On 02/23/2018 02:29 PM, Hirokazu Ishida wrote:
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.
https://drive.google.com/open?id=16aHzipAuuyIyyuambuQU2J_5fcwnpSSF

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.
https://drive.google.com/open?id=1c5oqaMfG9UpIIzhrCRQ7nZVhxRNiIQU-


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];
end
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]);
%------------------------------------------------------------------------------- %------------------------------------------------------------------------------

Best,
Hirokazu Ishida

_______________________________________________
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to