A9 · Lesson 48 · Lab: Poisson's equation
Potentials from charge, by integration and relaxation
Lesson 47 solved Poisson's equation by hand where symmetry made it one-dimensional. In this lab you'll solve it numerically: integrate a junction's charge twice to get its built-in voltage, relax a two-dimensional grid with a charge inside, see how much over-relaxation speeds convergence, and build potentials by adding up the contributions of small pieces of charge, a ring and a ball, checking each against its formula.
- The curve is the potential of a uniformly charged ball of radius , in units where for a reference radius.
- Outside, it's , as if all the charge were at the center. Inside, it's a downward parabola, reaching of the surface value at the center.
- Shrink the ball: the same charge packed tighter raises the center potential, as says.
Predict
Jacobi relaxation on a 20 × 20 grid takes 369 sweeps to converge. About how many does successive over-relaxation (SOR) with the best factor take?
About 45: 44, in fact. SOR updates each point using the newest neighbor values and overshoots the average by a factor ; with , the number of sweeps grows like instead of . On a 200 × 200 grid the advantage would be about 100 times.
Name it
One dimension: integrate twice
can be integrated directly: the field is from a point where , and . Cumulative sums (np.cumsum with the trapezoid rule) do both steps on a grid.
Two dimensions: relaxation
On a grid with spacing , becomes
- Jacobi recomputes every point from the previous sweep's values. Vectorized with NumPy slices, each sweep is fast, but it needs about sweeps.
- Gauss–Seidel uses each new value as soon as it's computed.
- SOR moves each point times as far as Gauss–Seidel would, with ; the best for a square grid is .
Superposition
over small pieces of charge. It needs no grid or boundary, just a sum, and it's exact in the limit of small pieces.
Worked example
A ring of radius carries charge . What is the potential on its axis?
Show the solution
- Same distance from every piece. Every piece of the ring is the same distance from a point on the axis, so the sum is simply
- Put in numbers. For 1 nC on a ring of radius 5 cm, at 12 cm along the axis:
- Compare with a numerical sum. A numerical sum over the ring's pieces gives the same, since every term is equal. Off the axis the distances vary and the sum needs a computer.
Answer , which is 69.1 V for 1 nC on a 5 cm ring at 12 cm.
Worked example
What does the grid equation give for on the unit square with on the edges?
Show the solution
- Relax the grid. Relaxing a 40 × 40 grid until it stops changing gives a dome with its peak at the center, .
- Compare with the exact value. The exact value for the continuous problem is 0.073 671, so the grid is within 0.1%.
- Interpret. This is the shape of a uniformly loaded square membrane, and of the potential in a uniformly charged square region inside a grounded box.
Answer a dome peaking at in the center.
Check
A ring of radius 3 cm carries 1 nC. What is the potential on its axis, 12 cm from its center?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
Check
What is the best SOR factor for a 50 × 50 grid?
Check
A 1D junction has on and on ( = 3), zero elsewhere. On a grid of 20 001 points from to 1.5, integrate twice (trapezoid cumulative sums, and at the left end, , ), and set Vbi to at the right end.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Solve on the unit square with on the edges, using vectorized Jacobi on a 41 × 41 grid of points (spacing ) until the largest change in a sweep is below . Set Vc to the center value.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
On a 21 × 21 grid with on the top edge and 0 on the others, count the Gauss–Seidel sweeps () and the SOR sweeps () needed until the largest change in a sweep is below . Set it_gs and it_sor, and Vc to SOR's center value.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Build the potential on the axis of a ring (radius 5 cm, 1 nC) by summing over 1000 pieces, at = 12 cm. Set V and formula.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Find the potential at the center of a uniformly charged ball ( = 1 nC, = 10 cm) by adding thin shells: a shell of radius and charge contributes at the center. Use 10 000 midpoint shells and set Vc and formula ().
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Explain why
Why does relaxation on a fine grid converge so slowly, and why does over-relaxation help?
Each Jacobi or Gauss–Seidel sweep only lets information travel one grid point: a point learns about the boundary through a chain of neighbors averaging each other. Smooth, large-scale errors, a whole region sitting slightly too high, are barely reduced by local averaging, and on an grid it takes on the order of sweeps for them to decay. Over-relaxation pushes each point past the local average in the direction it was already moving, which carries those large-scale corrections across the grid much faster, so the sweeps needed grow only like . Multigrid methods go further by solving the smooth error on coarser grids, where it isn't smooth any more.
Practice
Keep practicing
5 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.