Преглед на файлове

Загрузить файлы ''

Shcherbakov Alexey Shcherbakov преди 4 години
родител
ревизия
dc638e874b
променени са 4 файла, в които са добавени 219 реда и са изтрити 0 реда
  1. 57 0
      calc_SMD_interface.m
  2. 60 0
      calc_SMD_interface_td.m
  3. 44 0
      calc_SMD_layer.m
  4. 58 0
      calc_SMD_layer_td.m

+ 57 - 0
calc_SMD_interface.m

@@ -0,0 +1,57 @@
+%{
+Copyright © 2020 Alexey A. Shcherbakov. All rights reserved.
+
+This file is part of GratingFMM.
+
+GratingFMM is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+GratingFMM is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GratingFMM. If not, see <https://www.gnu.org/licenses/>.
+%}
+%% description:
+% calculate a diagonal S-matrix of an interface between two homogeneous
+% isotropic media for a fixed polarization and a 1D set of wavevector
+% projections
+%% input:
+% no: number of Fourier harmonics
+% kx0: zero harmonic wavevector projection
+% kg: wavevector step
+% eps1, eps2: permittivities of media below and above the interface
+% pol: polarization, either 'TE' or 'TM'
+%% output:
+% SMD: diagonal interface S-matrix of size (no,2,2)
+% block SMD(:,1,1) corresponds to refelection from below to below
+% block SMD(:,2,2) corresponds to refelection from above to above
+% block SMD(:,2,1) corresponds to transmission from below to above
+% block SMD(:,1,2) corresponds to transmission from above to below
+% central harmonic index is ind_0 = ceil(no/2)
+%% implementation:
+function [SMD] = calc_SMD_interface(no, kx0, kg, eps1, eps2, pol)
+	[kz1, kz2] = fmm_kxz(no, kx0, 0, kg, eps1, eps2);
+
+	SMD = zeros(no,2,2);
+	if strcmp(pol,'TE')
+		SMD(:,1,1) = (kz1-kz2)./(kz1+kz2);
+		SMD(:,2,1) = 1 + SMD(:,1,1);
+		SMD(:,2,2) = -SMD(:,1,1);
+		SMD(:,1,2) = 1 + SMD(:,2,2);
+	elseif strcmp(pol,'TM')
+		SMD(:,1,1) = (eps2*kz1-eps1*kz2)./(eps2*kz1+eps1*kz2);
+		SMD(:,2,1) = 1 + SMD(:,1,1);
+		SMD(:,2,2) = -SMD(:,1,1);
+		SMD(:,1,2) = 1 + SMD(:,2,2);
+	else
+		error('function calc_SM_interface: unknown polarization');
+	end
+end
+%
+% end of calc_SMD_interface
+%

+ 60 - 0
calc_SMD_interface_td.m

@@ -0,0 +1,60 @@
+%{
+Copyright © 2020 Alexey A. Shcherbakov. All rights reserved.
+
+This file is part of GratingFMM.
+
+GratingFMM is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+GratingFMM is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GratingFMM. If not, see <https://www.gnu.org/licenses/>.
+%}
+%% description:
+% calculate a diagonal S-matrix of an interface between two homogeneous
+% isotropic media for two polarizations and a 2D set of wavevector
+% projections
+%% input:
+% xno, yno: numbers of Fourier harmonics in x and y dimensions
+% kx0, ky0: zero order wavevector projections
+% kgx, kgy: wavevector steps in x and y dimensions
+% eps1, eps2: permittivities of media below and above the interface
+%% output:
+% SMD: diagonal interface S-matrix of size (2*no,2,2), where no = xno*yno
+% block SMD(:,1,1) corresponds to refelection from substrate to substrate
+% block SMD(:,2,2) corresponds to refelection from superstrate to superstrate
+% block SMD(:,2,1) corresponds to transmission from substrate to superstrate
+% block SMD(:,1,2) corresponds to transmission from superstrate to substrate
+% central harmonic index is ind_0 = (ceil(xno/2)-1)*yno+ceil(yno/2)
+% first no components in each of the two first dimensions if the S-matrix
+%  correspond to the TE polarization, and indeces from no+1 to 2*no 
+%  correspond to the TM polarization
+%% implementation:
+function [SM] = calc_SMD_interface_td(xno, yno, kx0, ky0, kgx, kgy, eps1, eps2)
+	no = xno*yno;
+	ind_e = 1:no;
+	ind_h = no+1:2*no;
+		% propagation constants:
+	[kz1, kz2] = fmmtd_kxyz(xno, yno, kx0, ky0, kgx, kgy, eps1, eps2);
+
+	SM = zeros(2*no,2,2);
+		% TE:
+	SM(ind_e,1,1) = (kz1-kz2)./(kz1+kz2);
+	SM(ind_e,2,1) = 1 + SM(ind_e,1,1);
+	SM(ind_e,2,2) = -SM(ind_e,1,1);
+	SM(ind_e,1,2) = 1 + SM(ind_e,2,2);
+		% TM:
+	SM(ind_h,1,1) = (eps2*kz1-eps1*kz2)./(eps2*kz1+eps1*kz2);
+	SM(ind_h,2,1) = 1 + SM(ind_h,1,1);
+	SM(ind_h,2,2) = -SM(ind_h,1,1);
+	SM(ind_h,1,2) = 1 + SM(ind_h,2,2);
+end
+%
+% end of calc_SMD_interface_td
+%

