advanced32 min studyLesson 928 in Physics

Electrostatic Poisson solvers and boundaries

Solve a tiny Dirichlet system and identify the compatibility and gauge constraints of periodic or Neumann electrostatics.

On this page

What you’ll understand

  • Form a signed finite-difference Poisson matrix with units.
  • Compare algebraic residual with discretization error.
  • Distinguish a missing compatibility condition from an arbitrary potential constant.

An electrostatic field solve is incomplete until its domain and boundary conditions are specified. Poisson's equation with fixed potentials can have a unique solution, whereas periodic or pure Neumann problems retain a constant-potential ambiguity and impose a source compatibility condition. These are physical and mathematical features, not solver inconveniences. A small finite-difference system lets us compute the potential, field and residual by hand, then distinguish solving those algebraic equations accurately from approximating the continuum electrostatic problem accurately.

Build a signed discrete boundary-value problem

For one-dimensional SI electrostatics, minus the second derivative of potential equals charge density divided by permittivity. A centered difference gives a positive diagonal and negative neighbor coefficients when written as a positive definite Dirichlet matrix. Boundary potential terms move to the right-hand side for interior unknowns. Multiplying the equation by the squared spacing makes every matrix-equation component have potential units; retaining the divided form instead gives a residual with potential per length squared units.

The electric field is minus the potential gradient. It may be stored at cell faces or computed by a specified centered node difference; these choices have different boundary and Gauss-law interpretations. Our hand calculation uses centered node fields only as a declared diagnostic. A physical electrode potential, an imposed normal flux and a periodic identification constrain different quantities. Choosing a zero potential on a boundary is not generally equivalent to choosing the mean potential as a gauge in a periodic domain.

−ϕ′′=ρ/ϵ0,2ϕj−ϕj−1−ϕj+1=h2ρj/ϵ0,Ej=−ϕj+1−ϕj−12h-\phi^{\prime\prime}=\rho/\epsilon_0,\qquad 2\phi_j-\phi_{j-1}-\phi_{j+1}=h^2\rho_j/\epsilon_0,\qquad E_j=-\frac{\phi_{j+1}-\phi_{j-1}}{2h}
φ is in volts, h in meters, ρ/ε0 in volts per meter squared and E in volts per meter. The centered interior stencil assumes a uniform one-dimensional mesh.↔ Scroll wide equations horizontally.

Reduce the algebraic error without mistaking it for continuum error

Write the discrete equations as Aφ = b and an approximate solution as φtilde. Its residual is b minus Aφtilde, while its algebraic solution error is the inverse matrix applied to that residual. A small residual is useful only relative to consistent norms, units and the conditioning of A. Refining the mesh can worsen the matrix condition number, so the same unscaled residual threshold need not imply the same potential error on every grid.

Jacobi iteration updates each unknown from the previous iteration's neighbors. It is simple to inspect but often slow for long-wavelength error, motivating multigrid or other preconditioned methods on larger problems. Iteration count is not physical elapsed time. Once algebraic error is small compared with truncation error, further iterations do little to improve the continuum approximation. A separate grid study, with consistent boundary data, measures the error remaining from replacing derivatives and geometry by discrete representations.

r=b−Aϕ~,e=ϕ−ϕ~=A−1r,∥e∥≤∥A−1∥ ∥r∥r=b-A\widetilde\phi,\qquad e=\phi-\widetilde\phi=A^{-1}r,\qquad \|e\|\le\|A^{-1}\|\,\|r\|
Here φ is the exact solution of the discrete system, not automatically the continuum potential. A must be invertible on the specified space; nullspace problems require a gauge-restricted inverse or equivalent formulation.↔ Scroll wide equations horizontally.

Apply compatibility before fixing a gauge

Summing a periodic discrete Laplacian cancels all neighbor differences. Its source must therefore have zero mean. A pure Neumann continuum problem has a corresponding relation between integrated source and outward normal derivative; if it holds, an additive constant remains arbitrary. Fixing one value or the mean removes that nullspace but cannot make an incompatible source solvable. Silently subtracting the source mean changes the physical problem unless a neutralizing background was intentionally part of the model.

