Mailing Address

Dr. Allan Leal

Geothermal Energy & Geofluids

Institute of Geophysics

NO F 57

Sonneggstrasse 5

CH-8092 Zurich Switzerland

Contact

Phone | +41 44 633 2521 |

allan.leal(at)erdw.ethz.ch |

Administration

Dominique Ballarin Dolfin | |

Phone | +41 44 632 3465 |

ballarin(at)ethz.ch |

## Publications

[Go to Proceedings Refereed] [Go to Theses]

Underlined names are links to current or past GEG members

### REFEREED PUBLICATIONS IN JOURNALS

11.

Kyas, S., D. Volpatto, M. O. Saar, and A. Leal, Accelerated reactive transport simulations in heterogeneous porous media using Reaktoro and Firedrake, Computational Geosciences, 2022. [Download PDF] [View Abstract]This work investigates the performance of the on-demand machine learning (ODML) algorithm introduced in Leal et al. (2020) when applied to different reactive transport problems in heterogeneous porous media. This approach was devised to accelerate the computationally expensive geochemical reaction calculations in reactive transport simulations. We demonstrate that even with strong heterogeneity present, the ODML algorithm speeds up these calculations by one to three orders of magnitude. Such acceleration, in turn, significantly advances the entire reactive transport simulation. The performed numerical experiments are enabled by the novel coupling of two open-source software packages: Reaktoro (Leal, 2015) and Firedrake
(Rathgeber et al., 2016). The first library provides the most recent version of the ODML approach for the chemical equilibrium calculations, whereas, the second framework includes the newly implemented conservative Discontinuous Galerkin finite element scheme for the Darcy problem, i.e., the Stabilized Dual Hybrid Mixed (SDHM) method (Núñez et al., 2012).

10.

Leal, A. M. M., S. Kyas, D. Kulik, and M. O. Saar, Accelerating Reactive Transport Modeling: On‑Demand Machine Learning Algorithm for Chemical Equilibrium Calculations, Transport in Porous Media, 133, pp. 161-204, 2020. [Download PDF] [View Abstract]During reactive transport modeling, the computing cost associated with chemical equilibrium calculations can be 10 to 10,000 times higher than that of fluid flow, heat transfer, and species transport computations. These calculations are performed at least once per mesh cell and once per time step, amounting to billions of them throughout the simulation employing high-resolution meshes. To radically reduce the computing cost of chemical equilibrium calculations (each requiring an iterative solution of a system of nonlinear equa-tions), we consider an on-demand machine learning algorithm that enables quick and accu-rate prediction of new chemical equilibrium states using the results of previously solved chemical equilibrium problems within the same reactive transport simulation. The training operations occur on-demand, rather than before the start of the simulation when it is not clear how many training points are needed to accurately and reliably predict all possible chemical conditions that may occur during the simulation. Each on-demand training opera-tion consists of fully solving the equilibrium problem and storing some key information about the just computed chemical equilibrium state (which is used subsequently to rap-idly predict similar states whenever possible). We study the performance of the on-demand learning algorithm, which is mass conservative by construction, by applying it to a reactive transport modeling example and achieve a speed-up of one or two orders of magnitude (depending on the activity model used). The implementation and numerical tests are car-ried out in Reaktoro (reakt oro.org), a unified open-source framework for modeling chemi-cally reactive systems.

9.

