Numerics
Cells, N 16 32 64 128 256
Upgraded step, × his step 1× 4× 16× 64×
Playback, simulated s per s 0.25 1 4 16
Pause Restart
What changed, and why it matters
1. A stability bug in the explicit step
The lab takes Δt = min(0.42 ρcp Δx²/k, 0.7 Δx/u). Explicit upwind advection–diffusion needs the two together, C + 2r ≤ 1 (and less at the half-cell boundary faces). With the default conductivity and the flow slider at 30 %, C + 2r ≈ 1.09, and the field reaches 10¹⁸⁰ K while the balance panel still reads BALANCED: the scheme is conservative, so the ledger closes even as the solution explodes.
2. First-order upwind smears the field
Upwind face values add numerical diffusion of about uΔx/2. On the lab's 64 cells that is a 20 K error at Pe ≈ 38 that converges only at first order. The exponential scheme (Patankar 1980) uses the exact 1D advection–diffusion profile between neighbouring cells, so for constant properties without a source the steady cell values are exact at any Péclet number, on any grid.
flux across a face = F·Tup − A·(Tdown − Tup ), F = ρcp u, A = F/(eF·d/k − 1)
3. Crank–Nicolson in time
One tridiagonal solve per step, using the lab's own solver, second order in time and stable at any step (two backward-Euler steps first, after Rannacher, to damp the jump at the left face). Try “Upgraded step 16×”.
Where it does not win
For pure conduction the lab's explicit scheme is already accurate (about 0.03 K at 10 s); at the same step the upgrade matches it within a few hundredths of a kelvin. The gain is in advection, stability and step size, not in conduction.
Measured on the lab's 64 cells
Steady, flow 10 / 30 / 100 %: his 8.3 / 19.9 / 33.7 K, upgraded 2×10⁻¹¹ / 7×10⁻¹² / 5×10⁻¹³ K.
Transient, flow 10 %, t = 3 s, against a 2048-cell reference: his 5.6 K, upgraded 0.34 K.
Transient, flow 30 %: his diverges; upgraded within 1.5 K.
Sources
S. V. Patankar, Numerical Heat Transfer and Fluid Flow (1980), §5.2, the exponential scheme.
J. Crank and P. Nicolson (1947), Proc. Camb. Phil. Soc. 43, 50–67.
R. Rannacher (1984), Numer. Math. 43, 309–327, smoothing start-up steps.
The original: Transport Laboratory by S. Bhattacharyya; its time-step rule, upwind fluxes and parameter scales are ported unchanged. Built with Claude.