The 3D version tracks ~110 individual drug molecules as discrete particles that random-walk toward the canaliculus and change state one at a time. This 2D companion instead solves the same underlying chemistry as a continuous concentration field on a grid spanning the parietal cell cross-section: x runs from the neutral blood side (pH 7.4) to the acidic canalicular membrane (pH set by the slider), y runs along the gland where 48 proton pumps sit on the right-hand membrane.
∂C/∂t = D·∇²C (mobile neutral drug diffuses freely)
T(x,y) gains C·(1 − e^(−k·factor(pH(x))·dt)) (local Henderson–Hasselbalch trapping)
factor(pH) = 10^(pKa − pH), pKa ≈ 4 (same ratio as the 3D model's theory box)
Because the pH gradient is spatial, the trapping factor is evaluated locally at every grid cell from its own x-position — cells near the membrane see pH≈1 and a trapping factor near 1000×, cells near the blood side see pH≈7.4 and a factor near 0.0004×, exactly reproducing the "ion trapping" ratio from the source model but as a field rather than a per-particle dice roll. Trapped drug T is immobile (protonated PPI can't cross back through the membrane) and reacts with nearby pumps:
P(pump inhibited this step) = 1 − e^(−k_inhib·T(membrane,y)·dt)
dActive/dt = −k_inhib·T·Active + ln(2)/τ · (Total − Active) (recovery, half-life τ)
- PPI dose — flux of new neutral drug injected at the blood-side boundary of the field each second.
- Stop Dosing — halts that boundary flux; existing C keeps diffusing/trapping but is never replenished.
- Canalicular pH — sets the acidic end of the spatial pH gradient; raise it and the trapping factor collapses across the whole field, so drug diffuses straight through instead of piling up as T near the membrane.
- Pump synthesis half-life — same first-order recovery law as the 3D model, applied per discrete pump.
This is a genuinely distinct, 2D-native mechanism: a numerically diffused and reacted scalar field replaces particle random-walks, and the spatial pH gradient — rather than a single global pH number applied to point-particles — is what drives trapping unevenly across the domain.