I'm faced with the following problem. For a project, I need to calculate the rate of change of pH (assuming everything is otherwise at equilibrium) of a water mass where CO2, HCO3- and CO3-- are added or removed over time. I'm trying to break it down into partial derivatives, but I've had no major breakthroughs. I've solved it in Matlab using the finite difference/Euler's method, but that's computationally intensive and inelegant. Has anyone worked on this problem before? I've looked through the Zeebe and Wolf-Gladrow (2001) book a bit, but they don't really discuss kinetics much in this regard.
Here are my starting equations.
Equilibration constants K1 and K2
K1 = [H+][HCO3-]/[CO2*]
K2 = [H+][CO3--]/[HCO3]
and a charge conservation equation
d[H+]/dt - d[HCO3-]/dt - 2*[CO3--]/dt = 0
I need to calculate
d[H+]/dt with regard to the rate at which [CO2] [HCO3-] and [CO3--] are added or removed from the system.