Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 13 additions & 34 deletions chunkie/+chnk/+axissymhelm2d/kern.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@
zk2 = zks(2);
end

if strcmpi(type, 'd')
switch lower(type)

case {'d', 'double'}
srcnorm = srcinfo.n(:,:);
[~, grad] = chnk.axissymhelm2d.green(zk, src, targ, origin);
nx = repmat(srcnorm(1,:), nt, 1);
Expand All @@ -91,9 +93,8 @@
end
end
end
end

if strcmpi(type, 'sprime')
case {'sp', 'sprime'}
targnorm = targinfo.n(:,:);
[~, grad] = chnk.axissymhelm2d.green(zk, src, targ, origin);

Expand All @@ -118,9 +119,7 @@
end
end

end

if strcmpi(type, 's')
case {'s', 'single'}
submat = chnk.axissymhelm2d.green(zk, src, targ, origin);
fker = @(x, s, t) fslp(x, zk, s, t, origin);
for j=1:ns
Expand All @@ -140,15 +139,11 @@
end
end

end


if strcmpi(type, 'sdiff')
case {'sdiff', 's_diff'}
ifdiff = 1;
submat = chnk.axissymhelm2d.green(zk, src, targ, origin, ifdiff);
end

if strcmpi(type, 'c')
case {'c', 'combined'}
srcnorm = srcinfo.n(:,:);
coef = ones(2,1);
if (nargin == 6); coef = varargin{1}; end
Expand All @@ -175,10 +170,8 @@
end
end
end
end


if strcmpi(type, 'dprime')
case {'dp', 'dprime'}
targnorm = targinfo.n(:,:);
srcnorm = srcinfo.n(:,:);
[~,~,hess] = chnk.axissymhelm2d.green(zk, src, targ, origin);
Expand All @@ -188,10 +181,8 @@
nytarg = repmat((targnorm(2,:)).',1,ns);
submat = hess(:,:,4).*nxsrc.*nxtarg - hess(:,:,5).*nysrc.*nxtarg ...
- hess(:,:,6).*nxsrc.*nytarg + hess(:,:,3).*nysrc.*nytarg;
end

if strcmpi(type, 'dprime_re_diff')

case {'dp_re_diff', 'dprime_re_diff'}
targnorm = targinfo.n(:,:);
srcnorm = srcinfo.n(:,:);
ifdiff = 2;
Expand All @@ -213,11 +204,7 @@

submat = submat1-submat2;

end



if strcmpi(type, 'dprimediff')
case {'dpdiff', 'dp_diff', 'dprimediff', 'dprime_diff'}
targnorm = targinfo.n(:,:);
srcnorm = srcinfo.n(:,:);
ifdiff = 1;
Expand Down Expand Up @@ -246,9 +233,7 @@
end
end

end

if strcmpi(type, 'neu_rpcomb')
case {'neu_rpcomb'}
targnorm = targinfo.n(:,:);
srcnorm = srcinfo.n(:,:);
[~,gk,~,sikmat,gik,~,~,~,hessdiff] = ...
Expand Down Expand Up @@ -314,14 +299,8 @@
submat(1:3:end, 3:3:end) = c2*spikmat;
submat(2:3:end, 1:3:end) = -sikmat;
submat(3:3:end, 1:3:end) = -spikmat;








otherwise
error('Unknown axissymmetric Helmholtz kernel type ''%s''.', type);
end

end
Expand Down
27 changes: 12 additions & 15 deletions chunkie/+chnk/+elast2d/kern.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,15 @@
r2 = x.^2 + y.^2;
r4 = r2.^2;

if (strcmpi(type,'s'))
switch lower(type)
case {'s', 'single'}
logr = beta*log(r2)/2;
rirjor2 = (kron(gamma*x./r2,[1 0; 1 0]) + ...
kron(gamma*y./r2,[0 1; 0 1])).* ...
(kron(x,[1 1; 0 0]) + kron(y,[0 0; 1 1]));
mat = kron(logr+gamma/2,eye(2)) + rirjor2;
end
if (strcmpi(type,'strac'))

case {'strac'}
dirx = t.n(1,:); dirx = dirx(:);
diry = t.n(2,:); diry = diry(:);
rdotv = dirx(:).*x + diry(:).*y;
Expand All @@ -85,8 +86,8 @@
kron(y.*dirx./r2,[0 -1; 1 0]) + ...
kron(rdotv./r2,[1 0; 0 1]));
mat = term1+term2;
end
if (strcmpi(type,'sgrad'))

