-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathem3dmultfmmflat_aefie.m
106 lines (77 loc) · 2.11 KB
/
em3dmultfmmflat_aefie.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
function y0=em3dmultfmmflat_aefie(A,x0);
%
% The exterior augmented EFIE solver with PEC boundary conditions,
% on a flat triangulated surface.
%
% Integral representation is
%
% E = (ik) G_k J - grad G_k rho_e, H = green3m J
%
% We do not normalize the Green's function by 4 pi
% Integral equation is
%
% nx (ik) G_k J - nx grad G_k rho_e = nxE
% -(4*pi/2) rho_e + n. (ik) G_k J - n. grad G_k rho_e = n.E (exterior)
%
% Boundary conditions: nxE = 0, n.E = rho_e
%
'em3dmultfmmflat_aefie'
x=x0.';
%
% reconstruct the electric dipole from its projection on tangential vectors
%
x = reshape(x,3,A.ntri);
jvec = repmat(x(1,:),3,1).*A.triatang1+repmat(x(2,:),3,1).*A.triatang2;
rhoe = x(3,:);
% check, if \int rho_e = 0
rhoe_int=sum(rhoe.*A.triaarea)
%
% EFIE operator, E = (ik) G_k J - grad G_k rho_e
%
ifcharge = 1;
ifdipole = 0;
ifpot = 1;
iffld = 0;
dipstr = zeros(1,A.ntri)+1i*zeros(1,A.ntri);
charge = jvec(1,:);
[U]=hfmm3dtria(A.iprec,A.zk,A.ntri,A.triangles,A.trianorm,A.source,...
ifcharge,charge,ifdipole,dipstr,A.trianorm,ifpot,iffld);
x1 = U.pot;
charge = jvec(2,:);
[U]=hfmm3dtria(A.iprec,A.zk,A.ntri,A.triangles,A.trianorm,A.source,...
ifcharge,charge,ifdipole,dipstr,A.trianorm,ifpot,iffld);
x2 = U.pot;
charge = jvec(3,:);
[U]=hfmm3dtria(A.iprec,A.zk,A.ntri,A.triangles,A.trianorm,A.source,...
ifcharge,charge,ifdipole,dipstr,A.trianorm,ifpot,iffld);
x3 = U.pot;
evec=zeros(3,A.ntri)+1i*zeros(3,A.ntri);
evec(1,:) = x1;
evec(2,:) = x2;
evec(3,:) = x3;
evec = evec*1i*A.zk;
ifcharge = 1;
ifdipole = 0;
ifpot = 0;
iffld = 1;
charge = rhoe;
[U]=hfmm3dtria(A.iprec,A.zk,A.ntri,A.triangles,A.trianorm,A.source,...
ifcharge,charge,ifdipole,dipstr,A.trianorm,ifpot,iffld);
evec = evec + U.fld;
% nxE
c = cross(A.trianorm,evec);
% project on tangential vectors
y = zeros(3,A.ntri);
y(1,:) = dot(A.triatang1,c);
y(2,:) = dot(A.triatang2,c);
% n.E
c = dot(A.trianorm,evec);
% apply the diagonal term
% interior EFIE
%%%c = c + (4*pi)/2 * rhoe;
% exterior EFIE
c = c - (4*pi)/2 * rhoe;
y(3,:) = c;
y = reshape(y,1,3*A.ntri);
y0=y.';
toc