Mathematical Rules of Thumb, illustrated reader · Chapter 23

23Partial Differential Equations

Discretize, Resolve, and Verify

5 demonstrations follow the chapter's rules. Choose a value, watch the figure and the numbers change, and check your prediction. Every choice is precomputed from the notebook calculations.

Ask the chapter skill

“Help me use Chapter 23 for my question. Choose a rule, check its assumptions, and show how the result changes when an input changes.”

Use math-thumb-pde from the companion's skill package. The demonstrations below also work on their own.

Examples use constructed inputs or the book's own values, disclosed in each panel. A picture illustrates a rule; its assumptions set its scope.

1Demonstration 1 of 5

Evolve transport with a chosen CFL number

Can exact mass conservation alone certify accuracy?

Advance a periodic profile with an upwind finite-volume update, then compare it with an analytic shift.

ujn+1=ujn−C(ujn−uj−1n),0≤C≤1 u_j^{n+1}=u_j^n-C(u_j^n-u_{j-1}^n),\quad 0\leq C\leq1

Courant number C. 80 periodic cells, velocity 1, twenty steps. At C>1 general monotone stability fails.

Predict first. Can exact mass conservation alone certify accuracy?

Choose an example

Evolve transport with a chosen CFL number. The upwind scheme conserves total mass exactly: whatever leaves one cell enters its neighbor. At CFL=1, upwind is an exact grid shift: each step moves the profile one cell, matching the analytic curve.
Courant number C: 1
Constructed teaching inputs; calculations executed locally. Supported menu choices are precomputed.

Calculated values

Courant number
1
Steps
20
Initial discrete mass
0.124072
Final discrete mass
0.124072
Minimum value
0

The upwind scheme conserves total mass exactly: whatever leaves one cell enters its neighbor. At CFL=1, upwind is an exact grid shift: each step moves the profile one cell, matching the analytic curve.

Use the idea

Use rule 23.2.1 when its stated conditions fit. Compare the calculation with your own decision threshold; retain the relevant error or uncertainty.

Where the conclusion applies

80 periodic cells, velocity 1, twenty steps. At C>1 general monotone stability fails.

Check your understanding: Can exact mass conservation alone certify accuracy?
No. A conservative method can still be unstable or overly diffusive.

Book source: Rule 23.2.1: Keep explicit advection CFL near or below one. Demonstration C23-D01. Worked illustration.

2Demonstration 2 of 5

Execute diffusion against a known sine solution

Can one smooth mode look reasonable above the stability limit?

Run an explicit heat solver and compare its final field with the exact sine-decay solution.

ut=uxx,r=Δt/Δx2≤12 u_t=u_{xx},\quad r=\Delta t/\Delta x^2\leq\tfrac12

Requested diffusion ratio r. 40 intervals, zero endpoints, sine initial data, t=.02. dt is adjusted to end exactly at .02; displayed actual ratio controls the check.

Predict first. Can one smooth mode look reasonable above the stability limit?

Choose an example

Execute diffusion against a known sine solution. Zero endpoints and a sine initial state provide a known heat solution. The actual ratio is 0.4; the scheme is stable only when it is ≤.5. At or below .5 every mode decays, so the computed curve stays on the exact one.
Requested diffusion ratio r: 0.4
Constructed teaching inputs; calculations executed locally. Supported menu choices are precomputed.

Calculated values

Grid intervals
40
Actual dt/dx²
0.4
RMS error at t=.02
8.15353e-05
Maximum magnitude
0.820752

Zero endpoints and a sine initial state provide a known heat solution. The actual ratio is 0.4; the scheme is stable only when it is ≤.5. At or below .5 every mode decays, so the computed curve stays on the exact one.

Use the idea

Use rule 23.2.2 when its stated conditions fit. Compare the calculation with your own decision threshold; retain the relevant error or uncertainty.

Where the conclusion applies

40 intervals, zero endpoints, sine initial data, t=.02. dt is adjusted to end exactly at .02; displayed actual ratio controls the check.

Check your understanding: Can one smooth mode look reasonable above the stability limit?
Yes. An unstable high-frequency mode may initially be absent or tiny. The all-mode stability condition still matters.

Book source: Rule 23.2.2: Remember that explicit diffusion steps scale with mesh size squared. Demonstration C23-D02. Worked illustration.

3Demonstration 3 of 5

Measure solution error on successive meshes

Why hold the time-error budget in mind during mesh refinement?

Execute the heat solver on four meshes and estimate observed order from normed errors.

pobs=log⁡(Eh/Eh/2)log⁡2 p_{obs}=\frac{\log(E_h/E_{h/2})}{\log2}

Selected grid intervals. Known sine heat solution, coupled dt≈.4dx²; this checks combined error rather than isolating spatial order.

Predict first. Why hold the time-error budget in mind during mesh refinement?

Choose an example

Measure solution error on successive meshes. The known sine heat solution checks this finite-difference implementation. Holding dt/dx² near .4 makes temporal error decrease with dx² alongside spatial error. This coupled study does not separately measure time and space orders.
Selected grid intervals: 40
Constructed teaching inputs; calculations executed locally. Supported menu choices are precomputed.

Calculated values

Selected intervals
40
RMS error
8.15353e-05
Observed order from previous mesh
1.98754

