Geoscientific Model Development (Jul 2021)
SolveSAPHE-r2 (v2.0.1): revisiting and extending the Solver Suite for Alkalinity-PH Equations for usage with CO<sub>2</sub>, HCO<sub>3</sub><sup>−</sup> or CO<sub>3</sub><sup>2−</sup> input data
Abstract
The successful and efficient approach at the basis of the Solver Suite for Alkalinity-PH Equations (SolveSAPHE) (Munhoven, 2013), which determines the carbonate system speciation by calculating pH from total alkalinity (AlkT) and dissolved inorganic carbon (CT), and which converges for any physically sensible pair of such data, has been adapted and further developed to work with AlkT–CO2, AlkT–HCO3-, and AlkT–CO32-. The mathematical properties of the three modified alkalinity–pH equations are explored. It is shown that the AlkT–CO2, and AlkT–HCO3- problems have one and only one positive root for any physically sensible pair of data (i.e. such that [CO2]>0 and [HCO3-]>0). The space of AlkT–CO32- pairs is partitioned into regions where there is either no solution, one solution or where there are two. The numerical solution of the modified alkalinity–pH equations is far more demanding than that for the original AlkT–CT pair as they exhibit strong gradients and are not always monotonous. The two main algorithms used in SolveSAPHE v1 have been revised in depth to reliably process the three additional data input pairs. The AlkT–CO2 pair is numerically the most challenging. With the Newton–Raphson-based solver, it takes about 5 times as long to solve as the companion AlkT–CT pair; the AlkT–CO32- pair requires on average about 4 times as much time as the AlkT–CT pair. All in all, the secant-based solver offers the best performance. It outperforms the Newton–Raphson-based one by up to a factor of 4 in terms of average numbers of iterations and execution time and yet reaches equation residuals that are up to 7 orders of magnitude lower. Just like the pH solvers from the v1 series, SolveSAPHE-r2 includes automatic root bracketing and efficient initialisation schemes for the iterative solvers. For AlkT–CO32- data pairs, it also determines the number of roots and calculates non-overlapping bracketing intervals. An open-source reference implementation of the new algorithms in Fortran 90 is made publicly available for usage under the GNU Lesser General Public Licence version 3 (LGPLv3) or later.