Flow Lab

Syllabus / Module 9: Classical PDEs: Heat, Waves & Potentials

Lesson 9.6

Laplace's Equation: Rectangles & Disks

Steady states, harmonic functions, separation in Cartesian and polar coordinates, Poisson's formula, the mean value property.

Written byClaude Sonnet

🌊
Why this matters for simulation: Potential flow (ideal, irrotational) satisfies Laplace's equation; so does the pressure correction in Stam's solver.

By the end of this lesson you can…

  • Define harmonic functions, recognise $\nabla^2 u = 0$ (Laplace) and $\nabla^2 u = f$ (Poisson), and read both as 'the value equals the average of its neighbours'.
  • Solve the rectangle problem by separation of variables: sines across, sinh along, coefficients from a sine series of the edge data.
  • Solve the disk problem in polar coordinates, get $u = \tfrac12 a_0 + \sum r^n(a_n\cos n\theta + b_n\sin n\theta)$, and sum it into the Poisson integral formula.
  • State and use the mean value property, then derive the maximum principle and uniqueness from it.
  • Run Jacobi, Gauss-Seidel and SOR relaxation on a plate, say why Jacobi needs about $1/h^2$ sweeps, and tell a small residual from a small error.
  • Connect Laplace's equation to potential flow and to the pressure Poisson equation of a fluid solver.
On this page
·
  1. Harmonic functions and the neighbor average
  2. The rectangle: separation of variables
  3. The disk: polar separation and Poisson’s formula
  4. Mean value, maximum principle, uniqueness
  5. Relaxation: computing a harmonic function
  6. The lab
  7. Computing it
  8. Concept checks
  9. Problems
  10. Key Takeaways

Switch off time in the heat equation and wait. What remains is the steady state, and in one dimension we already found it: 9.2 The Heat (Diffusion) Equation showed that uxx=0u_{xx} = 0 gives a straight line between the two end temperatures. On a plate the same wait gives Laplace’s equation, uxx+uyy=0u_{xx} + u_{yy} = 0, and the straight line becomes a surface held up only by its edges. It is the equation behind the velocity potential of ideal flow around a wing and the pressure that Stam’s solver computes at every time step. This lesson solves it exactly on a rectangle and a disk, extracts its three great properties (mean value, maximum principle, uniqueness), and then computes it as a simulator does, by relaxation. Separation of variables is done in full, since the heat and wave equations need it too.