The known sine heat solution checks this finite-difference implementation. Holding dt/dx² near .4 makes temporal error decrease with dx² alongside spatial error. This coupled study does not separately measure time and space orders.

Use the idea

Use rule 23.3.3 when its stated conditions fit. Compare the calculation with your own decision threshold; retain the relevant error or uncertainty.

Where the conclusion applies

Known sine heat solution, coupled dt≈.4dx²; this checks combined error rather than isolating spatial order.

Check your understanding: Why hold the time-error budget in mind during mesh refinement?
A fixed time step can dominate the error and conceal spatial convergence.

Book source: Rule 23.3.3: Estimate PDE order from normed errors on successive meshes. Demonstration C23-D03. Worked illustration.

4Demonstration 4 of 5

See waves drift on a coarse grid

With ten cells per wavelength, is the wave in the right place after five wavelengths?

A centered second-order derivative makes short waves travel too slowly. The lag grows with distance.

cnumc=sin⁡(2π/N)2π/N \frac{c_{num}}{c}=\frac{\sin(2\pi/N)}{2\pi/N}

Cells per wavelength N. Linear advection, centered second-order space derivative, exact time integration; travel distance 5 wavelengths.

Predict first. With ten cells per wavelength, is the wave in the right place after five wavelengths?

Choose an example

See waves drift on a coarse grid. With 10 cells per wavelength the computed wave moves at 93.5% of the true speed. After traveling 5 wavelengths it lags by 116°. The speed looks close, yet the crest is now a third of a wavelength late. Ten cells is a floor for short trips, not long ones. Phase error grows with distance traveled, so long runs need more cells or a higher-order scheme.
Cells per wavelength N: 10
Constructed teaching inputs; calculations executed locally. Supported menu choices are precomputed.

Calculated values

Cells per wavelength
10
Speed ratio
0.935489
Speed error (%)
6.45107
Phase lag after 5 wavelengths (degrees)
116.119

With 10 cells per wavelength the computed wave moves at 93.5% of the true speed. After traveling 5 wavelengths it lags by 116°. The speed looks close, yet the crest is now a third of a wavelength late. Ten cells is a floor for short trips, not long ones. Phase error grows with distance traveled, so long runs need more cells or a higher-order scheme.

Use the idea

Use rule 23.2.3 when its stated conditions fit. Compare the calculation with your own decision threshold; retain the relevant error or uncertainty.

Where the conclusion applies

Linear advection, centered second-order space derivative, exact time integration; travel distance 5 wavelengths.

Check your understanding: With ten cells per wavelength, is the wave in the right place after five wavelengths?
No. It moves at 93.5% of the true speed and lags by about 116 degrees, a third of a wavelength.

Book source: Rule 23.2.3: Resolve waves with at least about ten cells per wavelength. Demonstration C23-D04. Worked illustration.

5Demonstration 5 of 5

See centered differences wiggle when flow outruns diffusion

The exact solution never goes below zero. Can the centered answer?

Solve steady transport a u′=D u″ on [0,1] with u(0)=0, u(1)=1 on 20 cells using centered differences, and compare with the exact boundary-layer solution.

Peh=aΔxD,|Peh|≤2 Pe_h=\frac{a\Delta x}{D},\quad |Pe_h|\le2

Cell Peclet number aΔx/D. Uniform grid, a=1, D chosen to set the cell Peclet number; steady one-dimensional model.

Predict first. The exact solution never goes below zero. Can the centered answer?

Choose an example

See centered differences wiggle when flow outruns diffusion. The flow carries u toward x=1, where it must climb from 0 to 1 in a thin layer. At cell Peclet number 2, the scheme sits exactly on the monotone limit: no wiggles, but the layer is only one cell wide. Keep aΔx/D at or below 2, refine the mesh, or switch to an upwind-biased scheme.
Cell Peclet number aΔx/D: 2
Constructed teaching inputs; calculations executed locally. Supported menu choices are precomputed.

Calculated values

Cell Peclet number aΔx/D
2
Cells
20
Minimum computed value
0
Max error
0.135335

The flow carries u toward x=1, where it must climb from 0 to 1 in a thin layer. At cell Peclet number 2, the scheme sits exactly on the monotone limit: no wiggles, but the layer is only one cell wide. Keep aΔx/D at or below 2, refine the mesh, or switch to an upwind-biased scheme.

Use the idea

Use rule 23.1.2 when its stated conditions fit. Compare the calculation with your own decision threshold; retain the relevant error or uncertainty.

Where the conclusion applies

Uniform grid, a=1, D chosen to set the cell Peclet number; steady one-dimensional model.

Check your understanding: The exact solution never goes below zero. Can the centered answer?
Yes. Above Pe=2 it zigzags; at Pe=8 it dips to −0.6. Refine, or bias the scheme upwind.

Book source: Rule 23.1.2: Use cell Peclet number to judge centered convection-diffusion. Demonstration C23-D05. Worked illustration.

Bring the idea to a question of your own

Choose the relationship that answers your question, check its conditions, and compare the result with the accuracy or decision threshold you need.

The chapter skill can adapt these calculations to your inputs. It should name the assumptions, explain what the result supports, and say what still needs evidence. The chapter workbook adds a lab and three exercises with answers.