The stomach lumen holds acid strong enough to dissolve steel (pH ≈ 1–2) plus the protease pepsin, yet the epithelium one millimetre below sits near pH 7. The gap is bridged by a ~200 μm gel layer of mucus in which epithelial cells secrete bicarbonate (HCO₃⁻), neutralising H⁺ as it diffuses down before it ever reaches a cell membrane. This sim solves a 1D reaction-diffusion system across that gel, discretised into layers i = 0…N−1 (lumen → epithelium):
∂H/∂t = D_eff · ∂²H/∂x² − k·H·B (acid diffusing + being neutralised)
∂B/∂t = D_eff · ∂²B/∂x² − k·H·B (bicarbonate diffusing + consumed)
D_eff ∝ 1 / mucus_thickness (a thin barrier lets acid through faster)
Mucus thickness itself obeys its own balance: prostaglandin-driven secretion (which NSAIDs suppress by inhibiting COX-1) rebuilds it, while pepsin activity and H. pylori's cytotoxins (CagA/VacA) and urease-driven ammonia degrade it. Once the barrier thins past a critical point, acid reaches the epithelium directly and integrity falls — visualised as a growing crater in the tissue floor. Below ~30% integrity the status reads "erosion"; near 0% it reads "peptic ulcer".
- Gastric acid secretion — parietal-cell H⁺ output; sets the lumen boundary concentration.
- H. pylori colonization — the bacterium burrows into the mucus layer, using urease to hydrolyse urea into ammonia (locally raising pH to survive) while its toxins erode the gel and tight junctions — the mechanism behind ~80% of duodenal ulcers.
- NSAID exposure — models COX-1 inhibition: less prostaglandin, so less mucus and bicarbonate get made, independent of acid load — the mechanism behind NSAID-associated gastric ulcers.
- Mucus / bicarbonate secretion — the epithelium's own defensive output; raising it can outpace even fairly high acid secretion.
- Give PPI — a proton-pump inhibitor pulse that drops acid secretion sharply, letting a damaged barrier recover, exactly as omeprazole-class drugs are used clinically to heal ulcers.