The one-dimensional diffusion equation with a heat source,
PHYSICS · Multi-part · Fermi University Physics · Computational Physics · Research software practice, verification and validation · Research software practice, verification and validation
Scientific Computing for Physicists, Ch A repository others can build on: collaboration, history and workflows
Problem
The one-dimensional diffusion equation with a heat source, ∂tu=D∂x2u+S(x,t), is discretised as uin+1=uin+α(ui+1n−2uin+ui−1n)+ΔtSin, with α=DΔt/Δx2. A localised heater at x=x0 is modelled by Sin=+Q with Q>0 there and zero elsewhere, meaning u should increase at x0. A reviewed and merged change rewrites the last term as −ΔtSin, leaving Sin=+Q unchanged in the calling code, so the "heater" now cools rather than heats. The repository's existing known-answer test initialises u as a Gaussian pulse with S≡0 everywhere (pure diffusion, no source) and checks the pulse width against the analytic solution; it passes unchanged before and after the merge.
((a)) Explain why the existing test cannot detect the sign error.
((b)) Using the review checklist (the physical claim of the change, and whether a test would fail if it were reverted), state what a reviewer should have asked before approving this change.
((c)) Describe a test, with S=0, that fails for the buggy code and passes for the corrected code.