A ball with a hot cap

A section through a ball whose surface is hot around one pole and cold elsewhere.

import sympy as sp
import pdemagic as pm

r, theta, phi = sp.symbols("r theta phi", real=True)
T = sp.Function("T")(r, theta, phi)
cap = sp.exp(-4 * (1 - sp.cos(theta)))

ball = pm.Problem(
    sp.Eq(pm.laplacian(T), 0),
    domain=pm.Ball(r, theta, phi, radius=1),
    boundary=sp.Eq(T, cap),
)
pm.solve(ball).plot(cut={phi: 0})
The figure that the example above draws. The figure that the example above draws.

What it shows

Laplace’s equation in a ball, in spherical coordinates. The one face of a ball is its surface, and the temperature that is given there depends on the angle from the axis: it is one at the pole and falls off around it. Inside, the heat spreads and evens out, and the centre has the mean of the surface. A solution in three dimensions is drawn as a section. With the angle around the axis held fixed, the section is the plane through the axis, with both of its halves.

What pdemagic decided

The planner chose collocation along the radius with spherical harmonics along the angles (collocation). The grid has 32 Gauss points along the radius, 32 along the angle from the axis and 64 around it, the coarsest candidate that resolves the solution and the cap to \(10^{-10}\).

More