▶ Video A plate with a hot top edge relaxing to its steady state, the neighbour average, sines across and sinh along, a disk solved by r to the n, and the mean value and maximum principlecaptions only
Transcript
  1. Switch off time in the heat equation and wait. In one dimension the steady state is a straight line. On a plate it obeys Laplace's equation, u x x plus u y y equals 0: a surface held up only by its edges.
  2. A function with zero Laplacian is called harmonic. So are x, x y, x squared minus y squared and e to the x cosine y, but not x squared plus y squared, whose Laplacian is 4. Add a source f on the right and it is Poisson's equation.
  3. The Laplacian measures how far u sits from the average of its surroundings: on a grid, the four neighbours minus 4 u, over h squared. So Laplace's equation says each point equals the average of its four neighbours: no bumps and no dips.
  4. Give u on the edge and find the harmonic function inside. On a rectangle, with 0 on three sides and f on top, try a product X of x times Y of y. Both sides of the divided equation must be a constant, minus lambda, and only positive lambda gives sines across, with sinh along.
  5. Any sum of these products is harmonic and zero on three sides. Matching the top edge asks for a sine series of f, which gives b n. For f equal to 1, b n is 4 over n pi for odd n. One term is a rough hump; adding n equals 3 flattens the top.
  6. At the centre of the unit square the first term gives 0.25372, adding n equals 3 gives 0.24990, and the next gives 0.25000: one quarter. The mode strength dies like e to the minus n pi times 1 minus y, so a ripple is down by 1 over e at only wavelength over 2 pi from its edge.
  7. On a disk, use polar coordinates. A periodic angle forces an integer n, and the radial solutions are r to the n or r to the minus n. The second blows up at the centre, so keep r to the n, with the Fourier coefficients of the edge data. Edge data cosine 2 theta gives the saddle.
  8. Take edge data 1 on the upper half and 0 on the lower. Then b n is 2 over n pi for odd n, and the series sums to an arctangent. At r equal one half, theta equal pi over 2, it reads 0.79517, and the partial sums home in.
  9. Put the coefficients back into the series and the bracket is a geometric series: Poisson's integral formula. The kernel is positive, integrates to 1, and spikes at phi equals theta as r goes to 1, so each interior value is a weighted average of the edge.
  10. At the centre r is 0, the kernel is 1, and the value is the average over the circle: the mean value property, for any harmonic function and any circle. For the hot quarter arc, the boundary average, the grid centre and the Poisson centre all read 0.25.
  11. Consequences. An interior maximum M would be the average of values at most M on a small circle, so all equal M: extremes live on the boundary. Two solutions with the same edge data differ by a harmonic function that is 0 on the edge, so the solution is unique.
  12. To compute it, replace each interior value by the average of its neighbours: Jacobi iteration, the explicit heat step at r equal 1 over 4. To reach a residual of 10 to the minus 6, Jacobi needs 2309 sweeps, Gauss-Seidel 1166, and SOR at omega 1.85 only about 95.
  13. Why so many? Jacobi multiplies the slowest error mode by cosine pi h, which is 0.99692 at h equal 1 over 40. Sweeps scale like 1 over h squared: 10, 20 and 40 intervals take 197, 687 and 2309. The best SOR factor gives 0.8545, and needs only about 1 over h.
  14. A small residual is not a small error. The residual is only 1 minus rho times the error, so Jacobi at h equal 1 over 40 can hide an error 324 times its residual, and the converged grid keeps its discretization error. Set the tolerance from the grid.
  15. Why care? Ideal flow is irrotational and incompressible, so the velocity is the gradient of a potential phi that obeys Laplace's equation. In Stam's solver the pressure obeys a Poisson equation every time step, so 1 over h squared sweeps is the bottleneck.
  16. To recap. A harmonic function is the average of its neighbours. The rectangle gives sinh, the disk gives r to the n, and the mean value property gives the maximum principle and uniqueness. Jacobi needs about 1 over h squared sweeps, SOR about 1 over h.
  17. Next, the finite-difference lesson. Here we took the five-point stencil and the boundary arm weights on trust. There we derive them from Taylor series, and measure how fast the grid error shrinks as h does.

Harmonic functions and the neighbor average

A function with ∇2u=uxx+uyy=0\nabla^2 u = u_{xx} + u_{yy} = 0 is called harmonic. Members: xx, xyxy, x2−y2x^2 - y^2, excos⁡ye^x\cos y (uxx=excos⁡yu_{xx} = e^x\cos y, uyy=−excos⁡yu_{yy} = -e^x\cos y). Non-member: x2+y2x^2 + y^2, whose Laplacian is 44. With a source on the right, ∇2u=f\nabla^2 u = f is Poisson’s equation.

The reading from 2.11 The Laplacian & Vector Identities is the one to keep: ∇2u\nabla^2 u measures how far uu at a point sits from the average of uu around it. On a grid with spacing hh,

∇2u≈uE+uW+uN+uS−4uh2.\nabla^2 u \approx \frac{u_E + u_W + u_N + u_S - 4u}{h^2}.

So Laplace’s equation says u=14(uE+uW+uN+uS)u = \tfrac14(u_E + u_W + u_N + u_S): every point is the average of its four neighbors, with no bumps and no dips. (The stencil is derived in the finite-difference lesson; here it is the discrete mean value property, taken on trust.)

The problem is a boundary-value problem: give uu on the edge (a Dirichlet condition) and find the harmonic function inside. Giving the normal derivative instead (a Neumann condition, a prescribed heat flux) works too, with one catch from the divergence theorem: the net flux ∮∂u/∂n ds\oint \partial u/\partial n\,ds must equal ∬f dA\iint f\,dA, so with f=0f = 0 the fluxes must cancel. The pressure below meets that exact condition.

The rectangle: separation of variables

Take 0<x<a0 \lt x \lt a, 0<y<b0 \lt y \lt b, with u=0u = 0 on the left, right and bottom, and u(x,b)=f(x)u(x, b) = f(x) on top. Try a product u=X(x) Y(y)u = X(x)\,Y(y). Then X′′Y+XY′′=0X''Y + XY'' = 0, and dividing by XYXY,

X′′X=−Y′′Y=−λ.\frac{X''}{X} = -\frac{Y''}{Y} = -\lambda .

