Specific form of the homogeneous and heterogeneous reaction equations

quantities are as follows. T i ,k total concentration of component i, i ¼ 1 to N C , in cell k for k ¼ 1 to N cells T k the vector of total concentration of components in cell k ¼ T 1 , k , T 2 , k , …, T N C , k t C i ,k aqueous concentration of species i, for i ¼ 1 to N S , in cell k C k the vector of aqueous concentrations of species in cell k ¼ C 1 , k , C 2 , k , …, C N S , k t T i ,in total aqueous concentration of component i in solution flowing into cell 1 at flow rate v t, i ¼ 1 to N C T in the vector of total aqueous concentrations of components in the solution flowing into cell 1 at flow rate v t, T 1 , in , …, T N C , in t F i ,k the inflow rate of the total aqueous concentration of component i into cell k [mol s ¹ 1 ] F k the vector of inflow rates of total aqueous concen- trations for all components into cell k, F k ¼ F 1 , k , …, F N C , k t h k volume of cell k [l] All concentrations are in mol l ¹ 1 ; in the case of the solid phase, P k , this is a bulk concentration in the sense of being the number of moles in the cell divided by the volume of the cell. We note that lower case ‘c’ is used in Ref. 19 for C i ,k .

2.1 The general form of the mass balance equations and transport equations

The conservation of mass for the chemical subsystem can be described in terms of total component concentrations: T k ¼ AC k þ P k b k ¼ 1 , …, N cells , 2 which will lead to a set of N C mass balance equations for each cell. Eqn 2 indicates that the total component con- centrations are combinations of dissolved species and the solid phase with the stoichiometric coefficients as weights. These coefficients appear in the rows of the N C 3 N S matrix A and in the N C vector b see Refs. 20 or 21 and the example below. We assume that no solid calcite is carried into cell 1 by the inflow; hence, T in is related to the concentrations of the dissolved species in the inflow, which we could write as C i ,in , by T in ¼ AC in , i.e. the form of eqn 2 with P in ¼ 0. At this point, it should be noted that total concentrations of components have to take positive values to be physically meaningful, with the exception of H þ , for which the mass balance equation is based on the proton condition and is therefore not required to be positive. 12,17 For our N cell ¼ 2 model of Fig. 1, the cell coupling requirement 1 implies flow v 2 transports solutes from cell 2 into cell 1. Hence, we can express the mass transport of the total concentrations of components as follows: F 1 t ¼ v t T in t ¹ AC 1 t þ v 1 t A C 2 t ¹ C 1 t 3 ¼ v t T in t ¹ v t þ v 1 t AC 1 t þ v 1 t AC 2 t F 2 t ¼ v 1 t AC 1 t þ v 2 t AC 2 t ¹ v 3 t AC 2 t ¼ v 1 t AC 1 t ¹ C 2 t : Combining these mass transport expressions with a conti- nuity equation yields the mass conservation equation for the physical subsystem, which can be described by a set of N cells N C differential equations: h k dT k t = dt ¼ F k t for k ¼ 1 to N cells : 4 Since F i ,k is linear in C i ,k , eqn 4 can be written as dT k t = dt ¼ X N cells k 9 ¼ 1 V k , k 9 t AC k 9 t þ V k , t T in t for k ¼ 1 to N cells , ð 5Þ where, in general, the coefficients in the N cells 3 N cells þ 1 matrix V k ,k9 t describe the inter-cell flows. In this paper, with N cells ¼ 2, these flows are V 1 , V 1 , 1 V 1 , 2 V 2 , V 2 , 1 V 2 , 2 ¼ v t = h 1 ¹ v t þ v 1 t = h 1 v 1 t = h 1 v 1 t = h 2 ¹ v 1 t = h 2 , ð 6Þ From eqns 2 and 5, we have 2N cells N C equations for the N cells N C þ N S þ N P variables describing the total compo- nent concentrations for N C components, plus the concentra- tions of all dissolved species and the solid phase in the N cells cells. For a complete model description, we require addi- tional equilibrium conditions for the dissolved species and the solid phase in each cell, which provide N S þ N P ¹ N C equations for each cell, closing the system of model equations.

