Jacobian selection for Newton iteration

can also have a profound effect on the convergence of the Newton iteration 8,9,11,26,35 .

4.1 Equilibrium primary variables

The equilibrium equations eqns 14 and 15 are two partial differential equations and hence require two primary variables. The state of a node is given by two state indicators {NAPL_STATE, LIQUID_STATE}. The primary variables are given in Table 1. For example, if node i is in the state {napl_on, Sw_primary}, the primary variables are {S ni , S wi }. The transition rules are: IF LIQUID_STATE ¼ Sw_primary AND S wi tol f LIQUID_STATE : ¼ Pn_PRIMARY ELSEIF LIQUID_STATE ¼ Pn_primary AND S wi , tol b LIQUID_STATE : ¼ Sw_primary ENDIF 27 IF NAPL_STATE ¼ napl_on AND S ni , 0 NAPL_STATE : ¼ napl_off S ni ¼ ELSEIF NAPL_STATE ¼ napl_off AND X ni . X p ni NAPL_STATE : ¼ napl_on X ni ¼ X p ni ENDIF 28 Note that the LIQUID_STATE variable substitution is not strictly required, since we can always solve the system of eqn 14 and eqn 15 if we use P n as a primary variable for the LIQUID_STATE. In 26 it was demonstrated that using the LIQUID_STATE variable switching resulted in a large gain in efficiency for unsaturated flow under dry conditions compared to using P n as a primary variable. Somewhat surprisingly, we have found using the LIQUID_STATE variable switching to be more efficient when solving multi-phase flow problems. We will demonstrate this effect in some numerical examples. This phenomena has also been observed previously 36 .

4.2 Nonequilibrium primary variables

In the case of nonequlibrium between phases eqns 14, 18 and 19 there are three primary variables required. In this case, there is only one state indicator {LIQUID_ STATE}. The primary variables are described in Table 2, and the transition rule is given in eqn 27. 5 NONLINEAR ITERATION METHODS As discussed in Section 1, we will consider fully implicit methods in the following. In our experience, it is essential to solve for the saturation in a fully coupled, fully implicit manner for reliable, robust simulations. It is possible that adaptive implicit methods 3 may prove to be useful in some situations. As well, we will restrict attention to a single species NAPL contaminant. If there are a large number of reacting chemical components, it may be more attractive to use some form of operator splitting.

5.1 Jacobian selection for Newton iteration

