Heat & Wave Equations
Compare diffusion and wave motion with explicit boundaries, stable time steps and field profiles.
About this tool
Compare spreading and oscillation
Choose heat or wave motion, then Run. Pause and Step inspect one numerical time step. Reset clears the result while keeping the inputs. Changing a model input starts a new experiment on the next Run. The sine example sets zero end values.
Model
All quantities are dimensionless on 0 ≤ x ≤ 1. Heat follows uₜ = κuₓₓ with either zero end values or insulated ends. The mean field is conserved for insulated ends; zero ends can remove heat. Waves follow uₜₜ + 2γuₜ = c²uₓₓ with zero end displacement and zero initial velocity. γ is a rate per model time unit, not a loss per step. All profiles are projected to the selected end conditions.
Numerics and references
Heat uses explicit centered spatial differences with κΔt/Δx² ≤ ½. Waves use centered time and space differences with cΔt/Δx ≤ 1 and a second-order initial step. Automatic steps use 90% and 80% of these limits. Manual steps may range from one eighth of the stability limit to the limit. Smaller grids or larger steps reduce work; refining the grid and time step checks numerical error.
For zero ends and initial sin(πx), heat has u = exp(−κπ²t)sin(πx). An undamped wave has u = cos(cπt)sin(πx). Wave energy approximates ½∫(uₜ² + c²uₓ²)dx; small numerical oscillations are expected, while damping dissipates it. It is not thermal energy.
Read the plot
The dashed initial profile and fixed minimum amplitude scale make decay visible. The history retains at most 160 sampled profiles; axis values are model times. Playback targets 0.05 heat time units or 0.5 wave time units per second and can run slower under load. Short, nonsmooth profiles contain unresolved frequencies; stability alone does not guarantee accuracy.
References: Langtangen & Linge: diffusion; wave boundaries and damping.