Observations about computations with the standard Newton method

Note: T in ¼ AC in . • Maximum time step parameter q max ¼ 0.5, cell sizes h 1 ¼ 1, h 2 ¼ 2 l. The differences between Cases 1 and 2 are that the simu- lated time is longer 2000 and 2800 s, respectively, and the initial and inflow concentrations of Ca 2þ are C 2,k ¼ 10 ¹ 5 in Case 1 and C 2,k ¼ 5 3 10 ¹ 5 in Case 2. Because no precipita- tion occurs in Case 1, C 2,k t values are constant; the history of C 2,k t for Case 2 is shown in Fig. 3. For Case 3, the cells each experience two episodes of precipitate forming and then dissolution, as shown in Fig. 4. • Initial states are the same in both cells and are: C 1 , k ¼ 5 3 10 ¹ 5 , C 2 , k ¼ 5 3 10 ¹ 5 , C 3 , k ¼ 10 ¹ 11 , C 4 , k ¼ 10 ¹ 3 , C 5 , k ¼ 8:0 3 10 ¹ 6 , C 6 , k ¼ 1:7 3 10 ¹ 10 , P k ¼ 0: • Volumetric flow rates: v ¼ 0.005, v 1 ¼ 0.0052 l s ¹ 1 . • Constant inflow concentrations: C 1 , in ¼ 5 3 10 ¹ 5 , C 3 , in ¼ 10 ¹ 11 , C 4 , in ¼ 10 ¹ 3 , C 5 , in ¼ 8:0 3 10 ¹ 6 , C 6 , k ¼ 1:7 3 10 ¹ 10 : • Variable inflow concentrations: C 2 , in t ¼ max [ , 10 ¹ 5 5 þ 15sin 2pt=1200 ] : • Final time ¼ 2400 s; maximum time step parameter q max ¼ 1 3 ; cell sizes h 1 ¼ 2, h 2 ¼ 0.5 l.

4.3 Observations about computations with the standard Newton method

We first discuss the performance of the global linearization approach and the SIA approach when both use the standard form of Newton’s method. 4.3.1 Case 1 A basic observation for this case is that both methods experience difficulty during the intervals of transition between dominant carbonate species. Computational diffi- culty, or cost, at a certain time takes the form of an increase in the number of iterations required to take a time step, including the possibility that one or more reductions of dt may be required in order to make a successful step. This can be seen in the plots of Fig. 5, in which the solid line shows the iterationsstep at each time. Global linearization is shown at the top and the inner SIA iterations, totaled for both cells, at the bottom. The pH history for cell 1 dashed and cell 2 dashed-dotted are superimposed on these plots to reference the carbonate transitions. The peaking of the iterationsstep at the transitions is clearly apparent for both methods. In general terms, it represents the response of the methods to the stiffness of the equations that occurs at the transitions. These plots show the total number of iterations required to make the time step; more than 12 iterations per step are accompanied by step size reduction. This figure illustrates how a source of computational dif- ficulty is localized in time, i.e. at the relatively short times of the carbonate transitions. However, in this history the tran- sitions occur in one cell at a time, i.e. they are also localized in space. One of the benefits sought from using SIA is that it can reduce costs relative to global linearization by localiz- ing the computational difficulties in space. This effect can be seen in the lower plot of Fig. 5. The dashed-dotted line in this plot shows the contribution to the total iterationsstep from the iterations occurring in the first cell. The transitions for the first cell occur at t ¼ 200 and 600 s, and the peaks of the iterationsstep in the first cell are clearly the dominant contribution to the total iterationsstep at that time. Simi- larly, the transitions in the second cell occur at t ¼ 400 and 1200 s, but relatively low numbers of iterationsstep occur in the first cell at those times. The sharp peaking of the iterations per step profiles at the transition times is associated with time step reductions at those times, which is an extreme form of computational difficulty, or cost. Both approaches experience time step reductions to essentially the same degree. At the top of Fig. 5. Iterations per step and scaled pH histories: Case 1. 340 G. J. S. Leeming et al. Fig. 7, the time step history for global linearization is shown, again superimposed on a scaled pH history for reference. Since the carbonate transitions are the only dynamical features of Case 1, it is not surprising that the computational difficulty is concentrated at these times. In particular, the absence of calcite allows SIA to terminate its outer iteration in two steps, as discussed in Section 3, so that Case 1 is somewhat atypical for SIA. 4.3.2 Case 2: the impact of dissolutionprecipitation In Case 2, we add a dynamic dissolutionprecipitation pro- cess, as discussed above. The histories of the carbonate species are essentially the same as Case 1. However, as a result of the increased inflow of Ca 2þ , the calcite concentra- tion in cell 1 is zero until about t ¼ 600 s, at which time it appears in Fig. 3, as the solid line. Precipitation is followed by dissolution, as the CO 2 ¹ 3 drops and the calcite vanishes from cell 1 at about 1650 s. The calcite history in cell 2 is similar; it first appears at about t ¼ 1200 s and vanishes at about t ¼ 2500 s. If we turn to the plots of iterations per step for this case, shown in Fig. 6, we can see that global linearization performs essentially the same as for Case 1. 2 However, the performance for SIA is substantially affected by the appearance of the precipitate. Note the changes in scale, including the scaling of the pH reference curves from Fig. 5. The peaking of the histories associated with the carbonate transitions are still in evidence. However, these peaks are dominated by several plateaus associated with the presence of calcite in the cells. These ‘solution difficulty’ plateaus are also somewhat localized in space, as the drop of the plateau after the disappearance of calcite from cell 1 indicates. Note that the transitions between the undersaturated and satu- rated states do not appear to cause any computational diffi- culty for either method, which seems counter to other experiences. The time step reductions for this case are iden- tical to Case 1, so they are clearly triggered by the carbonate transitions. We can gain further insight into the coupled iterations of SIA for Case 2 by looking at the plots at the bottom of Fig. 7, which show the number of outer iterations at each time step Fig. 6. Iterations per step and scaled pH histories: Case 2. Fig. 7. Left Time step size: Case 1. Right Iterations of SIA: Case 2. 2 Only the first 200 s are plotted to facilitate comparison. Effects of chemical reactions on iterative methods 341 in the upper graph and the ratio of inner to outer iterations at each time step in the lower one. The effects of the stiffness associated with the carbonate transitions on the inner itera- tions are clearly subordinate to the outer iteration in the presence of precipitate. 4.3.3 Case 3: confirming these observations In Case 3, CO 2 þ 3 is the dominant carbonate species, and two episodes of precipitate appearing and disappearing occur in each cell. The global linearization proceeds with little variation in the number of iterations per step, as would be anticipated from the previous observations. Neither method exhibits any time step reductions. The profile of total inner iterations per time step for SIA is shown at the top in Fig. 8; it shows the same pattern of dependence on the presence of calcite as was observed in Case 2. The profiles of the outer iterations and inner iteration outer iteration are at the bottom of this same figure, and show the same features as the graph on the left of Fig. 7. The outer iteration is global in the sense that the presence of precipitate in any one cell triggers it globally. However, Figs 7 and 8 appear to show some differentiation in the total numbers of outer iterations required, depending on whether the calcite is present in cell 1 only, cell 2 only, or both. Perhaps this is due to the simple transport coupling of the mixing cell model; in any case, it is a subtle effect in these results.

4.4 Modifying Newton’s method to maintain positive iterates