Charges inside a disk¶
Two charges of opposite sign in a disk with vacuum outside, on a grid that follows the disk.
import sympy as sp
import pdemagic as pm
r, angle = sp.symbols("r alpha", real=True)
V = sp.Function("V")(r, angle)
disk = pm.Disk(r, angle, radius=1.0)
dx, dy = disk.cartesian
blobs = sp.exp(-8 * ((dx - 0.4) ** 2 + dy**2)) - sp.exp(-8 * ((dx + 0.4) ** 2 + dy**2))
pm.solve(pm.Problem(sp.Eq(-pm.laplacian(V), blobs), domain=disk)).plot()
What it shows¶
Poisson’s equation in polar coordinates. The domain is a disk, and no
condition is given on its rim: outside is vacuum, as in free space, and
the potential is what the charges make by themselves. The charges sit
off the centre, so they are written in Cartesian coordinates, which
disk.cartesian gives as formulas in the radius and the angle. The
picture is drawn on the disk, up to its rim.
What pdemagic decided¶
The planner recognised a Poisson equation in a disk with vacuum outside
and chose the method of angular harmonics (harmonics). The grid has
Gauss points along the radius and equally spaced angles: 48 by 96
points, the coarsest candidate that resolves the charges.