2.2 Specific form of the homogeneous and heterogeneous reaction equations

Species CO 2 ¹ 3 , Ca 2þ and H þ have been chosen as the N C ¼ 3 components plus the solvent species H 2 O itself. The con- centrations of the remaining dissolved species, OH ¹ , HCO ¹ 3 and H 2 CO 3 , can be obtained based on the following N S ¹ N C ¼ 3 reaction equations 7–9, as described in Steefel and MacQuarrie. 17 The equilibrium constants for these reactions are provided in Table 1. H 2 O O H þ þ OH ¹ K 3 7 HCO ¹ 3 O CO 2 ¹ 3 þ H þ K 1 8 H 2 CO 3 O CO 2 ¹ 3 þ 2H þ K 2 : 9 Effects of chemical reactions on iterative methods 335 The identification of index i for aqueous concentrations with specific species is: C 1 ¼ [ CO 2 ¹ 3 ] ; C 2 ¼ [ Ca 2 þ ] ; C 3 ¼ [ H þ ] ; C 4 ¼ [ H ¹ ] ; C 5 ¼ [ HCO ¹ 3 ] ; C 6 ¼ [ H 2 CO 3 ] : ð 10Þ From the law of mass action, the model equilibrium conditions for reactions 7–9 in the kth cell take the form g l C k ÿ ¼ 0 for l ¼ 1 , 2 , 3 11 for three functions of the vector argument of length 6, x ¼ x 1 , … , x 6 : g 1 x ¼ K 3 ¹ x 3 x 4 12 g 2 x ¼ K 1 x 5 ¹ x 3 x 1 g 3 x ¼ K 2 x 6 ¹ x 2 3 x 1 : To complete the description of our demonstration model, we require one additional equation, which describes the dissolutionprecipitation reaction. The reaction equation for the mineral calcite is given by: CaCO 3 s O Ca 2 þ þ CO 2 ¹ 3 K sp , 13 with the appropriate solubility product constant given in Table 1. For each cell, we let P k be the number of moles of CaCO 3 s divided by the cell volume assumed constant. The stoichiometric matrix A and vector b of eqn 2 are A ¼ 1 1 1 1 1 ¹ 1 1 2 B B 1 C C A ; b ¼ 1 1 B B 1 C C A : 14 The mathematical formulation of equilibrium dissolution precipitation reactions is not as straightforward as for the hydrolysis reactions presented previously. In each cell, the solution may be either saturated or undersaturated with respect to the mineral. For saturated conditions, the equili- brium state is characterized by K sp ¼ C 1 , k C 2 , k and P k , 15 while an undersaturated solution with no solid phase present is characterized by the inequality K sp . C 1 , k C 2 , k and P k ¼ 0: 16 We propose an equilibrium formulation incorporating con- ditions 15 and 16 into a single algebraic equation 18, based on the function g 4 defined as follows: g 4 x , y , z ¼ K sp ¹ xy if z . 0 and min x , y 17 ¼ K sp ¹ xy if z ¼ 0 and xy . K sp and min x , y ¼ 0 if z ¼ 0 and xy K sp and min x , y ¼ z if z , 0 and min x , y ¼ min x , y 2 if min x , y , 0: The physically meaningful regions of x,y,z space for con- centrations C 1,k , C 2,k , P k are the section of the hyperboloid surface K sp ¹ xy ¼ 0 for which z 0 and the region of the z ¼ 0 plane for which x . 0, y . 0 and xy , K sp . These regions are characterized by being the zero function value sets of g 4 , i.e. Eqn 18 states that C 1,k , C 2,k and P k must lie in the physically meaningful regions of x,y,z space: g 4 C 1 , k , C 2 , k , P k ¼ 0: 18 The function values of g 4 x,y,z for non-physical values of arguments x,y,z are relatively arbitrary non-zero values chosen to provide some degree of continuity at the bound- aries of the physically meaningful regions. We note, however, that g 4 is not continuous across the planar domain 0 , xy , K sp and z ¼ 0. This computational formulation unifies dissolutionpreci- pitation with the mass action and mass balance equations into a single set of algebraic equations. It has the usual benefit of an equilibrium formulation that process rate par- ameters are not required. To our knowledge, formulation 18 based on eqn 17 has not been used previously in numerical computations. In the Appendix, we show that, at least for a single cell, the time stepping equations based on this formulation have a physically meaningful solution for any time step size. This proof shows that if the three total concentrations of components, T i ,k for i ¼ 1, 2, 3, are specified for the kth cell then the combination of the mass balance equations, eqn 2, the mass action equations, eqn 12, and the dissolutionprecipitation equation, eqn 18, determine: a the dissolved species concentrations, b whether the solution is saturated or not, and c for a satu- rated solution, the amount of solid phase present for that cell. 3 IMPLICIT TIME STEPPING We are now in a position to describe the computation of interest for this paper, i.e. solving the implicit time stepping equations for the carbonate hydrolysis and the dissolution precipitation of calcite in coupled mixing cells. We consider the numerical solution of the model DAE system of equa- tions by the implicit Euler method as typical of implicit time stepping numerical methods, e.g., the variable order BDF method of DASSL. 3 Our formulation allows us to use both the global linearization method and SIA to solve the same Table 1. Equilibrium constants for the carbonate reactions K 1 ¼ 6.31 3 10 ¹ 11 Equilibrium constant for reaction 8 K 2 ¼ 3.16 3 10 ¹ 17 Equilibrium constant for reaction 9 K 3 ¼ 10 ¹ 14 Equilibrium constant for reaction 7 K sp ¼ 3.8 3 10 ¹ 9 Solubility product constant for Ca 2þ and CO 2 ¹ 3 17 336 G. J. S. Leeming et al. system of implicit time stepping equations. We introduce a simple time stepping strategy to handle non-convergence of either iteration method for these equations. We will use a superscript n to designate quantities at the nth time step. The implicit Euler method for advancing the model by time interval Dt leads to a system of algebraic equations for the model variables at the n þ 1th time level: T n þ 1 k ¹ D t X 2 k 9 ¼ 1 V k , k 9 t n þ 1 AC n þ 1 k 9 ¼ T n k þ D tV k , t n þ 1 T n þ 1 in ð 19Þ T n þ 1 k ¹ AC n þ 1 k ¹ P n þ 1 k b ¼ 20 g l C n þ 1 k ¼ 0 for l ¼ 1 , 2 , 3 21 g 4 C n þ 1 1 , k , C n þ 1 2 , k , P n þ 1 k ¼ 0: 22 For two cells, there are 20 unknowns in these equations: the column vector 1 of length 6 T n þ 1 1 , T n þ 1 2 t , the vector of length 12 C n þ 1 1 , C n þ 1 2 t and the vector of length 2 P n þ 1 1 , P n þ 1 2 t .Introducing coefficients q k , k 9 ¼ D tV k , k 9 t n þ 1 , 23 we can see from eqn 20 that X 2 k 9 ¼ 1 q k , k 9 T n þ 1 k 9 ¹ X 2 k 9 ¼ 1 q k , k 9 AC n þ 1 k 9 ¼ X 2 k 9 ¼ 1 q k , k 9 P n þ 1 k 9 b , 24 which can be substituted into eqn 19 to eliminate AC n þ 1 k . The resulting equation is 1 ¹ q k , k ÿ T n þ 1 k ¹ q k , ¯k T n þ 1 ¯k þ q k , k P n þ 1 k b þ q k , ¯k P n þ 1 ¯k b ¼ T n k þ q k , T n þ 1 in ð 25Þ for k ¼ 1, 2 and ¯k ¼ 1 þ k mod 2. If there were no solid phase in either cell, i.e. P n þ 1 k ¼ for k ¼ 1, 2, then from eqn 25 we can see that the system decouples into six linear equations for T n þ 1 k , that are satisfied independently of C n þ 1 k , and that eqns 20 and 21 determine C n þ 1 1 , C n þ 1 2 . This is a particular instance of a more general decoupling that occurs in the absence of dissolutionprecipitation reactions noted by Rubin 13 and reviewed in Engesgaard and Kipp. 5 The application of Newton’s method to these 20 equa- tions is well defined and familiar. We refer to this fully coupled approach as global linearization.

3.1 SIA