# NDSolveValue for the Laplace equation not converging on the analytic solution

I solve Laplace's equation $$nabla ^ 2 phi = 0$$ with BC $$phi_x (x = pm 1) = 0, , phi_y (y = -h) = 0$$ with a specified BC along the arc $$x ^ 2 + (-1 + y) ^ 2 = 4$$, whom I'm calling $$Gamma$$ (so the domain $$Omega$$ is like a rectangular box with a circular arc $$Gamma$$ like the lid).

What I did is take the analytical solution $$phi_A = cos ( pi m (x + 1) / 2) cosh ( pi m (y + h) / 2): m in mathbb {N}$$ and evaluated its normal derivative on $$Gamma$$, then set this as the Neumann limit condition for the top cover. Since this does not give a single solution (no Dirichlet BC), I also give PDE to BC $$phi = phi_A (1, Gamma (x = 1))$$. However, the numerical solution does not correspond to the analytical solution. The code is provided below, which shows the domain $$Omega$$ to clarify more.

``````h = 2;
r = 2;
yp = 1;
m = 1;
[CapitalOmega] =
Implicit region[-1 <= x <= 1 && -h <= y <=
2 &&! (x ^ 2 + (y - yp) ^ 2 <= r^2), {x, y}];
Region[[CapitalOmega]]
[Phi]A = Cos[([Pi] m)/2 (x + 1)] Cosh[([Pi] m)/2 (y + h)];
g = [Phi]A /. y -> -Sqrt[r^2 - x^2] + yp /. x -> 1;
dn [Phi]A = Grad[[[[[Phi]A, {x, y}

. ({x, y} / Sqrt[x^2 + y^2])
dn [Phi][CapitalGamma]A = dn [Phi]A /. y -> -Sqrt[r^2 - x^2] + yp;
op = laplacian[[[[[Phi]re[x, y], {x, y}];
[CapitalGamma]NV = NeumannValue[Dn[Dn[dn[dn[Phi]A, x ^ 2 + (y-yp) ^ 2 == r ^ 2];
[CapitalGamma] = {DirichletCondition[[[[[Phi]re[x, y] == g,
x == 1 && y == -Sqrt[r^2 - 1^2] + yp]};
Needs["NDSolve`FEM`"]
mesh = ToElementMesh[[[[[CapitalOmega], MaxCellMeasure -> 0.01];
mesh["Wireframe"]
[Phi] = NDSolveValue[{Op==[{Op==[{op==[{op==[CapitalGamma]NV,[CapitalGamma]},
[Phi]D, {x, y} [Element] mesh, InterpolationOrder -> 3];
Plot3D[{[{[{[{[Phi][x, y][Phi]A}, {x, y} [Element] [CapitalOmega],
AxesLabel -> {"x", "y", "[Phi]"}]
``````