Residuals and electric fields can be insensitive to a constant potential shift, which is why the gauge should be stated in reproducibility records. Boundary discretization also affects force accuracy near electrodes even when an iterative solve is exact. The optimization lab illustrates a convergent or divergent scalar iteration with a selectable step parameter. It has no Poisson matrix, spatial mesh, electrodes, nullspace or charge source and therefore cannot verify this electrostatic boundary-value solver.

∑j(2ϕj−ϕj−1−ϕj+1)=0 ⟹ ∑jbj=0on a uniform periodic grid\sum_j (2\phi_j-\phi_{j-1}-\phi_{j+1})=0\ \Longrightarrow\ \sum_j b_j=0\quad\text{on a uniform periodic grid}
Indices wrap periodically and b is the spacing-scaled source. The constant vector is a null vector of A; zero-mean b is compatibility, while fixing mean φ is a distinct gauge convention.↔ Scroll wide equations horizontally.

Two interior potentials and a residual

Place nodes at x = 0,1,2,3 m with φ0 = φ3 = 0 V and ρ/ε0 = 1 V/m² at each interior node. Solve the two interior equations, compute centered fields there and compare with two Jacobi iterations started from zero.

  1. The matrix is A = [[2,−1],[−1,2]] and b = (1,1) V. Symmetry and substitution give the exact discrete potentials φ1 = φ2 = 1 V.

  2. Centered differentiation gives E1 = −(1 − 0)/2 = −0.5 V/m and E2 = −(0 − 1)/2 = +0.5 V/m. The signs reflect a positive potential hump.

  3. Jacobi gives (0.5,0.5) V after one iteration and (0.75,0.75) V after two. At that point Aφtilde = (0.75,0.75) V, so the scaled residual is (0.25,0.25) V. The exact discrete solve removes this algebraic residual, not every continuum discretization error in a general problem.

The result

The discrete interior potentials are (1,1) V, fields (−0.5,+0.5) V/m and the two-iteration scaled residual (0.25,0.25) V.

Explore the model

Interactive lab

Interactive lab · optimization

Iteration stability without a field solve

Reset and set BOTH Step size η = 0.50 and Initial position x₀ = 2; predict geometric convergence to zero. Reset and set η = 2.20 and x₀ = 2; predict alternating growth and eventual Outside plot reporting. This is scalar gradient descent on x²/2, not Jacobi on a Poisson grid, a boundary-condition test or an electrostatic field solver.

Iteration stability without a field solveGradient descent on f(x) = x²/2: xₙ = (1 − η)ⁿx₀. Playback advances two discrete iterations per second. Values outside |x| ≤ 4 are explicitly reported. Current readings: Position x0: 2; Objective x²/2: 2; Iteration behavior: Stable step. All parameters are adjustable with the labeled controls below.−4−202402.174.356.528.7Parameter xf(x) = x²/2n = 0
ObjectiveDiscrete iterate
Position x0
2
Objective x²/2
2
Iteration behavior
Stable step
n = 0 · t = 0 s

Gradient descent on f(x) = x²/2: xₙ = (1 − η)ⁿx₀. Playback advances two discrete iterations per second. Values outside |x| ≤ 4 are explicitly reported. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forA stable algebraic iteration needs its own analysis, distinct from the physical boundary problem.

Check your understanding

A periodic Poisson source has nonzero total charge. What does fixing the mean potential to zero accomplish?

Try it yourself

A uniform four-node periodic discrete system has scaled source b = (1,0,0,0) V. Test compatibility. If a declared uniform neutralizing background is introduced, what corrected source results? Explain why fixing one potential alone is insufficient.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Sum the four equations first. The periodic neighbor terms telescope to zero regardless of the potential values.

Compare with the solution

The source sum is 1 V, so the original periodic system is incompatible. Subtracting its mean, 0.25 V, produces bnew = (0.75,−0.25,−0.25,−0.25) V with zero sum. This new system is solvable up to an additive potential constant, which can then be fixed by a gauge condition. The subtraction represents a changed physical source and must be declared. Fixing one potential in the original incompatible problem cannot supply the missing charge balance; deleting an equation to force a result would instead hide an unsatisfied physical constraint.

Take it with you

  • Poisson boundary conditions determine uniqueness and compatibility.
  • An algebraic residual is not a continuum discretization error.
  • A gauge choice cannot neutralize an incompatible periodic source.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.