Software Open Access

# SolveSAPHE (Solver Suite for Alkalinity-PH Equations)

Munhoven, Guy

SolveSAPHE (Solver Suite for Alkalinity-PH Equations) provides a collection of Fortran 90 routines to solve 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.

This version is a bug fix release of the previous versions. The original package (version 1.0.1) was published as a supplement to the paper:

Guy Munhoven (2013) Mathematics of the total alkalinity-pH equation – pathway to robust and universal solution algorithms:the SolveSAPHE package v1.0.1. Geosci. Model Dev., 6, 1367–1388, 2013 (URL: https://www.geosci-model-dev.net/6/1367/2013 or doi:10.5194/gmd-6-1367-2013).

During extension works on SolveSAPHE, limitations in the bracketing procedure of successive iterates for safeguarding solvers have been made out (in mod_acb_solvers.F90, mod_acbw_solvers.F90, mod_phsolvers.F90 and mod_phsolvers_logging.F90). With the AlkT - DIC pair used in the published version of SolveSAPHE, these limitations did not have any effect; with DIC replaced by CO2, the mathematical properties of the underlying fundamental equation change (the carbonate alkalinity term is not bounded any more), which causes problems with Newton iterates when the given CO2 concentration is high. With this pair, the following shortcomings were diagnosed:

• an iterate obtained by Newton's method could differ from its predecessor by a factor of the exponential of several hundreds, leading to over- or underflow floating point exceptions, which prevented convergence;
• right after an update of the minimum and maximum bounds, the procedure adopted to keep Newton iterates within bounds could in some instances falsely trigger the convergence criterion.

Although we have not observed any similar effects during the stress-tests of SolveSAPHE with the AlkT - DIC pair, the affected procedures have been amended to avoid these problems from showing up in the future:

• an iterate derived by Newton's method may now differ from its predecessor by a factor of 100 at most, and is rewritten to preclude floating point operation over- and underflows;
• if an iterate derived by Newton's method falls out of bounds, it is replaced by the geometric mean of the currently valid minimum and maximum bounds, and not considering the previous iterate any more for this purpose. The new iterate is then always different from both the minimum and the maximum bound, and can only trigger the convergence criterion if it is sufficiently close to its predecessor (even if this latter is equal to the minimum or the maximum bound).

Financial support for the development of SolveSAPHE was provided by the Belgian Fund for Scientific Research – FNRS (FRFC grant 2.4571.10); continued revisions were supported by the Belgian Fund for Scientific Research – FNRS (project "SERENATA", CDR grant J.0123.19). Guy Munhoven is a Research Associate with the Belgian Fund for Scientific Research – FNRS.
Files (1.2 MB)
Name Size
solvesaphe1_0.tar.gz
md5:6b9371874ec8bfa981587b953f8e18db
249.7 kB
solvesaphe1_0_1.tar.gz
md5:46dbe7f3d60dffdfe2791d89a26d5bc1
239.0 kB
solvesaphe1_0_2.tar.gz
md5:f2a813dc1f80d46c3129f7c9ded48367
239.2 kB
solvesaphe1_0_3.tar.gz
md5:62f301504e01fe5f9d49eb4c77402e57
239.2 kB
solvesaphe1_1.tar.gz
md5:7e0b6691a4266677eaaa92fcf6890b6a
239.4 kB
272
58
views