Miron, G. D., A.M.M. Leal, and A. Yapparova, Thermodynamic Properties of Aqueous Species Calculated Using the HKF Model: How Do Different Thermodynamic and Electrostatic Models for Solvent Water Affect Calculated Aqueous Properties?, Geofluids, a43, pp. 1-24, 2019. [Download PDF] [View Abstract]Thermodynamic properties of aqueous species are essential for modeling of fluid-rock interaction processes. The Helgeson-Kirkham-Flowers (HKF) model is widely used for calculating standard state thermodynamic properties of ions and complexes over a wide range of temperatures and pressures. To do this, the HKF model requires thermodynamic and electrostatic models of water solvent. In this study, we investigate and quantify the impact of choosing different models for calculating water solvent volumetric and dielectric properties, on the properties of aqueous species calculated using the HKF model. We identify temperature and pressure conditions at which the choice of different models can have a considerable effect on the properties of aqueous species and on fluid mineral equilibrium calculations. The investigated temperature and pressure intervals are 25–1000°C and 1–5 kbar, representative of upper to middle crustal levels, and of interest for modeling ore-forming processes. The thermodynamic and electrostatic models for water solvent considered are: Haar, Gallagher and Kell (1984), Wagner and Pruß (2002), and Zhang and Duan (2005), to calculate water volumetric properties, and Johnson and Norton (1991), Fernandez and others (1997), and Sverjensky and others (2014), to calculate water dielectric properties. We observe only small discrepancies in the calculated standard partial molal properties of aqueous species resulting from using different water thermodynamic models. However, large differences in the properties of charged species can be observed at higher temperatures (above 500°C) as a result of using different electrostatic models. Depending on the aqueous speciation and the reactions that control the chemical composition, the observed differences can vary. The discrepancy between various electrostatic models is attributed to the scarcity of experimental data at high temperatures. These discrepancies restrict the reliability of the geochemical modeling of hydrothermal and ore formation processes, and the retrieval of thermodynamic parameters from experimental data at elevated temperatures and pressures.

8.

Walsh, S.D.C., N. Garapati, A.M.M. Leal, and M.O. Saar, Calculating thermophysical fluid properties during geothermal energy production with NESS and Reaktoro, Geothermics, 70, pp. 146-154, 2017. [Download PDF] [View Abstract]We investigate how subsurface fluids of different compositions affect the electricity generation of geothermal power plants. First, we outline a numerical model capable of accounting for the thermophysical properties of geothermal fluids of arbitrary composition within simulations of geothermal power production. The behavior of brines with varying compositions from geothermal sites around the globe are then examined using the model. The effect of each brine on an idealized binary geothermal power plant is simulated, and their performances compared by calculating the amount of heat exchanged from the fluid to the plant's secondary cycle.
Our simulations combine (1) a newly developed Non-linear Equation System Solver (NESS), for simulating individual geothermal power plant components, (2) the advanced geochemical speciation solver, Reaktoro, used for calculation of thermodynamic fluid properties, and (3) compositional models for the calculation of fluid-dynamical properties (e.g., viscosity as a function of temperature and brine composition). The accuracy of the model is verified by comparing its predictions with experimental data from single-salt, binary-salt, and multiple-salt solutions.
The geothermal power plant simulations show that the brines considered in this study can be divided into three main categories: (1) those of largely meteoric origin with low salinity for which the effect of salt concentration is negligible; (2) moderate-depth brines with high concentrations of Na+ and K+ ions, whose performance is well approximated by pure NaCl solutions of equivalent salinity; and (3) deeper, high-salinity brines that require a more detailed consideration of their composition for accurate simulation of plant operations.

7.

Leal, A.M.M., D.A. Kulik, W.R. Smith, and M.O. Saar, An overview of computational methods for chemical equilibrium and kinetic calculations for geochemical and reactive transport modeling, Pure and Applied Chemistry, 89/5, pp. 597-643, 2017. [Download PDF] [View Abstract]We present an overview of novel numerical methods for chemical equilibrium and kinetic calculations for complex non-ideal multiphase systems. The methods we present for equilibrium calculations are based either on Gibbs energy minimization (GEM) calculations or on solving the system of extended law of mass-action (xLMA) equations. In both methods, no a posteriori phase stability tests, and thus no tentative addition or removal of phases during or at the end of the calculations, are necessary. All potentially stable phases are considered from the beginning of the calculation, and stability indices are immediately available at the end of the computation to determine which phases are actually stable at equilibrium. Both GEM and xLMA equilibrium methods are tailored for computationally demanding applications that require many rapid local equilibrium calculations, such as reactive transport modeling. The numerical method for chemical kinetic calculations we present supports both closed and open systems, and it considers a partial equilibrium simplification for fast reactions. The method employs an implicit integration scheme that improves stability and speed when solving the often stiff differential equations in kinetic calculations. As such, it requires compositional derivatives of the reaction rates to assemble the Jacobian matrix of the resultant implicit algebraic equations that are solved at every time step. We present a detailed procedure to calculate these derivatives, and we show how the partial equilibrium assumption affects their computation. These numerical methods have been implemented in Reaktoro (reaktoro.org), an open-source software for modeling chemically reactive systems. We finish with a discussion on the comparison of these methods with others in the literature.

