1function g = laplace2d_bdata_branch(t, a, k, x0, y0, th0)
2% LAPLACE2D_BDATA_BRANCH Dirichlet data for the branch-point family.
3% The exact solution is u*(z) = Re sqrt(w), w = -(z - z0) e^{-i th0},
4% with z0 = x0 + i y0 the branch point and th0 its polar angle. The
5% principal branch cut w <= 0 maps to the radial ray from z0 away from
6% the origin, which never meets a domain star-shaped about the origin,
7% so u* is harmonic on the closed domain. Evaluated in real arithmetic:
8% Re sqrt(w) = sqrt((|w| + Re w)/2).
9% Called through the prob.g handle built in build_problem; solvers see
10% only that handle. Must match the branch-point case of exactU in
11% src/problems/laplace2d/exact.ts.
12r = 1 + a*cos(k*t);
13x = r.*cos(t);
14y = r.*sin(t);
15dx = x - x0;
16dy = y - y0;
17wre = -(dx*cos(th0) + dy*sin(th0));
18wim = -(dy*cos(th0) - dx*sin(th0));
19g = sqrt((sqrt(wre.^2 + wim.^2) + wre)/2);
20end