-
Notifications
You must be signed in to change notification settings - Fork 1
/
calc_emntd_cyl.m
65 lines (54 loc) · 2.07 KB
/
calc_emntd_cyl.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
%{
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 permittivity Fourier matrix of a 2D grating with cylindrical
% pithches or holes being periodic in x and y dimensions of the 3D
% Cartesian coordinates
%% input:
% xno, yno: numbers of Fourier harmonics
% rpx, rpy: radius-to-period ratios
% eps_c: cylinder permittivity
% eps_m: permittivity of a medium which surrounds the cylinder
%% output:
% FE: cell array containing two Fourier matrices of the permittivity and
% inverse permittivity
%% implementation:
function FE = calc_emntd_cyl(xno, yno, rpx, rpy, eps_c, eps_m)
FE = cellmat(1,2,2*yno-1,2*xno-1);
ix = linspace(1,xno-1,xno-1);
iy = linspace(1,yno-1,yno-1);
[IX,IY] = meshgrid(ix,iy);
fx = rpy*besselj(1,(2*pi*rpx)*ix) ./ ix;
fy = rpx*besselj(1,(2*pi*rpy)*iy) ./ iy;
FXY = sqrt((rpx*IX).^2 + (rpy*IY).^2);
FXY = (rpx*rpy)*besselj(1,(2*pi)*FXY) ./ FXY;
M = zeros(2*yno-1,2*xno-1);
M(yno,xno) = pi*rpx*rpy;
M(yno+1:2*yno-1,xno) = fy;
M(yno-1:-1:1,xno) = M(yno+1:2*yno-1,xno);
M(yno,xno+1:2*xno-1) = fx;
M(yno,xno-1:-1:1) = M(yno,xno+1:2*xno-1);
M(yno+1:2*yno-1,xno+1:2*xno-1) = FXY;
M(yno+1:2*yno-1,xno-1:-1:1) = FXY;
M(yno-1:-1:1,xno+1:2*xno-1) = FXY;
M(yno-1:-1:1,xno-1:-1:1) = FXY;
FE{1,1} = FE{1,1} + (eps_c - eps_m)*M;
FE{1,2} = FE{1,2} + (1/eps_c - 1/eps_m)*M;
FE{1,1}(yno,xno) = FE{1,1}(yno,xno) + eps_m;
FE{1,2}(yno,xno) = FE{1,2}(yno,xno) + 1/eps_m;
end
%
% end of calc_emntd_cyl
%