6.

Leal, A.M.M., D.A. Kulik, and G. Koskowski, Computational methods for reactive transport modeling: A Gibbs energy minimization approach for multiphase equilibrium calculations, Advances in Water Resources, 88, pp. 231-240, 2016. [Download PDF] [View Abstract]We present a numerical method for multiphase chemical equilibrium calculations based on a Gibbs energy minimization approach. The method can accurately and efficiently determine the stable phase assemblage at equilibrium independently of the type of phases and species that constitute the chemical system. We have successfully applied our chemical equilibrium algorithm in reactive transport simulations to demonstrate its effective use in computationally intensive applications. We used FEniCS to solve the governing partial differential equations of mass transport in porous media using finite element methods in unstructured meshes. Our equilibrium calculations were benchmarked with GEMS3K, the numerical kernel of the geochemical package GEMS. This allowed us to compare our results with a well-established Gibbs energy minimization algorithm, as well as their performance on every mesh node, at every time step of the transport simulation. The benchmark shows that our novel chemical equilibrium algorithm is accurate, robust, and efficient for reactive transport applications, and it is an improvement over the Gibbs energy minimization algorithm used in GEMS3K. The proposed chemical equilibrium method has been implemented in Reaktoro, a unified framework for modeling chemically reactive systems, which is now used as an alternative numerical kernel of GEMS.

5.

Leal, A.M.M., D.A. Kulik, and M.O. Saar, Enabling Gibbs energy minimization algorithms to use equilibrium constants of reactions in multiphase equilibrium calculations, Chemical Geology, 437, pp. 170-181, 2016. [Download PDF] [View Abstract]The geochemical literature provides numerous thermodynamic databases compiled from equilibrium constants of reactions. These databases are typically used in speciation calculations based on the law of mass action (LMA) approach. Unfortunately, such LMA databases cannot be directly used in equilibrium speciation methods based on the Gibbs energy minimization (GEM) approach because of their lack of standard chemical potentials of species. Therefore, we present in this work a simple conversion approach that calculates apparent standard chemical potentials of species from equilibrium constants of reactions. We assess the consistency and accuracy of the use of apparent standard chemical potentials in GEM algorithms by benchmarking equilibrium speciation calculations using GEM and LMA methods with the same LMA database. In all cases, we use PHREEQC to perform the LMA calculations, and we use its LMA databases to calculate the equilibrium constants of reactions. GEM calculations are performed using a Gibbs energy minimization method of Reaktoro — a unified open-source framework for numerical modeling of chemically reactive systems. By comparing the GEM and LMA results, we show that the use of apparent standard chemical potentials in GEM methods produces consistent and accurate equilibrium speciation results, thus validating our new, practical conversion technique that enables GEM algorithms to take advantage of many existing LMA databases, consequently extending and diversifying their range of applicability.

4.

Leal, A.M.M., D. Kulik, G. Kosakowski, and M.O. Saar, Computational methods for reactive transport modeling: An extended law of mass-action, xLMA, method for multiphase equilibrium calculations, Advances in Water Resources, 96, pp. 405-422, 2016. [Download PDF] [View Abstract]We present a numerical method for multiphase chemical equilibrium calculations based on a Gibbs energy minimization approach. The method can accurately and efficiently determine the stable phase assemblage at equilibrium independently of the type of phases and species that constitute the chemical system. We have successfully applied our chemical equilibrium algorithm in reactive transport simulations to demonstrate its effective use in computationally intensive applications. We used FEniCS to solve the governing partial differential equations of mass transport in porous media using finite element methods in unstructured meshes. Our equilibrium calculations were benchmarked with GEMS3K, the numerical kernel of the geochemical package GEMS. This allowed us to compare our results with a well-established Gibbs energy minimization algorithm, as well as their performance on every mesh node, at every time step of the transport simulation. The benchmark shows that our novel chemical equilibrium algorithm is accurate, robust, and efficient for reactive transport applications, and it is an improvement over the Gibbs energy minimization algorithm used in GEMS3K. The proposed chemical equilibrium method has been implemented in Reaktoro, a unified framework for modeling chemically reactive systems, which is now used as an alternative numerical kernel of GEMS.