case {'sgrad', 'sg'}
mat = zeros(4*m,2*n);
tmp = beta*x./r2;
mat(1:4:end,1:2:end) = tmp;
Expand Down Expand Up @@ -116,8 +117,7 @@
tmp = gamma*(2*r2.*y-y.^2.*(2*y))./r4;
mat(4:4:end,2:2:end) = mat(4:4:end,2:2:end) + tmp;

end
if (strcmpi(type,'d'))
case {'d', 'double'}
dirx = s.n(1,:); dirx = dirx(:).';
diry = s.n(2,:); diry = diry(:).';
rdotv = x.*dirx + y.*diry;
Expand All @@ -128,9 +128,8 @@
kron(y.*dirx./r2,[0 1; -1 0]) + ...
kron(rdotv./r2,[1 0; 0 1]));
mat = -(term1+term2);
end

if (strcmpi(type,'dalt'))
case {'dalt'}
dirx = s.n(1,:); dirx = dirx(:).';
diry = s.n(2,:); diry = diry(:).';
rdotv = x.*dirx + y.*diry;
Expand All @@ -139,9 +138,8 @@
(kron(x,[1 1; 0 0]) + kron(y,[0 0; 1 1]));
term1 = eta*(kron(rdotv./r2,[2 0; 0 2]));
mat = -(term1+term2);
end

if (strcmpi(type,'daltgrad'))
case {'daltgrad', 'daltg'}
dirx = s.n(1,:); dirx = dirx(:).';
diry = s.n(2,:); diry = diry(:).';
rdotv = x.*dirx + y.*diry;
Expand Down Expand Up @@ -185,9 +183,7 @@
-2*eta*(diry./r2 - 2*rdotv.*y./r4);
mat(4:4:end,2:2:end) = aij_xl;

end

if (strcmpi(type,'dalttrac'))
case {'dalttrac'}
dirx = s.n(1,:); dirx = dirx(:).';
diry = s.n(2,:); diry = diry(:).';
rdotv = x.*dirx + y.*diry;
Expand Down Expand Up @@ -239,7 +235,8 @@
tmp = mu*(matg(2:4:end,:) + matg(3:4:end,:));
mat(1:2:end,:) = mat(1:2:end,:) + tmp.*n2 + 2*mu*matg(1:4:end,:).*n1;
mat(2:2:end,:) = mat(2:2:end,:) + tmp.*n1 + 2*mu*matg(4:4:end,:).*n2;

otherwise
error('Unknown elasticity kernel type ''%s''.', type);
end

end
44 changes: 13 additions & 31 deletions chunkie/+chnk/+flex2d/kern.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,13 @@

%%% STANDARD LAYER POTENTIALS

if strcmpi(type, 's') % flexural wave single layer
switch lower(type)
case {'s', 'single'} % flexural wave single layer

val = chnk.flex2d.hkdiffgreen(zk,src,targ);
submat = 1/(2*zk^2).*val;

end

if strcmpi(type, 'sprime') % normal derivative of flexural wave single layer
case {'sp', 'sprime'} % normal derivative of flexural wave single layer