Use of the nonlinear flux limiter eqns 22–26 results in the flux between two nodes i and j having dependency, in general, on variables at nodes i,j, i2upi,j, i2upj,i. Unless otherwise stated, we will determine the second upstream points i2upi,j, i2upj,i eqns 24–26 using the maxi- mum potential method 20 . We will also include some tests using the geometric method for determination of i2up see Fig. 1. If full Newton iteration is used to solve the implicit dis- crete equations, then the Jacobian matrix will contain more non-zeros, compared to a discretization which used simple upstream weighting. This is due to the fact that the flux between nodes i and j is a function of variables at i,j, i2upi,j, i2upj,i see eqns 22–24. For example, if a seven-point finite volume stencil is used in three dimensions with the usual upstream weighting, then the full Jacobian with the flux limiter eqn 22 will give rise to a 13-point stencil. This will clearly be more expensive then the seven- point molecule, both in terms of Jacobian construction and solution cost. If a numerical method is used to construct the Jacobian, then the efficient technique described in 26 cannot be used, since the method in 26 requires that the flux function between nodes i and j be only a function of variables at nodes i and j. It has been claimed that, in aerospace applications, use of a full Newton iteration with a TVD-based limiter results in slow convergence 37 . This contrasts with experience with fully implicit MUSCL methods, where the full Newton approach is very efficient 25,38 . However, these aerospace problems were concerned with steady-state solutions, whereas in this work we are interested in true transient problems. In 33 , use of a first- order Jacobian is advocated, although no comparisons are made with a full Jacobian iteration. Table 1. States and primary variables: equilibrium model NAPL_STATE napl_on napl_off Primary variable S n X n LIQUID_STATE Pn_primary Sw_primary Primary variable P n S w Table 2. States and primary variables: nonequlibrium model LIQUID_STATE Pn_primary Sw_primary Primary variables P n , S n , X n S w , S n , X n 438 P. A. Forsyth et al. In order to avoid the extra expense of full Newton itera- tion, there are a number of possibilities. Since we are sol- ving a true time-dependent problem, then it is reasonable to suppose that it may not be necessary to use the exact Jacobian. One possibility is to simply ignore the Jacobian entries which lie outside of the sparsity pattern generated using first-order upstream weighting. The simplest and most efficient technique for constructing an approximate Jacobian is simply to use the efficient algorithm described in 26 , but using the flux-limited form for the flux functions. This method constructs the Jacobian using numerical differ- entiation. The Jacobian is constructed by columns, and, if there are neq unknowns per node, the entire Jacobian is constructed with work equivalent to neq þ 1 residual evaluations. In our case, this means that for the equilibrium case, this method requires the work of three residual evalua- tions, while for the nonequilibrium case, four residual eva- luations are required. If we simply use the algorithm described in 26 , and use a flux limiter to evaluate dissolved NAPL flux, then this method ignores the derivatives with respect to i2up in eqns 22–24Eq, 25eqn 26. Another method is to use the first-order Jacobian, but compute the residual using the high-order method 33 . This technique is commonly used in aerospace applications 25 . To be more precise, if x k is the kth iterate for the vector of primary variables at t ¼ N þ 1, then the nonlinear iteration is While not converged 29 J x k þ 1 ¹ x k ¼ ¹ r k EndWhile where J in eqn 29 is the Jacobian constructed using first- order upstream weighting, and the residual vector r k is constructed using a high-order flux-limited method for the NAPL mole fraction as in eqn 22 and eqn 26. To recapitulate, we will investigate three methods for solving the nonlinear algebraic equations: • Full Newton: the Jacobian and residual are evalu- ated using high-order flux limiter. • Approximate Jacobian: all Jacobian entries corre- sponding to derivatives with respect to i2up in eqns 22–27 are ignored. • First-order Jacobian: the Jacobian is evaluated using first-order upstream weighting. The residual vector is evaluated using a high-order flux limiter for the NAPL mole fraction. 6 CODE VERIFICATION The equilibrium model developed in this work was com- pared to the test problems described in 9 . There was good agreement with the equilibrium, multiphase compositional simulations reported in 9 . Several nonequilibrium cases with various mass transfer correlations were compared with the results in 14 , with good qualitative agreement. These tests are reported in detail in 27 . 7 COMPUTATIONAL PARAMETERS The nonlinear algebraic equations eqns 14, 15 and 18 are solved in the following using full or approximate Newton Iteration. A block incomplete LU ILU factoriza- tion iterative solver 39–42 with CGSTAB acceleration 43 was used to solve the matrix. An ILU 1 level 1 precondition- ing is used 40,41 . Reverse Cuthill-McKee RCM ordering 44 was used to order the unknowns. The tolerances for the Newton iteration are Pressure tolerance ¼ 0:01 kpa 30 Saturation tolerance ¼ 0:001 Mole fraction tolerance ¼ 10 ¹ 7 with inner iteration tolerances an order of magnitude smal- ler than the Newton iteration tolerances eqn 30. These nonlinear iteration tolerances typically resulted in a cumu- lative at the end of the run relative material balance error of less than 10 ¹ 4 . Variable timestepping was employed using a method similar to that in 45 . This method is based on selecting a desired maximum error in the solution, and predicting a timestep which will result in this error. 8 TEST PROBLEMS We consider a number of two-dimensional test problems, with different boundary conditions, constitutive data, and LNAPL less dense than water and DNAPL more dense than water contaminants.

8.1 LNAPL problem