Skip to content

Commit

Permalink
clean up stokes slp kernel split
Browse files Browse the repository at this point in the history
  • Loading branch information
haiszhu committed Oct 19, 2024
1 parent e670aae commit b7e0433
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions chunkie/@kernel/stok2d.m
Original file line number Diff line number Diff line change
Expand Up @@ -195,20 +195,24 @@

function f = stok2d_s_split(mu,s,t)
dist = (s.r(1,:)+1i*s.r(2,:))-(t.r(1,:)'+1i*t.r(2,:)');
distr = real(dist);
disti = imag(dist);
f = cell(3, 1);
ntarg = numel(t.r(1,:));
nsrc = numel(s.r(1,:));
sn1mat = repmat(s.n(1,:),[ntarg 1]);
sn2mat = repmat(s.n(2,:),[ntarg 1]);
f{1} = zeros(2*ntarg,2*nsrc);
f{2} = zeros(2*ntarg,2*nsrc);
f{3} = zeros(2*ntarg,2*nsrc);
f{1}(1:2:end,1:2:end) = 1/(2*mu);
f{1}(2:2:end,2:2:end) = 1/(2*mu);
f{2}(1:2:end,1:2:end) = (-(repmat(s.n(1,:),[ntarg 1]))).*real(dist)/(2*mu);
f{2}(1:2:end,2:2:end) = -((repmat(s.n(2,:),[ntarg 1]))).*real(dist)/(2*mu);
f{2}(2:2:end,1:2:end) = (-(repmat(s.n(1,:),[ntarg 1]))).*imag(dist)/(2*mu);
f{2}(2:2:end,2:2:end) = -((repmat(s.n(2,:),[ntarg 1]))).*imag(dist)/(2*mu);
f{3}(1:2:end,1:2:end) = - (repmat(s.n(2,:),[ntarg 1])).*real(dist)/(2*mu);
f{3}(1:2:end,2:2:end) = (repmat(s.n(1,:),[ntarg 1])).*real(dist)/(2*mu);
f{3}(2:2:end,1:2:end) = - (repmat(s.n(2,:),[ntarg 1])).*imag(dist)/(2*mu);
f{3}(2:2:end,2:2:end) = (repmat(s.n(1,:),[ntarg 1])).*imag(dist)/(2*mu);
f{2}(1:2:end,1:2:end) = -sn1mat.*distr/(2*mu);
f{2}(1:2:end,2:2:end) = -sn2mat.*distr/(2*mu);
f{2}(2:2:end,1:2:end) = -sn1mat.*disti/(2*mu);
f{2}(2:2:end,2:2:end) = -sn2mat.*disti/(2*mu);
f{3}(1:2:end,1:2:end) = -sn2mat.*distr/(2*mu);
f{3}(1:2:end,2:2:end) = sn1mat.*distr/(2*mu);
f{3}(2:2:end,1:2:end) = -sn2mat.*disti/(2*mu);
f{3}(2:2:end,2:2:end) = sn1mat.*disti/(2*mu);
end
2 changes: 1 addition & 1 deletion devtools/test/chunkermat_stok2dTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
t1 = toc(start);
fprintf('%5.2e s : time to eval at targs (slow, adaptive routine)\n',t1)

% test stokes slp velocity pquad...
% just test stokes slp velocity pquad...
% targets = targets.*repmat(rand(1,nt),2,1)*0.99 seems to break below stokes kernel test...
fkerns = kernel('stok', 'svel', mu);
Ssol = chunkerkerneval(chnkr,fkerns,sol,targets,opts);
Expand Down

0 comments on commit b7e0433

Please sign in to comment.