The left side depends only on xx, the right side only on yy, and they are equal, so both are a constant, which we call −λ-\lambda. The two ordinary differential equations are X′′+λX=0X'' + \lambda X = 0 and Y′′=λYY'' = \lambda Y.

The boundary conditions pick the sign. XX must vanish at x=0x = 0 and x=ax = a; for λ≤0\lambda \le 0 the solutions are exponentials or lines, which cross zero at most once, so only λ>0\lambda \gt 0 works. This is the two-point BVP of 8.1 Two-Point Boundary Value Problems, with nonzero solutions only for

λn=(nπa)2,Xn=sin⁡nπxa,n=1,2,3,…\lambda_n = \left(\frac{n\pi}{a}\right)^2, \qquad X_n = \sin\frac{n\pi x}{a}, \qquad n = 1, 2, 3, \dots

For YY, with Y′′=λnYY'' = \lambda_n Y and Y(0)=0Y(0) = 0, we get Yn=sinh⁡(nπy/a)Y_n = \sinh(n\pi y/a). Each product sin⁡(nπx/a)sinh⁡(nπy/a)\sin(n\pi x/a)\sinh(n\pi y/a) is harmonic and vanishes on three sides, and so does any sum, so write

u(x,y)=∑n=1∞bnsin⁡nπxa  sinh⁡(nπy/a)sinh⁡(nπb/a),u(x,y) = \sum_{n=1}^\infty b_n \sin\frac{n\pi x}{a}\;\frac{\sinh(n\pi y/a)}{\sinh(n\pi b/a)},

where the division by sinh⁡(nπb/a)\sinh(n\pi b/a) makes the top-edge value ∑bnsin⁡(nπx/a)\sum b_n \sin(n\pi x/a). Matching u(x,b)=f(x)u(x,b) = f(x) asks for a sine series of ff, so

bn=2a∫0af(x)sin⁡nπxa dx.b_n = \frac{2}{a}\int_0^a f(x)\sin\frac{n\pi x}{a}\,dx .

Example. Unit square, f=1f = 1 on top, 00 elsewhere. Then bn=2∫01sin⁡nπx dx=2(1−cos⁡nπ)/(nπ)b_n = 2\int_0^1\sin n\pi x\,dx = 2(1 - \cos n\pi)/(n\pi), which is 4/(nπ)4/(n\pi) for odd nn and 00 for even nn. At the center,

u(12,12)=∑n odd4nπ sin⁡(nπ/2)2cosh⁡(nπ/2).u\left(\tfrac12,\tfrac12\right) = \sum_{n\ \mathrm{odd}} \frac{4}{n\pi}\,\frac{\sin(n\pi/2)}{2\cosh(n\pi/2)} .

The n=1n = 1 term is 0.253720.25372, adding n=3n = 3 gives 0.249900.24990, and the playground below prints the next, 0.250000.25000: the answer is 1/41/4.

Why so fast? The factor sinh⁡(nπy)/sinh⁡(nπ)≈e−nπ(1−y)\sinh(n\pi y)/\sinh(n\pi) \approx e^{-n\pi(1-y)} is the mode’s strength at distance 1−y1 - y from the edge that drives it. Where the heat equation killed short wavelengths in time, Laplace’s equation kills them in distance: a ripple of wavelength ℓ\ell is down by 1/e1/e at only ℓ/2π\ell/2\pi from its edge, and the interior sees just the broad shape of the boundary. The price is at the edge itself. With f=1f = 1 the data jump at the top corners, the coefficients fall only like 1/n1/n, and the series is slow there (so is the grid). A general edge set is four such problems added together, swapping xx and yy for the side edges; the lab’s exact panel does that.

The disk: polar separation and Poisson’s formula

For a disk, use polar coordinates, where the Laplacian is

∇2u=1r∂∂r ⁣(r ∂u∂r)+1r2∂2u∂θ2.\nabla^2 u = \frac{1}{r}\frac{\partial}{\partial r}\!\left(r\,\frac{\partial u}{\partial r}\right) + \frac{1}{r^2}\frac{\partial^2 u}{\partial\theta^2}.

(The rr in the first term is the ring circumference the flux crosses.) Put u=R(r)Θ(θ)u = R(r)\Theta(\theta) and multiply through by r2/(RΘ)r^2/(R\Theta):

