Skip to content

Commit 08d52aa

Browse files
committed
added expansion evals...could not validate due to fmm dependence
1 parent 718fc87 commit 08d52aa

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed

chunkie/+chnk/+quasiproxy/eval_approx.m

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function uapp = eval_approx(full_sys,chnkr,interface_dens,proxy_dens,d,theta,xxtrg)
1+
function uapp = eval_approx(full_sys,chnkr,interface_dens,proxy_dens,bragg_coef,KK,ht,hb,d,theta,xxtrg)
22

33
% will require lots of clean up for multilayer code.
44

@@ -7,10 +7,41 @@
77

88
kh = full_sys.khs(numlayer);
99

10-
ntot = chnkr.npt;
1110
nproxy = size(full_sys.Cproxy{numlayer}.r,2);
1211

13-
12+
if xxtrg.r(2,1)>hb
13+
% use bragg expansion
14+
topcoef = bragg_coef(1:KK);
15+
kh1 = full_sys.khs(1);
16+
17+
18+
uapp = 0;
19+
n = (KK-1)/2;
20+
ima = sqrt(-1);
21+
for j= 1:KK
22+
kappa = kh1*cos(theta)+2*pi*(j-n);
23+
knu = sqrt(kh1^2-kappa^2);
24+
uapp = uapp+topcoef(j)*exp(ima*kappa*xxtrg.r(1))*exp(ima*knu*(xxtrg.r(2)-ht));
25+
end
26+
27+
elseif xxtrg.r(2,1)<hb
28+
% use bragg expansion
29+
30+
bottcoef = bragg_coef(KK+1:end);
31+
kh1 = full_sys.khs(1);
32+
khn = full_sys.khs(end);
33+
34+
uapp = 0;
35+
n = (KK-1)/2;
36+
ima = sqrt(-1);
37+
for j= 1:KK
38+
kappa = kh1*cos(theta)+2*pi*(j-n);
39+
knd = sqrt(khn^2-kappa^2);
40+
uapp = uapp+bottcoef(j)*exp(ima*kappa*xxtrg.r(1))*exp(ima*knd*(-xxtrg.r(2)+hb));
41+
end
42+
43+
else
44+
% use integral operator form of solution
1445
% extract the different parts of the solution to the linear system.
1546
c1=proxy_dens(1:nproxy);
1647

@@ -44,7 +75,7 @@
4475
+ alpha*(TrR*interface_dens);
4576

4677
uapp = udens+uproxy;
47-
78+
end
4879

4980

5081
return

chunkie/demo/demo_quasiproxy.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
% test target location for convergence.
1313
xxtrg = [];
14-
xxtrg.r = [0.2; 0.5];
14+
% xxtrg.r = [0.2; 0.5];
15+
xxtrg.r = [0.2; 1.5];
1516
xxtrg.n = [0; 0];
1617

1718
% Number of panels
@@ -71,7 +72,7 @@
7172
fprintf('Flux error est. = %g\n\n', flux_error);
7273
fprintf('\n theta value , flux error est. = %g\n', flux_error );
7374

74-
uapp = chnk.quasiproxy.eval_approx(full_sys,chnkr,interface_dens,proxy_dens,d,theta,xxtrg);
75+
uapp = chnk.quasiproxy.eval_approx(full_sys,chnkr,interface_dens,proxy_dens,bragg_coef,KK,d,ht,hb,theta,xxtrg);
7576

7677
uapp
7778

startup.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ function startup(opts)
1212
% opts.fmmrecompile - boolean (false), force recompile of fmm2d library
1313
%
1414

15+
addpath(genpath('/Users/gillmana/Documents/Research/Flatiron/chunkie/'))
16+
addpath(genpath('/Users/gillmana/Documents/Research/Flatiron/chunkie/+chnk/+flam'))
17+
18+
1519
if nargin < 1
1620
opts = [];
1721
end

0 commit comments

Comments
 (0)