calc_SMD_interface_td.m 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. %{
  2. Copyright © 2020 Alexey A. Shcherbakov. All rights reserved.
  3. This file is part of GratingFMM.
  4. GratingFMM is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 2 of the License, or
  7. (at your option) any later version.
  8. GratingFMM is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GratingFMM. If not, see <https://www.gnu.org/licenses/>.
  14. %}
  15. %% description:
  16. % calculate a diagonal S-matrix of an interface between two homogeneous
  17. % isotropic media for two polarizations and a 2D set of wavevector
  18. % projections
  19. %% input:
  20. % xno, yno: numbers of Fourier harmonics in x and y dimensions
  21. % kx0, ky0: zero order wavevector projections
  22. % kgx, kgy: wavevector steps in x and y dimensions
  23. % eps1, eps2: permittivities of media below and above the interface
  24. %% output:
  25. % SMD: diagonal interface S-matrix of size (2*no,2,2), where no = xno*yno
  26. % block SMD(:,1,1) corresponds to refelection from substrate to substrate
  27. % block SMD(:,2,2) corresponds to refelection from superstrate to superstrate
  28. % block SMD(:,2,1) corresponds to transmission from substrate to superstrate
  29. % block SMD(:,1,2) corresponds to transmission from superstrate to substrate
  30. % central harmonic index is ind_0 = (ceil(xno/2)-1)*yno+ceil(yno/2)
  31. % first no components in each of the two first dimensions if the S-matrix
  32. % correspond to the TE polarization, and indeces from no+1 to 2*no
  33. % correspond to the TM polarization
  34. %% implementation:
  35. function [SM] = calc_SMD_interface_td(xno, yno, kx0, ky0, kgx, kgy, eps1, eps2)
  36. no = xno*yno;
  37. ind_e = 1:no;
  38. ind_h = no+1:2*no;
  39. % propagation constants:
  40. [kz1, kz2] = fmmtd_kxyz(xno, yno, kx0, ky0, kgx, kgy, eps1, eps2);
  41. SM = zeros(2*no,2,2);
  42. % TE:
  43. SM(ind_e,1,1) = (kz1-kz2)./(kz1+kz2);
  44. SM(ind_e,2,1) = 1 + SM(ind_e,1,1);
  45. SM(ind_e,2,2) = -SM(ind_e,1,1);
  46. SM(ind_e,1,2) = 1 + SM(ind_e,2,2);
  47. % TM:
  48. SM(ind_h,1,1) = (eps2*kz1-eps1*kz2)./(eps2*kz1+eps1*kz2);
  49. SM(ind_h,2,1) = 1 + SM(ind_h,1,1);
  50. SM(ind_h,2,2) = -SM(ind_h,1,1);
  51. SM(ind_h,1,2) = 1 + SM(ind_h,2,2);
  52. end
  53. %
  54. % end of calc_SMD_interface_td
  55. %