3.

Leal, A.M.M., M.J. Blunt, and T.C. LaForce, A chemical kinetics algorithm for geochemical modelling, Applied Geochemistry, 55, pp. 46-61, 2015. [Download PDF] [View Abstract]A chemical kinetics algorithm is presented for geochemical applications. The algorithm is capable of handling both equilibrium- and kinetically-controlled reactions in multiphase systems. The ordinary differential equations (ODEs) are solved using an implicit multistep backward differentiation formula (BDF) algorithm to ensure efficiency and stability when integrating stiff ODEs. An adaptive control scheme of the time step is adopted to guarantee small steps in steeper regions and large steps in smoother regions of the integration. Analytical derivatives of the reaction rates and species activities are used to permit the use of larger time steps, and to increase the robustness of the calculations. The chemical equilibrium calculations are performed using a Gibbs free energy minimisation algorithm, which is based on a trust-region interior-point method adapted with a watchdog strategy that yields quadratic rates of convergence near the solution. The chemical kinetics algorithm is applied to geochemical problems relevant to carbon storage in saline aquifers. The calculations assume aqueous, gaseous and mineral phases, where the kinetics of the waterâ€“gasâ€“rock interactions are investigated. The results allow us to estimate the time frames at which brine of different salinities and supercritical CO2 attains equilibrium with a carbonate rock, as well as the amount of carbon dioxide trapped by solubility and mineralisation mechanisms.

2.

Leal, A.M.M., M.J. Blunt, and T.C. LaForce, Efficient chemical equilibrium calculations for geochemical speciation and reactive,transport modelling, Geochimica et Cosmochimica Acta, 131, pp. 301-322, 2014. [Download PDF] [View Abstract]Chemical equilibrium calculations are essential for many environmental problems. It is also a fundamental tool for chemical kinetics and reactive transport modelling, since these applications may require hundreds to billions equilibrium calculations in a single simulation. Therefore, an equilibrium method for such critical applications must be very efficient, robust and accurate. In this work we demonstrate the potential effectiveness of a novel Gibbs energy minimisation algorithm for reactive transport simulations. The algorithm includes strategies to converge from poor initial guesses; capabilities to specify non-linear equilibrium constraints such as pH of an aqueous solution and activity or fugacity of a species; a rigorous phase stability test to determine the unstable phases; and a strategy to boost the convergence speed of the calculations to quadratic rates, requiring only few iterations to converge. We use this equilibrium method to solve geochemical problems relevant to carbon storage in saline aquifers, where aqueous, gaseous and minerals phases are present. The problems are formulated to mimic the ones found in kinetics and transport simulations, where a sequence of equilibrium calculations are performed, each one using the previous solution as the initial guess. The efficiency and convergence rates of the calculations are presented, which require an average of 1â€“2 iterations. These results indicate that critical applications such as chemical kinetics and reactive transport modelling can potentially benefit by using this multiphase equilibrium algorithm.

1.

Leal, A.M.M., M.J. Blunt, and T.C. LaForce, A robust and efficient numerical method for multiphase equilibrium calculations: Application to CO2-brine-rock systems at high temperatures, pressures and salinities, Advances in Water Resources, 62(Part C), pp. 409-430, 2013. [Download PDF] [View Abstract]We present a robust and efficient method for calculating chemical equilibria of general multiphase systems. The method is based on a stoichiometric approach, which uses Newtonâ€™s method to solve a system of mass-action equations coupled with a system of equilibrium constraints. A stabilisation procedure is developed to promote convergence of the calculation when a presupposed phase in the chemical system is absent in the equilibrium state. The formulation of the chemical equilibrium problem is developed by presuming no specific details of the involved phases and species. As a consequence, the method is flexible and general enough so that the calculation can be customised with a combination of thermodynamic models that are appropriate for the problem of interest. Finally, we show the use of the method to solve relevant geochemical equilibrium problems for modelling carbon storage in highly saline aquifers.

[back to Top of Page]

### THESES

2.

Leal, A.M.M., Computational methods for geochemical modelling: Applications to carbon dioxide sequestration, Dissertation, Imperial College London, 152 pp., 2014. [View Abstract]Geochemical modelling is fundamental for solving many environmental problems, and specially useful for modelling carbon storage into deep saline aquifers. This is because the injected greenhouse gas perturbs the reservoir, causing the subsurface fluid to become acidic, and consequently increasing its reactivity with the formation rock. Assessment of the long term fate of carbon dioxide, therefore, requires accurate calculations of the geochemical processes that occur underground. For this, it is important to take into account the major water-gas-rock effects that play important roles during the gas storage and migration. These reactive processes can in general be formulated in terms of chemical equilibrium or chemical kinetics models. This work proposes novel numerical methods for the solution of multiphase chemical equilibrium and kinetics problems. Instead of adapting or improving traditional algorithms in the geochemical modelling literature, this work adopts an approach of abstracting the underlying mathematics from the chemical problems, and investigating suitable, modern and efficient methods for them in the mathematical literature. This is the case, for example, of the adaptation of an interior-point minimisation algorithm for the calculation of chemical equilibrium, in which the Gibbs energy of the system is minimised. The methods were developed for integration into reactive transport simulators, requiring them to be accurate, robust and efficient. These features are demonstrated in the manuscript. All the methods developed were applied to problems relevant to carbon sequestration in saline aquifers. Their accuracy was assessed by comparing, for example, calculations of pH and CO2 solubility in brines against recent experimental data. Kinetic modelling of carbon dioxide injection into carbonate and sandstone saline aquifers was performed to demonstrate the importance of accounting for the water-gas-rock effects when simulating carbon dioxide sequestration. The results demonstrated that carbonate rocks, for example, increase the potential of the subsurface fluid to dissolve even more mobile CO2. Computational methods for geochemical modelling: Applications to carbon dioxide sequestration (PDF Download Available). Available from: https://www.researchgate.net/publication/289528634_Computational_methods_for_geochemical_modelling_Applications_to_carbon_dioxide_sequestration [accessed May 30, 2017].

1.

Leal, A.M.M., Four phase equilibrium and partitioning calculations for sequestration of carbon dioxide and hydrogen sulfide in deep saline aquifers, MSc Thesis, University of Wyoming, 213 pp., 2010. [View Abstract]A fully compositional numerical simulator for sequestration of CO2 and H2S in deep saline aquifers requires a large number of flash equilibrium calculations at each time step. Therefore, a robust and efficient flash solver is needed in order to resolve the thermodynamic equilibrium of systems composed of brine, CO2, and H2S, i.e., determine the equilibrium phases that emerge in the system, resolve the partitioning of the species among them, and calculate the phase molar fractions. In this work, we develop two fast and accurate flash equilibrium methods, the GeometricFlash and the ProgressiveFlash, for Brine-CO2 and Brine-CO2-H 2S systems. The temperature and pressure ranges are 12-100°C and 1-600 bar for Brine-CO2 systems and 12-100°C and 1-200 bar for Brine-CO2-H2S systems. In this study brine is a solution of NaCl in water. A serial and GPU-based parallel implementations of the above-mentioned flash equilibrium methods are developed for the computation of hundreds of thousands of flash equilibrium calculations. A performance analysis of the computations shows that the progressive flash is faster than the geometric one when executed in serial (on CPUs), while the geometric flash is slightly faster when solved on GPUs. Average speedups of 180 and 300 were achieved with the use of GPUs for the progressive and geometric flash method, respectively. Four phase equilibrium and partitioning calculations for sequestration of carbon dioxide and hydrogen sulfide in deep saline aquifers (PDF Download Available). Available from: https://www.researchgate.net/publication/241237083_Four_phase_equilibrium_and_partitioning_calculations_for_sequestration_of_carbon_dioxide_and_hydrogen_sulfide_in_deep_saline_aquifers [accessed May 30, 2017].