This is a genuine numerical solve of Fick's second law, not a scripted curve. The electrolyte between the electrode (left, x=0) and the bulk reservoir (right, x=L) is discretized into a 1D grid of concentration values C(x). Every animation frame the solver advances the grid forward in time with an explicit finite-difference (FTCS) update:
∂C/∂t = D · ∂²C/∂x²
C[i] ← C[i] + r·(C[i+1] − 2C[i] + C[i−1]), r = D·Δt/Δx²
Boundary conditions while stepped:
C(0,t) = 0 (instant reaction consumes every ion on contact)
C(L,t) = C₀ (bulk reservoir stays full)
Electrode current from the LOCAL gradient (Fick's first law):
J(t) = D · (C[1] − C[0]) / Δx
I(t) = n F A · J(t)
- The concentration field above is drawn straight from the grid — the dark band spreading from the electrode is the numerically depleted region, not an animation.
- The current readout is computed independently from the gradient at every step, then plotted against the closed-form Cottrell equation I(t) = nFAC₀√(D/πt) as a dashed reference curve — the two should track closely once the initial step transient settles (see Diffusion front below for how each defines the layer edge).
- Diffusion front marks the grid point where C(x) first climbs back to 90% of C₀ — a direct read of the profile, distinct from the Nernst linear-extrapolation thickness δ = √(πDt) used inside the Cottrell formula itself; the two are related by a fixed factor (≈1.31), not equal.
- Real-world relevance: this finite-difference approach is exactly how simulation software predicts sensor response before hardware exists — the same PDE and boundary conditions govern amperometric biosensors such as the glucose sensor in a glucometer.