
Comput Geosci (2017) 21:131–150 DOI 10.1007/s10596-016-9600-5 ORIGINAL PAPER Comparison of linear solvers for equilibrium geochemistry computations Hela Machat1,2,3 · Jer´ omeˆ Carrayrou1 Received: 11 February 2015 / Accepted: 24 October 2016 / Published online: 10 December 2016 © Springer International Publishing Switzerland 2016 Abstract Equilibrium chemistry computations and reactive 1 Introduction transport modelling require the intensive use of a linear solver under very specific conditions. The systems to be The problem of groundwater management is receiving solved are small or very small (4 × 4to20× 20, occasion- increasing attention, and many tools have been developed ally larger) and are very ill-conditioned (condition number to address this issue. One of these tools, reactive trans- up to 10100). These specific conditions have never been port models, was first limited to laboratory experiments investigated in terms of the robustness, accuracy, and effi- and was then extended to field problem comprehension. In ciency of the linear solver. In this work, we present the recent decades, reactive transport models have increased in specificity of the linear system to be solved. Several direct complexity and efficiency, and they are now used in many and iterative solvers are compared using a panel of chemi- fields. Reactive transport models have been used to study cal systems, including or excluding the formation of mineral the transport of contaminants, such as heavy metals [1, 2] species. We show that direct and iterative solvers can be and radioelements [3–5]. Because of the increasing inter- used for these problems and propose computational keys to est in questions related to climate change, many studies improve the chemical solvers. on reactive transport have been conducted to examine the possibility of geologic CO2 sequestration [6–10]. Keywords Geochemical modelling · Instantaneous Under the wide variety of models and cases lies a com- equilibrium chemistry · Linear system inversion · Linear mon mathematical description [11–13]. Transport is usually solver · Small matrix · Ill-conditioned matrix · described by an advection-dispersion equation, and the Newton-Raphson algorithm chemistry is formulated under thermodynamic equilibrium. A widely used approach to solve these reactive transport problems is the operator splitting approach [14]. Using this Electronic supplementary material The online version of this approach, the transport and chemical operators are solved article (doi:10.1007/s10596-016-9600-5) contains supplementary material, which is available to authorized users. separately at each time step and iteratively for some for- mulations. As a consequence, the chemistry operator has to be solved at least once per mesh cell per time step. This Jer´ omeˆ Carrayrou is one reason for the high computational cost of reactive [email protected] transport modelling. Some authors have reported that 80 to 90 % of the computation time is dedicated to chemical 1 CNRS, ENGEES, LHyGeS UMR 7517, Universitede´ Strasbourg, 67000 Strasbourg, France computation. Many studies have been conducted to reduce the computation time required by reactive transport mod- 2 Ecole Superieure´ des Ingenieur´ de l’Equipement Rural de elling [15]. Some works have explored parallelization [16], Medjez el Bab, Universite´ de Jendouba, Jendouba, Tunisia while others have focused on the methods used to solve 3 Universite´ de Monastir, UR13ES63-Chimie Appliquee´ et the transport operator. Nevertheless, improving the resolu- Environnement, 5000 Monastir, Tunisia tion of the chemistry operator has been identified as a key 132 Comput Geosci (2017) 21:131–150 point. Some authors have attempted to improve the clas- convergence speed for the Newton-Raphson method sic Newton-Raphson method [17], while others have tested and decrease the efficiency of the reactive transport other methods, such as Newton-Krylov [16, 18]. code. In this work, errors are estimated by comparing In this work, we focus on a specific element of the the calculated solution to a reference solution. problem, improving the resolution of the linearized sys- Because we utilize a markedly small matrix, we did not test tem provided by the Newton-Raphson method. Looking to parallelization. All the computations were performed on a numerical methods to solve linear systems is not currently PC running Windows with 64-bit Fortran 95. Real variables a common practice. Indeed, these methods are actually well are defined as double-precision real. We prefer double- known [19–23], and all mathematical packages for scien- precision computations because all the chemical codes are, tific computation propose several routines for this task. The to the best of our knowledge, written as double-precision motivation of this work comes from the specificity of lin- real and because quadruple-precision computation is much ear systems that have to be solved for equilibrium chemistry more time consuming. Nevertheless, we have tested one computations. Classic tests for the resolution of linear sys- method using quadruple-precision real to determine whether tems [24–30] are performed using systems provided by this development could be useful. Reference solutions are finite element or finite volume discretization, leading to also computed using quadruple precision. matrices that are large (at least 10,000 unknowns) and We first present the formulation of the equations describ- sparse. Moreover, even when ill-conditioned systems have ing equilibrium reactions and how they are solved using the been studied [25, 30, 31], the conditioning of the matrix Newton-Raphson method. This point defines the Jacobian coming from the chemical system is specific, as under- linear system, which is the object of this work. A second lined by Hoffmann et al. [32]. For example, Soleymani [33] part is devoted to the presentation of the chemical tests and worked with an ill-conditioned system constructed from the numerical procedures used to perform the tests. Next, 10 × 10 to 20 × 20 Hilbert matrices. The condition num- we propose a detailed analysis of the structure and proper- bers then range from 3.5 × 1013 to 6.2 × 1028. In this work, ties of the Jacobian matrix. The selected linear solvers are we present chemical tests leading to a 7 × 7matrixwitha then presented and tested, and the results are compared and condition number of approximately 10180. discussed. Based on this analysis, we propose an algorithm We expect to find a method to increase the efficiency of a to optimize the chemical computation in terms of robust- speciation or reactive transport code. Several properties are ness, accuracy, and efficiency. This algorithm is evaluated required for such a method: on the most selective test. By expanding the limits of the (i) This method should be fast, as the linear system will currently used methods, we believe that our new algorithm be solved very often. In the case of reactive transport will contribute to enlarging the field of application of reac- modelling, the system will be solved at least once per tive transport modelling. As a conclusion, we underline the mesh cell per time step. main advances of this work, the new perspectives and the (ii) The method should be very robust. It should be able to remaining obstacles. solve the linear system even if it is very poorly condi- tioned. Because the resolution of the linear system is only part of an iterative Newton step, an accurate solu- 2 Material and methods tion is not absolutely needed. Thus, some advanced codes (e.g. Linear Algebra PACKage (LAPACK) rou- 2.1 Geochemical modelling tine) that check the accuracy of the solution and return an error flag instead of an inaccurate solution are, in One efficient formulation for the computation of thermody- this work, less robust than the more rustic routines. namic equilibrium is based on the tableau concept, referred N X ) (iii) The method should be able to detect failure and return to as Morel’s table [34, 35]. X components ( j are cho- N C ) an error flag to the main program so that a recov- sen from the C species ( i and are used to write the ery procedure can be initiated. In the case of reac- formation of each species as a combination of the com- C tive transport modelling, this procedure could involve ponents. The mass action law for the formation of the i K ) rejecting the current time step and recomputing with species is written with the equilibrium constant ( i and the a ) X ) a smaller one. stoichiometric coefficients ( i,k for each component ( k (iv) In the initial analysis, the precision of the method is not the key point. Because the linear system resolution is only a part of the Newton-Raphson iterative proce- Nx ai,k dure, reasonable error is acceptable for the linear sys- {Ci} = Ki {Xk} (1) tem inversion. If this error is too large, it will slow the k=1 Comput Geosci (2017) 21:131–150 133 where {Ci} and {Xk} are the activities of species Ci and the existence or non-existence of minerals. In this work, we component Xk, respectively. In this work, we define Xj as a assume that this hypothesis is proposed. The relationships subset of Ci; then, NX is NC minus the number of reactions. between the activity and concentration are given by activity If NCP -precipitated species (Cpi) are taken into account, coefficients (γi) calculated using specific models (Davies, the mass action law for the precipitation of Cpi is written Debye-Huckel,¨ etc.) with the precipitation constant (Kpi) and the stoichiomet- {Ci} = γi [Ci] and Xj = γj Xj (4) ric coefficients (api,k). The saturation index (SIi) of Cpi is equal to its activity, which is unity for a pure solid phase By substituting the mass action law (1) into the mass conser- Nx vation equation (3), the following relationship, which only api,k SIi = Kpi {Xk} = 1(2)depends on the components and the precipitated species k=1 concentrations, is obtained: N N N The conservation of the total concentration [Tj ]ofthejth C K X CP i ai,k component in the system is then written as Tj = ai,j · · (γk [Xk]) + api,j ·[Cpi] γi i=1 k=1 i=1 NC NCP (5) Tj = ai,j · [Ci] + api,j · [Cpi] (3) i=1 i=1 Combining Eqs.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages20 Page
-
File Size-