r2R′′+rR′R=−Θ′′Θ=n2.\frac{r^2R'' + rR'}{R} = -\frac{\Theta''}{\Theta} = n^2 .

Periodicity in θ\theta forces the constant to be n2n^2 with n=0,1,2,…n = 0, 1, 2, \dots and Θ=cos⁡nθ, sin⁡nθ\Theta = \cos n\theta,\ \sin n\theta, the role the end conditions played for the rectangle. The radial equation r2R′′+rR′−n2R=0r^2R'' + rR' - n^2R = 0 is an Euler equation, solved by R=rkR = r^k with k2=n2k^2 = n^2, so R=rnR = r^n or r−nr^{-n} (and 11 or ln⁡r\ln r for n=0n = 0). The solutions with r−nr^{-n} or ln⁡r\ln r blow up at the center of a plate with no hole in it, so we keep rnr^n:

u(r,θ)=a02+∑n=1∞rn(ancos⁡nθ+bnsin⁡nθ),u(r,\theta) = \frac{a_0}{2} + \sum_{n=1}^\infty r^n\left(a_n\cos n\theta + b_n\sin n\theta\right),

with ana_n and bnb_n the Fourier coefficients of the edge data g(θ)g(\theta) on r=1r = 1 (an=1π∫02πgcos⁡nθ dθa_n = \frac1\pi\int_0^{2\pi} g\cos n\theta\,d\theta, similarly bnb_n). For radius RR, replace rnr^n by (r/R)n(r/R)^n.

Example. g=cos⁡2θg = \cos 2\theta gives u=r2cos⁡2θ=x2−y2u = r^2\cos 2\theta = x^2 - y^2: the saddle, harmonic as claimed. Second example: g=1g = 1 on the upper half (0<θ<π0 \lt \theta \lt \pi), 00 on the lower. Then a0/2=12a_0/2 = \tfrac12, every an=0a_n = 0, bn=2/(nπ)b_n = 2/(n\pi) for odd nn, and (a closed form, from memory) u=12+1πarctan⁡ ⁣(2rsin⁡θ/(1−r2))u = \tfrac12 + \tfrac1\pi\arctan\!\big(2r\sin\theta/(1 - r^2)\big), which at (12,π2)(\tfrac12, \tfrac\pi2) is 0.795170.79517; the playground sums the series toward it.

Put the coefficient integrals back into the series:

u(r,θ)=12π∫02πg(φ)[1+2∑n=1∞rncos⁡n(θ−φ)]dφ.u(r,\theta) = \frac{1}{2\pi}\int_0^{2\pi} g(\varphi)\left[1 + 2\sum_{n=1}^\infty r^n\cos n(\theta - \varphi)\right]d\varphi .

The bracket is Re 1+z1−z\mathrm{Re}\,\frac{1+z}{1-z} with z=rei(θ−φ)z = re^{i(\theta-\varphi)}, a geometric series, and it equals 1−r21−2rcos⁡(θ−φ)+r2\dfrac{1 - r^2}{1 - 2r\cos(\theta-\varphi) + r^2}. This is the Poisson integral formula:

u(r,θ)=12π∫02π1−r21−2rcos⁡(θ−φ)+r2 g(φ) dφ.u(r,\theta) = \frac{1}{2\pi}\int_0^{2\pi}\frac{1 - r^2}{1 - 2r\cos(\theta-\varphi) + r^2}\,g(\varphi)\,d\varphi .

The kernel is positive, integrates to 11, and as r→1r \to 1 spikes at φ=θ\varphi = \theta: the interior temperature is a weighted average of the edge temperatures, the nearest weighted most. Everything that follows is in this.

Mean value, maximum principle, uniqueness

Mean value property. At the center, r=0r = 0, the kernel is 11: u(0)=12π∫g dφu(0) = \frac{1}{2\pi}\int g\,d\varphi. The value at the center is the average over the circle. Moving the origin shows it for any harmonic function and any circle inside its domain: the continuous version of u=14(four neighbors)u = \frac14(\text{four neighbors}).

Maximum principle. A non-constant harmonic function on a bounded region takes its maximum and minimum on the boundary, never inside. Mechanism: if the maximum MM were reached at an interior point pp, then M=u(p)M = u(p) is the average of uu over a small circle around pp where every value is at most MM, so all equal MM. Repeating from those points spreads MM over the whole region: uu was constant. On the disk it is even more direct: the Poisson kernel is a positive weight, so uu cannot leave the range of gg.

Uniqueness. If two solutions u1,u2u_1, u_2 share boundary data, their difference is harmonic with zero data. By the maximum principle its maximum and its minimum are both 00, so u1=u2u_1 = u_2. The same argument gives stability, max⁡∣u1−u2∣≤max⁡∣g1−g2∣\max|u_1 - u_2| \le \max|g_1 - g_2|. Neumann data fix the answer only up to an added constant, the null space the pressure equation inherits.

Relaxation: computing a harmonic function

Start from any guess and repeat “replace each interior value by the average of its neighbors”. That sweep is Jacobi iteration, and it is the explicit heat step of the previous lesson: u+14(sum of neighbors−4u)u + \tfrac14(\text{sum of neighbors} - 4u) is FTCS in 2D with r=14r = \tfrac14, the largest stable value there. Relaxing is running the heat equation until it stops changing.

How many sweeps? Decompose the error into sine modes sin⁡(pπx)sin⁡(qπy)\sin(p\pi x)\sin(q\pi y). A Jacobi sweep multiplies mode (p,q)(p,q) by 12(cos⁡pπh+cos⁡qπh)\tfrac12(\cos p\pi h + \cos q\pi h). The slowest is p=q=1p = q = 1:

ρJ=cos⁡πh≈1−π2h22.\rho_J = \cos\pi h \approx 1 - \frac{\pi^2h^2}{2}.

On the lab’s grid, h=1/40h = 1/40, this is 0.996920.99692. Sweeps scale like 1/h21/h^2, so halving hh costs four times the sweeps (the playground counts 197197, 687687, 23092309 for 1010, 2020, 4040 intervals). Long wavelengths die slowly, as in the heat equation.

Two cures. Gauss-Seidel uses new values as soon as they exist; its slowest factor is ρJ2\rho_J^2 (from memory), about half the sweeps. SOR pushes each update further: u←u+ω(average−u)u \leftarrow u + \omega(\text{average} - u), 1<ω<21 \lt \omega \lt 2. For the square the best ω\omega is 2/(1+sin⁡πh)2/(1+\sin\pi h) (Young’s result, from memory; the lab tests it), giving ρ=ω−1=0.8545\rho = \omega - 1 = 0.8545 at h=1/40h = 1/40. SOR sweeps grow like 1/h1/h, not 1/h21/h^2.

The residual (how much one more sweep would change the values) is not the error. For the slowest mode, residual ≈(1−ρ)×\approx (1-\rho)\timeserror, so Jacobi at h=1/40h = 1/40 can hide an error 324324 times its residual. And the converged grid answer is itself off from the exact solution by the discretization error, which no number of sweeps removes.

The lab

◆ Interactive A plate: paint the edge temperatures, choose the solver, and watch the interior become harmonic

Loading simulation…

The square has 4040 intervals per side; the disk has 4040 across its diameter, with arm-length weights where the circle cuts between nodes. The interior starts at zero.

  1. Solver race, top edge 11. Residual first below 10−610^{-6}: Jacobi at sweep 23092309, Gauss-Seidel 11661166, SOR at ω=1.85\omega = 1.85 sweep 9595, at ω=1.5\omega = 1.5 sweep 393393. At the stops, Jacobi sits 3.25×10−43.25\times10^{-4} from the converged grid solution (325325 times its residual); SOR at 1.851.85 sits 6.0×10−56.0\times10^{-5} away. The button’s ω=1.8545\omega = 1.8545 needs 9696: the optimum is flat.
  2. Series terms. Grid center 0.250000.25000. With 11 series term the series center is 0.253720.25372, with 33 it is 0.249900.24990. The largest grid-series difference is 0.5140.514 at 11 term, 0.1630.163 at 1010, 0.01260.0126 at 3030 and 0.007520.00752 at 6060: it sits beside the top corners, and the last value is the grid’s own corner error (rms 5.5×10−45.5\times10^{-4}).
  3. One-term data. Top edge sin⁡πx\sin\pi x: the exact answer is sin⁡πx sinh⁡πy/sinh⁡π\sin\pi x\,\sinh\pi y/\sinh\pi, center 1/(2cosh⁡π2)=0.199271/(2\cosh\tfrac\pi2) = 0.19927. The converged grid center is 0.199390.19939, the largest difference 1.78×10−41.78\times10^{-4}: discretization error with nothing singular.
  4. Planes and saddles. The 5-point stencil has no error on linear or quadratic functions, so for the ramp (u=1−xu = 1 - x) and saddle (u=x2−y2u = x^2 - y^2) presets the grid answer is exact up to the stopping rule, and the difference from the series is the series’ truncation: for the ramp 0.3160.316 at 1010 terms, 0.00110.0011 at 6060.
  5. Disk. On cos⁡2θ\cos 2\theta the converged grid is within 2.2×10−42.2\times10^{-4} of the Poisson integral. On the hot quarter arc the boundary average, grid center and Poisson center all read 0.250.25: the mean value property. The largest difference, 0.1260.126, is at the rim node (0.95,0)(0.95, 0) under the jump in the data (rms 8.2×10−38.2\times10^{-3}). The interior range readout stays inside the boundary range: the maximum principle.
  6. Paint it. Drag along an edge with a brush temperature: change one edge value and every interior point moves. Nothing is carried along; the influence is global.

Computing it

🐍 PythonLab: series terms, sweep counts, and the half-hot disk
⌘/Ctrl + Enter

The lab’s first rows reproduce the series numbers above and the sweep counts (197197, 687687, 23092309); the last rows show the disk series converging to the closed form, 0.795170.79517.

🧪 Coding exerciseExercise: the series solution against Jacobi relaxation
⌘/Ctrl + Enter

Concept checks

✅ Concept check

A function is harmonic on a disk of radius $2$. Its values on the boundary circle average to $5$. What is its value at the center?

✅ Concept check

A harmonic function on the unit disk has boundary values between $0$ and $1$. Which is possible?

✅ Concept check

Top-edge data $\sin(\pi x) + \sin(10\pi x)$ on the unit square, other edges $0$. At $y = 0.7$, the amplitude of the ripple relative to the broad hump is about

✅ Concept check

Jacobi needs $687$ sweeps on a $20 \times 20$ grid. Roughly how many times more sweeps does a $40 \times 40$ grid need?

Problems

✏️ Pen & paperHarmonic or not●○○

Which of u1=x3−3xy2u_1 = x^3 - 3xy^2, u2=x2yu_2 = x^2y, u3=ln⁡ru_3 = \ln r (for r>0r \gt 0) is harmonic? For the harmonic ones that are polynomials, find the boundary data on the unit circle and the polar form.

Show worked solution

u1u_1: uxx=6xu_{xx} = 6x, uyy=−6xu_{yy} = -6x, sum 00: harmonic. u2u_2: uxx=2yu_{xx} = 2y, uyy=0u_{yy} = 0, sum 2y≠02y \ne 0: not harmonic. u3u_3: 1r(r⋅1r)r=0\frac1r(r\cdot\frac1r)_r = 0, harmonic (it blows up at the origin, so the disk solution rejected it). For u1u_1, x=rcos⁡θx = r\cos\theta, y=rsin⁡θy = r\sin\theta give r3(cos⁡3θ−3cos⁡θsin⁡2θ)=r3cos⁡3θr^3(\cos^3\theta - 3\cos\theta\sin^2\theta) = r^3\cos 3\theta: on the unit circle g=cos⁡3θg = \cos 3\theta, the n=3n = 3 term of the disk series.

✏️ Pen & paperDisk by series, mean value check●●○

On the unit disk the edge data are g(θ)=1+2sin⁡θ+cos⁡3θg(\theta) = 1 + 2\sin\theta + \cos 3\theta. Write the solution, evaluate it at (x,y)=(0,12)(x, y) = (0, \tfrac12), and check the mean value property on the circle r=12r = \tfrac12.

Show worked solution

The data are already a finite Fourier series: a0/2=1a_0/2 = 1, b1=2b_1 = 2, a3=1a_3 = 1. So u=1+2rsin⁡θ+r3cos⁡3θu = 1 + 2r\sin\theta + r^3\cos 3\theta. At (0,12)(0, \frac12), r=12r = \frac12, θ=π2\theta = \frac\pi2: u=1+2⋅12⋅1+18cos⁡3π2=1+1+0=2u = 1 + 2\cdot\frac12\cdot1 + \frac18\cos\frac{3\pi}{2} = 1 + 1 + 0 = 2. On the circle r=12r = \frac12 the average over θ\theta kills sin⁡θ\sin\theta and cos⁡3θ\cos 3\theta (each averages to 00 over a full turn), leaving 11, which is uu at the center (r=0r = 0 gives 11). The mean value property holds on every circle, not just the boundary one.

✏️ Pen & paperSymmetry and uniqueness●●○

A unit square has its top, right, bottom and left edges held at 100100, 4040, 00 and 00 degrees. Find the center temperature without solving anything, and explain why the answer is exact for the grid solution too.

Show worked solution

Let uTu_T be the solution with the top at 11 and the others at 00, and uRu_R, uBu_B, uLu_L its rotated copies. Their sum has boundary value 11 on every edge, so by uniqueness it is the constant 11. The copies are rotations of one another, so each is the same at the center: uT(center)=14u_T(\text{center}) = \frac14. By linearity the answer is 14(100+40+0+0)=35\frac14(100 + 40 + 0 + 0) = 35 degrees. The grid problem has the same structure (a rotation-symmetric stencil, a constant solves it, unique solution), so the converged grid center is exactly 0.250.25; the lab’s 0.249680.24968 for Jacobi at its stop is iteration error.

✏️ Pen & paperHow many sweeps?●●●

(a) Show that one Jacobi sweep equals one FTCS step of the 2D heat equation with r=14r = \tfrac14. (b) For h=0.01h = 0.01, estimate the sweeps to cut the slowest error mode by 10310^3 for Jacobi and for SOR with the best ω\omega.

Show worked solution

(a) FTCS in 2D: unew=u+r(uE+uW+uN+uS−4u)u^{new} = u + r(u_E + u_W + u_N + u_S - 4u). At r=14r = \frac14 the uu terms cancel, unew=14(uE+uW+uN+uS)u^{new} = \frac14(u_E + u_W + u_N + u_S): the Jacobi update. (b) Jacobi: ρ≈1−π2h2/2=1−4.93×10−4\rho \approx 1 - \pi^2h^2/2 = 1 - 4.93\times10^{-4}, so k=ln⁡1000/(4.93×10−4)≈14 000k = \ln 1000/(4.93\times10^{-4}) \approx 14\,000. SOR: ω=2/(1+sin⁡0.01π)=1.9391\omega = 2/(1 + \sin 0.01\pi) = 1.9391, ρ=0.9391\rho = 0.9391, k=ln⁡1000/(−ln⁡0.9391)≈110k = \ln 1000/(-\ln 0.9391) \approx 110. That is the 1/h21/h^2 against 1/h1/h scaling: a factor 127127.

Key Takeaways

  • A harmonic function (∇2u=0\nabla^2 u = 0) equals the average of its neighbors: on every circle (mean value property) and on a grid, u=14(uE+uW+uN+uS)u = \frac14(u_E + u_W + u_N + u_S). Poisson’s ∇2u=f\nabla^2 u = f adds a source.
  • Rectangle: separation with zero data on opposite sides forces sin⁡(nπx/a)\sin(n\pi x/a), then sinh⁡\sinh in yy; a sine series of the top data fixes the coefficients. Ripples of wavelength ℓ\ell penetrate only about ℓ/2π\ell/2\pi.
  • Disk: the periodic angle forces integer nn, regularity at the center keeps rnr^n, and the coefficients are the Fourier coefficients of the edge data; summing the series gives the Poisson integral, a positive weighted average of the edge values.
  • Mean value property ⇒\Rightarrow maximum principle (no interior extremes) ⇒\Rightarrow uniqueness and stability. Neumann problems are unique only up to a constant, and need compatible fluxes.
  • Jacobi relaxation is explicit heat flow at r=14r = \tfrac14; its slowest error mode decays like 1−π2h2/21 - \pi^2h^2/2, so it needs about 1/h21/h^2 sweeps (23092309 at h=1/40h = 1/40). Gauss-Seidel halves that, optimal SOR needs about 1/h1/h (9696).
  • A small residual is not a small error (a factor 324324 for Jacobi here), and sweeps past the discretization error buy nothing.
  • Potential flow (v=∇ϕ\mathbf v = \nabla\phi, ∇⋅v=0\nabla\cdot\mathbf v = 0) and the pressure projection are Laplace and Poisson problems: elliptic, global, and the expensive step of a fluid solver.
  • Next, the finite-difference lesson takes the five-point stencil and the boundary arm weights that we used here on trust, derives them from Taylor series, and measures how fast the grid error shrinks as hh does.
Finished this lesson?

Mark it complete to track your progress (saved in this browser). Reading every section does this for you.

Where this leads

These later lessons build directly on this one: