/ concept-collection / numbl-chunkie
Sign in
concept-collection / numbl-chunkie
numbl-chunkie / chunkie_ex08_laplace.m
41 lines · 1.1 KBBlameHistoryRaw
1% Example 8: Laplace Neumann BVP on a starfish domain via single-layer
2% representation, with the W (onesmat) regularization added so that the
3% second-kind integral equation is invertible.
5mip load --install magland/magland/chunkie;
7tic;
9% chunker discretization of a starfish domain
10chnkr = chunkerfunc(@(t) starfish(t));
12% boundary condition. by symmetry of the starfish this integrates to zero
13pwfun = @(r) r(1,:).^2.*r(2,:);
14rhs = pwfun(chnkr.r); rhs = rhs(:);
16% kernel: normal derivative of the Laplace single-layer
17kernsp = kernel('lap','sprime');
19% matrix discretization of the BIE
20sysmat = chunkermat(chnkr,kernsp);
21sysmat = sysmat + 0.5*eye(chnkr.npt) + onesmat(chnkr);
23% solve
24sigma = gmres(sysmat,rhs);
26% grid for plotting
27x1 = linspace(-2,2,300);
28[xx,yy] = meshgrid(x1,x1);
29targs = [xx(:).'; yy(:).'];
30in = chunkerinterior(chnkr,targs);
31uu = nan(size(xx));
33% evaluate solution using the single layer (not its derivative)
34kerns = kernel('lap','s');
35uu(in) = chunkerkerneval(chnkr,kerns,sigma,targs(:,in));
37toc;
39figure(1); clf
40h = pcolor(xx,yy,uu); set(h,'EdgeColor','none'); colorbar
41hold on; plot(chnkr,'k'); colormap(redblue)
moveopenescclose