Articles | Volume 6, issue 4
https://doi.org/10.5194/gmd-6-1367-2013
https://doi.org/10.5194/gmd-6-1367-2013
Development and technical paper
 | 
30 Aug 2013
Development and technical paper |  | 30 Aug 2013

Mathematics of the total alkalinity–pH equation – pathway to robust and universal solution algorithms: the SolveSAPHE package v1.0.1

G. Munhoven

Abstract. The total alkalinity–pH equation, which relates total alkalinity and pH for a given set of total concentrations of the acid–base systems that contribute to total alkalinity in a given water sample, is reviewed and its mathematical properties established. We prove that the equation function is strictly monotone and always has exactly one positive root. Different commonly used approximations are discussed and compared. An original method to derive appropriate initial values for the iterative solution of the cubic polynomial equation based upon carbonate-borate-alkalinity is presented. We then review different methods that have been used to solve the total alkalinity–pH equation, with a main focus on biogeochemical models. The shortcomings and limitations of these methods are made out and discussed. We then present two variants of a new, robust and universally convergent algorithm to solve the total alkalinity–pH equation. This algorithm does not require any a priori knowledge of the solution. SolveSAPHE (Solver Suite for Alkalinity-PH Equations) provides reference implementations of several variants of the new algorithm in Fortran 90, together with new implementations of other, previously published solvers. The new iterative procedure is shown to converge from any starting value to the physical solution. The extra computational cost for the convergence security is only 10–15% compared to the fastest algorithm in our test series.