Pick a scenario; every slider below stays editable.
Add or remove dissolved inorganic carbon with total alkalinity held fixed (like CO2 dissolving in a parcel cut off from the air). Blue: pH, green: aragonite saturation. Dots = now.
The science
Dissolving CO2. Henry's law gives the aqueous gas [CO2*] = K0 pCO2. It reacts in two steps, K1 = [H+][HCO3-]/[CO2*] and K2 = [H+][CO32-]/[HCO3-]. With DIC = [CO2*]+[HCO3-]+[CO32-] the fractions are f0 = H2/D, f1 = K1H/D, f2 = K1K2/D with D = H2+K1H+K1K2 (the Bjerrum plot). At pH 8 about 90 % of the carbon is bicarbonate, about 10 % carbonate and under 1 % dissolved CO2.
Alkalinity is the charge the weak bases carry: TA = [HCO3-] + 2[CO32-] + [B(OH)4-] + [OH-] - [H+]. It does not change when CO2 dissolves, so given TA and pCO2 the pH is the root of that equation (solved here by bisection on pH).
Why pH falls. Added CO2 makes carbonic acid, which turns carbonate into bicarbonate: CO2 + CO32- + H2O -> 2 HCO3-. Carbonate, the building block of shells, therefore falls as CO2 rises. The buffer is measured by the Revelle factor R = (ΔpCO2/pCO2)/(ΔDIC/DIC) (about 9 to 15 in surface water): a 10 % rise of pCO2 needs only about 1 % more DIC, so the ocean takes up less than the pCO2 rise alone would suggest.
Saturation. Ω = [Ca2+][CO32-]/Ksp. Aragonite dissolves when Ω < 1 (here Ca2+ scales with salinity). The shell drawing is qualitative: health runs from Ω about 0.8 (pitted, thin) to about 2.8 (intact); real organisms respond with species-specific thresholds and can partly regulate.
Constants. K0 (Weiss 1974), K1, K2 (Lueker et al. 2000), KB (Dickson 1990), Kw (Millero 1995) and the aragonite Ksp (Mucci 1983) as functions of temperature and salinity. The coefficients were typed from memory of the published fits; the "numerical checks" button compares them with the usual 25 °C, S = 35 values, and a human should spot-check them against the papers.
Honest simplifications. No phosphate, silicate, sulfate or fluoride terms; the pH-scale conventions are blurred; pressure effects ignored; fCO2 treated as pCO2; the surface ocean is assumed to be in equilibrium with the air (real air-sea exchange takes about a year and the deep ocean lags for centuries); alkalinity is held constant although real alkalinity changes with calcification and runoff. The 1850-2100 CO2 pathways are simple illustrative shapes (exponential excess to 415 ppm in 2020, then a prescribed growth rate), not emissions scenarios. Observed surface pH has dropped by roughly 0.1 since pre-industrial times; this model gives a similar change (one of the checks).