targnorm = targinfo.n;
nxtarg = repmat((targnorm(1,:)).',1,ns);
Expand All @@ -114,12 +113,10 @@
[~,grad] = chnk.flex2d.hkdiffgreen(zk,src,targ);
submat = 1/(2*zk^2).*(grad(:,:,1).*nxtarg + grad(:,:,2).*nytarg);

end

%%% CLAMPED PLATE KERNELS

% boundary conditions applied to a point source
if strcmpi(type, 'clamped_plate_bcs')
case {'clamped_plate_bcs'}
nxtarg = targinfo.n(1,:).';
nytarg = targinfo.n(2,:).';
submat = zeros(2*nt,ns);
Expand All @@ -131,10 +128,9 @@

submat(1:2:end,:) = firstbc;
submat(2:2:end,:) = secondbc;
end

% kernels for the clamped plate integral equation
if strcmpi(type, 'clamped_plate')
case {'clamped_plate'}
srcnorm = srcinfo.n;
srctang = srcinfo.d;
targnorm = targinfo.n;
Expand Down Expand Up @@ -195,10 +191,9 @@

submat(2:2:end,1:2:end) = K21;
submat(2:2:end,2:2:end) = K22;
end

% clamped plate kernels for plotting
if strcmpi(type, 'clamped_plate_eval')
case {'clamped_plate_eval'}

submat = zeros(nt,2*ns);

Expand Down Expand Up @@ -226,13 +221,11 @@
submat(:,1:2:end) = K1;
submat(:,2:2:end) = K2;

end


%%% FREE PLATE KERNELS

% boundary conditions applied to a point source
if strcmpi(type, 'free_plate_bcs')
case {'free_plate_bcs'}
targnorm = targinfo.n;
targtang = targinfo.d;
targd2 = targinfo.d2;
Expand Down Expand Up @@ -274,10 +267,8 @@
submat(1:2:end,:) = firstbc;
submat(2:2:end,:) = secondbc;

end

% kernels for the free plate integral equation
if strcmpi(type, 'free_plate')
case {'free_plate'}
srcnorm = srcinfo.n;
srctang = srcinfo.d;
targnorm = targinfo.n;
Expand Down Expand Up @@ -394,10 +385,8 @@
submat(3:4:end,1:2:end) = K11H;
submat(4:4:end,1:2:end) = K21H;

end

% free plate kernels used for plotting
if strcmpi(type, 'free_plate_eval')
case {'free_plate_eval'}
srcnorm = srcinfo.n;
srctang = srcinfo.d;
nu = varargin{1};
Expand All @@ -423,12 +412,10 @@
submat(:,2:3:end) = K1H;
submat(:,3:3:end) = K2;

end

%%% SUPPORTED PLATE KERNELS

% boundary conditions applied to a point source
if strcmpi(type, 'supported_plate_bcs')
case {'supported_plate_bcs'}
nxtarg = targinfo.n(1,:).';
nytarg = targinfo.n(2,:).';
dx = targinfo.d(1,:).';
Expand All @@ -450,11 +437,10 @@

submat(1:2:end,:) = firstbc;
submat(2:2:end,:) = secondbc;
end

% kernels for the supported plate integral equation that have to be
% discretized using log quadrature
if strcmpi(type, 'supported_plate_log')
case {'supported_plate_log'}
srcnorm = srcinfo.n;
srctang = srcinfo.d;
srcd2 = srcinfo.d2;
Expand Down Expand Up @@ -568,11 +554,9 @@
submat(2:2:end,1:2:end) = K21;
submat(2:2:end,2:2:end) = K22;

end

% the kernel for the supported plate integral equation that has to be
% discretized using smooth quadrature to avoid close evaluations
if strcmpi(type, 'supported_plate_smooth')
case {'supported_plate_smooth'}
srcnorm = srcinfo.n;
srctang = srcinfo.d;
srcd2 = srcinfo.d2;
Expand Down Expand Up @@ -673,10 +657,8 @@

submat(r2 == 0) = (nu - 1)*(12*kappa(r2 == 0).^3*(nu^2 - nu + 4) + kpp(r2 == 0)*(-5*nu^2 + 4*nu + 33))/(48*pi*(nu - 3)) ; % diagonal replacement

end

% supported plate kernels for plotting
if strcmpi(type, 'supported_plate_eval')
case {'supported_plate_eval'}
srcnorm = srcinfo.n;
srctang = srcinfo.d;
srcd2 = srcinfo.d2;
Expand Down
Loading
Loading