1
0

calc_emntd_cyl.m 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 permittivity Fourier matrix of a 2D grating with cylindrical
  17. % pithches being periodic in x and y dimensions of the 3D Cartesian coordinates
  18. %% input:
  19. % xno, yno: numbers of Fourier harmonics
  20. % rpx, rpy: radius-to-period ratios
  21. % eps_c: cylinder permittivity
  22. % eps_m: permittivity of a medium which surrounds the cylinder
  23. %% output:
  24. % FE: cell array containing two Fourier matrices of the permittivity and
  25. % inverse permittivity
  26. %% implementation:
  27. function FE = calc_emntd_cyl(xno, yno, rpx, rpy, eps_c, eps_m)
  28. FE = cellmat(1,2,2*yno-1,2*xno-1);
  29. ix = linspace(1,xno-1,xno-1);
  30. iy = linspace(1,yno-1,yno-1);
  31. [IX,IY] = meshgrid(ix,iy);
  32. fx = rpy*besselj(1,(2*pi*rpx)*ix) ./ ix;
  33. fy = rpx*besselj(1,(2*pi*rpy)*iy) ./ iy;
  34. FXY = sqrt((rpx*IX).^2 + (rpy*IY).^2);
  35. FXY = (rpx*rpy)*besselj(1,(2*pi)*FXY) ./ FXY;
  36. M = zeros(2*yno-1,2*xno-1);
  37. M(yno,xno) = pi*rpx*rpy;
  38. M(yno+1:2*yno-1,xno) = fy;
  39. M(yno-1:-1:1,xno) = M(yno+1:2*yno-1,xno);
  40. M(yno,xno+1:2*xno-1) = fx;
  41. M(yno,xno-1:-1:1) = M(yno,xno+1:2*xno-1);
  42. M(yno+1:2*yno-1,xno+1:2*xno-1) = FXY;
  43. M(yno+1:2*yno-1,xno-1:-1:1) = FXY;
  44. M(yno-1:-1:1,xno+1:2*xno-1) = FXY;
  45. M(yno-1:-1:1,xno-1:-1:1) = FXY;
  46. FE{1,1} = FE{1,1} + (eps_c - eps_m)*M;
  47. FE{1,2} = FE{1,2} + (1/eps_c - 1/eps_m)*M;
  48. FE{1,1}(yno,xno) = FE{1,1}(yno,xno) + eps_m;
  49. FE{1,2}(yno,xno) = FE{1,2}(yno,xno) + 1/eps_m;
  50. end
  51. %
  52. % end of calc_emntd_cyl
  53. %