Geochemical and reactive transport modelling in R with the RedModRphree package
Authors: De Lucia Marco , Kühn Michael 
Published: March 2021

&lt;p&gt;The modern advances in computing and experimental capabilities in the research of water-rock-interactions require geoscientists to routinely combine laboratory data and models to produce knowledge in order to solve pressing societal challenges connected to subsurface utilization. Data science is hence a more and more pervasive instrument also for &amp;#160;geochemists, which in turn demands flexible and easy to learn software adaptable to their specific needs.&amp;#160;&lt;br&gt;In this contribution we showcase geochemical and reactive transport modelling with our RedModRphree [1] extension package for the GNU R environment and programming language. The new version of the package leverages the R interface to the established PHREEQC geochemical simulator maintained by its original authors [2]. R has established itself as de facto standard language for statistics and machine learning. It enjoys increasing diffusion in many applied scientific fields such as bioinformatics, chemometrics and ecological modelling. The availability of excellent third party extensions such as the thermodynamic package CHNOSZ [3], which extends the functionalities of SUPCRT92, as well as its advanced graphical and numerical capabilities, make R an attractive platform for comprehensive geochemical data analysis, experiment evaluation and modelling.&amp;#160;&lt;br&gt;The aim of RedModRphree is to provide the user with an easy-to-use, high-level interface to program algorithms involving geochemical models, which are then solved using the PHREEQC engine: parameter calibration, error and sensitivity analysis, visualization, up to CPU-intensive parallel coupled reactive transport models. Among the out-of-the-box features included in RedModRphree, we highlight the computation and visualization of Pourbaix (Eh-pH) diagrams and the implementation of 1D advective reactive transport supporting the use of surrogate models replacing expensive PHREEQC calculations [4]. RedModRphree is open source and can be installed from https://git.gfz-potsdam.de/delucia/RedModRphree.&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;https://contentmanager.copernicus.org/fileStorageProxy.php?f=gnp.72552df75cff57113730161/sdaolpUECMynit/12UGE&amp;app=m&amp;a=0&amp;c=afa6bef86f4c5523b81a86ccdd579fc9&amp;ct=x&amp;pn=gnp.elif&amp;d=1&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&lt;p&gt;[1] De Lucia, M. and K&amp;#252;hn, M.: Coupling R and PHREEQC: Efficient Programming of Geochemical Models, Energy Procedia, 40, 464&amp;#8211;471, doi.org/10.1016/j.egypro.2013.08.053, 2013.&lt;/p&gt;&lt;p&gt;[2] Charlton, S.R. and Parkhurst, D.L.: Modules based on the geochemical model PHREEQC for use in scripting and programming languages, Computers &amp; Geosciences 37, 10, 1653&amp;#8211;1663, doi.org/10.1016/j.cageo.2011.02.005, 2011.&lt;/p&gt;&lt;p&gt;[3] Dick, J.M.: CHNOSZ: Thermodynamic Calculations and Diagrams for Geochemistry, Frontiers in Earth Science, 7, https://doi.org/10.3389/feart.2019.00180, 2019.&lt;/p&gt;&lt;p&gt;[4] Jatnieks, J., De Lucia, M., Dransch, D., and Sips, M.: Data-driven Surrogate Model Approach for Improving the Performance of Reactive Transport Simulations, Energy Procedia, 97, 447&amp;#8211;453, doi.org/10.1016/j.egypro.2016.10.047, 2016.&lt;/p&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;