|
| 1 | +function submat = kern(srcinfo, targinfo, origin, type) |
| 2 | +%CHNK.AXISSYMLAP2D.KERN axissymmetric Laplace layer potential kernels in 2D |
| 3 | +% |
| 4 | +% Syntax: submat = chnk.axissymlap2d.kern(srcinfo,targingo,type) |
| 5 | +% |
| 6 | +% Let x be targets and y be sources for these formulas, with |
| 7 | +% n_x and n_y the corresponding unit normals at those points |
| 8 | +% (if defined). Note that the normal information is obtained |
| 9 | +% by taking the perpendicular to the provided tangential deriviative |
| 10 | +% info and normalizing |
| 11 | +% |
| 12 | +% Here the first and second components correspond to the r and z |
| 13 | +% coordinates respectively. |
| 14 | +% |
| 15 | +% Kernels based on G(x,y) = \int_{0}^{\pi} 1/(d(t)) \, dt \, |
| 16 | +% where d(t) = \sqrt(r^2 + r'^2 - 2rr' \cos(t) + (z-z')^2) with |
| 17 | +% x = (r,z), and y = (r',z') |
| 18 | +% |
| 19 | +% D(x,y) = \nabla_{n_y} G(x,y) |
| 20 | +% S(x,y) = G(x,y) |
| 21 | +% S'(x,y) = \nabla_{n_x} G(x,y) |
| 22 | +% D'(x,y) = \nabla_{n_x} \nabla_{n_y} G(x,y) |
| 23 | +% |
| 24 | +% Input: |
| 25 | +% srcinfo - description of sources in ptinfo struct format, i.e. |
| 26 | +% ptinfo.r - positions (2,:) array |
| 27 | +% ptinfo.d - first derivative in underlying |
| 28 | +% parameterization (2,:) |
| 29 | +% ptinfo.d2 - second derivative in underlying |
| 30 | +% parameterization (2,:) |
| 31 | +% targinfo - description of targets in ptinfo struct format, |
| 32 | +% if info not relevant (d/d2) it doesn't need to |
| 33 | +% be provided. sprime requires tangent info in |
| 34 | +% targinfo.d |
| 35 | +% type - string, determines kernel type |
| 36 | +% type == 'd', double layer kernel D |
| 37 | +% type == 's', single layer kernel S |
| 38 | +% type == 'sprime', normal derivative of single |
| 39 | +% layer S' |
| 40 | +% |
| 41 | +% |
| 42 | +% Output: |
| 43 | +% submat - the evaluation of the selected kernel for the |
| 44 | +% provided sources and targets. the number of |
| 45 | +% rows equals the number of targets and the |
| 46 | +% number of columns equals the number of sources |
| 47 | +% |
| 48 | +% |
| 49 | + |
| 50 | +src = srcinfo.r; |
| 51 | +targ = targinfo.r; |
| 52 | + |
| 53 | +[~, ns] = size(src); |
| 54 | +[~, nt] = size(targ); |
| 55 | + |
| 56 | +if strcmpi(type, 'd') |
| 57 | + srcnorm = srcinfo.n; |
| 58 | + [~, grad] = chnk.axissymlap2d.green(src, targ, origin); |
| 59 | + nx = repmat(srcnorm(1,:), nt, 1); |
| 60 | + ny = repmat(srcnorm(2,:), nt, 1); |
| 61 | + % Due to lack of translation invariance in r, no sign flip needed, |
| 62 | + % as gradient is computed with repsect to r' |
| 63 | + submat = (grad(:,:,2).*nx + grad(:,:,3).*ny); |
| 64 | +end |
| 65 | + |
| 66 | +if strcmpi(type, 'sprime') |
| 67 | + targnorm = targinfo.n; |
| 68 | + [~, grad] = chnk.axissymlap2d.green(src, targ, origin); |
| 69 | + |
| 70 | + nx = repmat((targnorm(1,:)).',1,ns); |
| 71 | + ny = repmat((targnorm(2,:)).',1,ns); |
| 72 | + submat = (grad(:,:,1).*nx - grad(:,:,3).*ny); |
| 73 | + |
| 74 | +end |
| 75 | + |
| 76 | +if strcmpi(type, 's') |
| 77 | + submat = chnk.axissymlap2d.green(src, targ, origin); |
| 78 | + |
| 79 | +end |
| 80 | + |
| 81 | + |
0 commit comments