# Laplace equation conducting sphere

I'm trying to solve the Laplace equation for a conducting sphere of radius $r$ and potential $V0$.

I impose that on the surface the potential is $V0$ and that at long distance from the center the potential is null.

The exact solution is known so I can verify my result, and what I obtain is wrong.

This is my simple code:

    r = 1.5;
V0 = 0.6;
lim = 100 r;
Domain = RegionDifference[Disk[{0, 0}, lim], Disk[{0, 0}, r]];
sol1 = NDSolveValue[{D[u[x, y], x, x] + D[u[x, y], y, y] == 0,
DirichletCondition[u[x, y] == V0, x^2 + y^2 == r^2],
DirichletCondition[u[x, y] == 0, x^2 + y^2 >= lim^2]},
u, {x, y} ∈ Domain];
Plot[{V0 r/Sqrt[x^2], sol1[x, 0]}, {x, -2, 8}]


I don't understand where i'm wrong.

My ultimate goal is to work with three spheres, but if I can not even with one ...

• Are you sure the "exact solution" is correct? Try D[V0 r/Sqrt[x^2], x, x] + D[V0 r/Sqrt[x^2], y, y]. – Marius Ladegård Meyer Jan 4 '17 at 14:04
• Also, you are solving the DE numerically in the annulus $r^2 < x^2 + y^2 < lim^2$, so you should not expect the plot to be meaningful for $|x| < r$ when $y=0$. – Marius Ladegård Meyer Jan 4 '17 at 14:06
• Thanks for reply, but the solution must be the potential of a conducting sphere $\sim 1/|r|$ and i'm checking the solution for $|x|>r$. Where i'm wrong? – Kowalski Jan 4 '17 at 14:38
• The solution is not the same for a Disk (2D problem) and for a Sphere (3D problem). For the sphere V(r) is proportional to 1/r, for the Disk to Log[r] – andre314 Jan 4 '17 at 18:44
• Yes it is! Writing the solution as u[x, 0] = a(Log[x] + b) and solving for the boundary conditions gives u[x, 0] = V0(Log[x] - Log[lim])/(Log[r] - Log[lim]), which you can see agrees very well with the NDSolve curve by plotting it. Try Plot[{V0/(Log[r] - Log[lim]) (Log[x] - Log[lim]), sol1[x, 0]}, {x, r, lim}, PlotRange -> {{r, lim}, {0, V0}}] – Marius Ladegård Meyer Jan 4 '17 at 23:39

As requested in a comment, an answer:

In a 2D system with rotational invariance, the Laplace equation in polar coordinates is

$$\nabla^2 u(r,\theta) = \frac{\partial^2u}{\partial r^2} + \frac{1}{r} \frac{\partial u}{\partial r} = 0$$ Notice the $1/r$ here, which would have been a $2/r$ in the 3D case. The equation is separable, so introducing $v = \partial u / \partial r$ gives

$$\frac{1}{v} \frac{\partial v}{\partial r} = - \frac{1}{r}$$ with solution $$v = \frac{a}{r}$$ and thus $$u(r) = a(\ln r + b)$$ The boundary conditions $u(r') = V_0$, $u(L) = 0$ give

$$u(r) = \frac{V_0(\ln r - \ln L)}{\ln r' - \ln L}$$

Now, the solution from NDSolve is demonstrably very good:

r = 1.5;
V0 = 0.6;
lim = 100 r;

formula = V0(Log[x] - Log[lim])/(Log[r] - Log[lim]);

Domain = RegionDifference[Disk[{0, 0}, lim], Disk[{0, 0}, r]];
sol1 = NDSolveValue[{D[u[x, y], x, x] + D[u[x, y], y, y] == 0,
DirichletCondition[u[x, y] == V0, x^2 + y^2 == r^2],
DirichletCondition[u[x, y] == 0, x^2 + y^2 >= lim^2]},
u, {x, y} ∈ Domain];
Plot[{formula, sol1[x, 0]}, {x, r, lim}] Plot[Abs[formula - sol1[x, 0]], {x, r, lim}, PlotRange -> All] 