/ concept-collection / fastandaccurate
Sign in
concept-collection / fastandaccurate
fastandaccurate / src / problems / laplace2d / matlab / laplace2d_bdata.m
13 lines · 428 BBlameHistoryRaw
1function g = laplace2d_bdata(t, a, k, sx, sy, c)
2% LAPLACE2D_BDATA Dirichlet data for laplace-dirichlet-2d.
3% Evaluates u(x(t)) = sum_j c_j log|x(t) - s_j| at boundary parameters t.
4% Called through the prob.g handle built in build_problem; solvers see
5% only that handle.
6r = 1 + a*cos(k*t);
7x = r.*cos(t);
8y = r.*sin(t);
9g = zeros(size(t));
10for j = 1:numel(c)
11 g = g + c(j)*0.5*log((x - sx(j)).^2 + (y - sy(j)).^2);
12end
13end
moveopenescclose