+ 44 - 0
calc_SMD_layer.m

@@ -0,0 +1,44 @@
+%{
+Copyright © 2020 Alexey A. Shcherbakov. All rights reserved.
+
+This file is part of GratingFMM.
+
+GratingFMM is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+GratingFMM is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GratingFMM. If not, see <https://www.gnu.org/licenses/>.
+%}
+%% description:
+% calculate a diagonal S-matrix of a homogeneous layer for a 1D set of
+% wavevector projections
+%% input:
+% no: number of Fourier harmonics
+% kx0: zero harmonic wavevector projection
+% kg: wavevector step
+% kh: layer thickness multiplied by the vacuum wavenumber
+% eps: layer permittivity
+%% output:
+% SMD: diagonal interface S-matrix of size (no,2,2)
+% block SMD(:,1,1) corresponds to refelection from below to below
+% block SMD(:,2,2) corresponds to refelection from above to above
+% block SMD(:,2,1) corresponds to transmission from below to above
+% block SMD(:,1,2) corresponds to transmission from above to below
+% central harmonic index is ind_0 = ceil(no/2)
+%% implementation:
+function [SMD] = calc_SMD_layer(no, kx0, kg, kh, eps)
+	kz = fmm_kxz(no, kx0, 0, kg, eps, eps);
+	SMD = zeros(no,2,2);
+	SMD(:,1,2) = exp((1i*kh)*kz);
+	SMD(:,2,1) = SMD(:,1,2);
+end
+%
+% end of calc_SMD_layer
+%

+ 58 - 0
calc_SMD_layer_td.m

@@ -0,0 +1,58 @@
+%{
+Copyright © 2020 Alexey A. Shcherbakov. All rights reserved.
+
+This file is part of GratingFMM.
+
+GratingFMM is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+GratingFMM is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GratingFMM. If not, see <https://www.gnu.org/licenses/>.
+%}
+%% description:
+% calculate a diagonal S-matrix of a homogeneous layer for a 2D set of
+% wavevector projections
+%% input:
+% xno, yno: numbers of Fourier harmonics in x and y dimensions
+% kx0, ky0: zero order wavevector projections
+% kgx, kgy: wavevector steps in x and y dimensions
+% kh: layer thickness multiplied by the vacuum wavenumber
+% eps: layer permittivity
+%% output:
+% SMD: diagonal interface S-matrix of size (2*no,2,2), where no = xno*yno
+% block SMD(:,1,1) corresponds to refelection from below to below
+% block SMD(:,2,2) corresponds to refelection from above to above
+% block SMD(:,2,1) corresponds to transmission from below to above
+% block SMD(:,1,2) corresponds to transmission from above to below
+% central harmonic index is ind_0 = (ceil(xno/2)-1)*yno+ceil(yno/2)
+% first (no) components of the S-matrix correspond to the TE polarization,
+%  and indeces from (no+1) to (2*no) correspond to the TM polarization
+%% implementation:
+function [SMD] = calc_SMD_layer_td(xno, yno, kx0, ky0, kgx, kgy, kh, eps)
+	no = xno*yno;
+	SMD = zeros(2*no,2,2);
+		% wavevector projections
+	kx = kx0 + kgx*(linspace(1,xno,xno) - ceil(xno/2));
+	ky = ky0 + kgy*(linspace(1,yno,yno) - ceil(yno/2));
+	[kkx,kky] = meshgrid(kx,ky);
+	kkx = reshape(kkx,1,[]);
+	kky = reshape(kky,1,[]);
+	kkxy = kkx.^2 + kky.^2;
+	
+	kz = sqrt(eps - kkxy);
+	ind = angle(kz) < -1e-12;
+	kz(ind) = -kz(ind);
+	
+	SMD(:,2,1) = exp((1i*kh)*kz);
+	SMD(:,1,2) = SMD(:,2,1);
+end
+%
+% end of calc_SMD_layer_td
+%