Numerical Simulation of Multiphase Multicomponent Flow in Porous Media: Efﬁciency Analysis of Newton-Based Method

: Newton’s method has been widely used in simulation multiphase, multicomponent ﬂow in porous media. In addition, to solve systems of linear equations in such problems, the generalized minimal residual method (GMRES) is often used. This paper analyzed the one-dimensional problem of multicomponent ﬂuid ﬂow in a porous medium and solved the system of the algebraic equation with the Newton-GMRES method. We calculated the linear equations with the GMRES, the GMRES with restarts after every m steps—GMRES (m) and preconditioned with Incomplete Lower-Upper factorization, where the factors L and U have the same sparsity pattern as the original matrix—the ILU(0)-GMRES algorithms, respectively, and compared the computation time and convergence. In the course of the research, the inﬂuence of the preconditioner and restarts of the GMRES (m) algorithm on the computation time was revealed; in particular, they were able to speed up the program.


Introduction
The modeling of hydrodynamic processes that take place in oil reservoirs is one of the difficult problems of fluid mechanics. This is due to the fact that the processes occurring in reservoirs can be very complex. It is necessary to take into account phase transitions, chemical transformations, temperature effects, degassing processes when pressure drops at the bottom and in the reservoir, etc. When simulating multiphase, multicomponent flow in porous media, the phase properties can vary depending on the composition of phases, temperatures (in oil reservoirs, they can reach up to 200 • C) and pressure (in oil reservoirs, it can reach up to 150 MPa). For adequate modeling of complex flow processes that occur in oil reservoirs, it is necessary to take into account the component composition of the phases [1,2]. Accounting for convection, diffusion, phase transitions and chemical reactions makes it difficult to simulate such problems [3][4][5][6].
In [7,8], the authors used various methods and schemes (IMPES, SS, etc.) in order to simulate multiphase, multicomponent flow in porous media. Other methods and schemes can be found in [9][10][11][12]. We could find Newton's method often in current research works in this area. Newton's method underlies many algorithms used to solve modeling problems. The compositional modeling of oil and gas reservoirs requires the construction and solution of large, rare, non-linear systems. The solution of sparse linear systems is the most timeconsuming part of many sciences and engineering applications; we usually spend over 70% of the time on solving linear systems obtained from Newton's methods [8].
Linear solvers and preconditioners have been studied for decades, and various methods have been developed [13][14][15]. Saad et al. developed the linear solver of the generalized minimal residuals method (GMRES), which is a general-purpose solver for asymmetric linear systems [16,17]. Vinsome developed the ORTHOMIN solver (a variant of the generalized coupled residuals method with incomplete orthogonalization), which was developed initially for reservoir modeling [18]. The BICGSTAB solver (stabilized bis-conjugate gradient method) is also widely used for oil modeling. We could apply these linear solvers of the Krylov subspace methods to any kinds of linear systems. We can understand the main idea of the Krylov subspace method as the process of recursively constructing the residual vector for each iteration step. Let the linear algebraic equations of the solution be: Take K m = K m (A, r 0 ) = span r 0 , Ar 0 , A 2 r 0 , . . . , A m−1 r 0 where r 0 = b − Ax 0 , and x 0 is the initial solution, looking for an approximate solution x m from x 0 + K m , so that the residual vector is orthogonal to another subspace L m , that is, r m = b − Ax m ⊥L m , and then K m is the Krylov subspace, and the above method is called the Krylov subspace method.
The GMRES algorithm [17] is one of the popular Krylov subspace methods, which is used to solve the solution of asymmetric linear equations. GMRES has very small residuals, but as the number of iterations increases, the amount of calculation and storage increases linearly, which is not efficient. So, the commonly used restarted GMRES, denoted by GMRES(m) [19], performs m iterations of GMRES, and then the resulting approximate solution is used as the initial guess to start another set of m iterations. This process repeats until the residual norm is small enough. The group of m iterations between successive restarts is referred to as a cycle, and m is referred to as the restart parameter. We indicate the restart cycle number with a subscript: x i is the approximate solution after i cycles, or m × i total iterations, and r i is the corresponding residual. The shortcoming of this method is that it reduces the robustness of the original GMRES algorithm and cannot guarantee the convergence of the algorithm. In addition, due to the fact that the restarted algorithm convergence may become very slow, this may affect the good convergence of the GMRES algorithm on specific issues due to the selection problem of m.
Besides the restarted GMRES(m) algorithm, another way to reduce the number of iterations of the GMRES method is that we use preconditioning as an explicit or implicit modification to the system of linear equations. Therefore, similar to other iterative methods, we usually combine the GMRES algorithm with a preconditioner for accelerating convergence. We could effectively and easily realize the incomplete LU factorization for sparse matrices with no fill or ILU(0) to obtain the preconditioning matrices [16,17,20,21]. Incomplete LU factorization assumes that sparse matrix A is represented in the form A = LU + R, where the matrices L and U are lower and upper triangular matrices, respectively, and the matrix R is the residual of the decomposition. After the ILU factorization is performed, the matrix M = LU can be used as a preconditioner. ILU factorization is also the basis of many preconditions, such as domain decomposition methods.
This article considers the mathematical model describing the process of multiphase, multicomponent fluid flow linearized using Newton's method in a simulation, and we solve the system of the algebraic equation with one of the Krylov subspace methods-the Newton-GMRES method. We especially consider a one-dimensional problem of multicomponent filtration of a liquid in a porous medium with the Newton-GMRES method. We solve and analyze the problem with the pure GMRES method, restarted GMRES(m) and preconditioned ILU(0)-GMRES method.

Mathematical Modeling
The considered model of multiphase, multicomponent flow in porous media makes it possible to simulate such modern methods of hydrocarbon production as the injection of coolant into an oil reservoir, combustion, injection of chemical reagents (polymer, surfactant) and others.
Let us consider a mathematical model of the multicomponent flow of three-phase (w-water, o-oil, g-gas) fluid in a porous medium. We write the mass conservation law for each component [8]: Fluids 2021, 6, 355 where N c -the number of components; φ-the porosity of porous media; x mo , x mg -the mole fraction of component m in the oil and gas phases; ξ w , ξ o , ξ gthe molar density of the water, oil and gas phases; S w , S o , S g -the saturation of the water, oil and gas phases; q w , q m -the molar velocities of the water flow and m-th component, respectively. In Equations (2) and (3), the flow rates u α are given by the Darcy law: where ℘-the gravitational acceleration; ρ α -the pressure of phase α.
In addition to the differential Equations (2)-(4), the following algebraic expressions hold: where p cow -the capillary pressure between the oil and water phases; p cg -the capillary pressure between the gas and oil phases. For the closure of the system (1)- (7), we set the conditions for the equilibrium relation below, which is described by Gibbs law for the composition system: where ϕ mα -the fugacity coefficient of component m in phase α which is oil or gas, and f m and f mg are fugacity functions of m-th component in the gas and liquid phases, respectively. We described the distribution of chemical components in the hydrocarbon phase by the K-value method (instantaneous evaporation coefficient) and determined each component by the following expression: We described the thermodynamic behavior of fluids under reservoir conditions using Peng-Robinson equations of state [22], in which the relationship between pressure, temperature and phase volume is determined.

Numerical Method
In the considered system of differential equations, several components in the hydrocarbon system are provided. From the computational point of view, the computation time and the number of operations for solving this system increase with increasing the number of components. Therefore, it is necessary to group several components with the same chemical compositions into pseudo-components. We wrote the system of equations for three phases and two components as below (neglecting gravitational forces): System of Equation (10) has dependent variables (x_1o, x_2o, x_1g, x_2g, u_α, p_α, S_α). By changing variables and using several arithmetic operations (described in detail in the article [23]), you can obtain a nonlinear system of 6 equations with 6 unknowns (x_1o, L, z, F, S, p), where F-the total mass variable; L and V-the mass fractions, z_m-the total mole fraction: This system is linearized by Newton's method. For function v, we set: v n+1,l+1 = v n+1,l + ∆v where l refers to the number of Newton's iteration, and ∆v represents the increment in this iteration step; n-the time approximation level. In the (l + 1)-th layer of the Newton iterative process, the value of the unknowns is updated by the following law: The calculation algorithm is as follows [23]: 1. Equation (11) is substituted into the finite difference form of a system of nonlinear equations of 6 variables.

2.
We obtain a system of linear equations with unknown ∆p i and solve it using the GMRES method.

3.
Further, using the known ∆p i , we find the unknown ∆x 1oi (∆x 2oi is found by relation (5)), Next, ∆x 1gi and ∆x 2gi are calculated according to (5). 5. Next, the unknowns x 1oi , L i , z i , F i , S i , are found using (10).
As mentioned earlier, the resulting system of linear equations was also solved by the ILU(0)-GMRES method. There is a limitation in the incomplete LU decomposition; namely, problems may arise when the diagonal element of the matrix is equal to zero. This problem can be solved by selecting the reference element or, in other words, by pivoting [24]. In our problem, the diagonal elements of the matrix had a nonzero value, and finding the preconditioner did not require additional operations.
In the Figure 1, you can see a diagram of the computational algorithm.
lation (5)), △ , △ , △ , △ . 4. Next, △ and △ are calculated according to (5). 5. Next, the unknowns , , , , , are found usi As mentioned earlier, the resulting system of linear equa ILU(0)-GMRES method. There is a limitation in the inco namely, problems may arise when the diagonal element of the problem can be solved by selecting the reference element or, [24]. In our problem, the diagonal elements of the matrix had a the preconditioner did not require additional operations.
In the Figure 1, you can see a diagram of the computatio

Results and Discussion
To find ∆p_i, the algorithms GMRES, restarted GMRES(m) and preconditioned ILU(0)-GMRES were used. The matrix of coefficients of this system of linear equations is shown in Table 1 for various mesh sizes. The characteristics of the computer are the processor with 4-core Intel Core i7 3770 and RAM with 8 GB. In order to perform the calculation, we created six different dimensional matrices as shown in Table 1, which shows the number of points in each matrix and the number of nonzero elements. We have obtained a comparative graph of the time for calculating one Newton-GMRES iterative calculation ( Figure 2) and the number of the GMRES inner iteration (Figure 3). In Table 2, we can see the acceleration obtained by preconditioning. number of points in each matrix and the number of nonzero elements. We have obtained a comparative graph of the time for calculating one Newton-GMRES iterative calculation ( Figure 2) and the number of the GMRES inner iteration (Figure 3). In Table 2, we can see the acceleration obtained by preconditioning. As one can see, the GMRES algorithm with ILU(0) preconditioning works 4.5-5 times faster than the algorithm without preconditioning for all matrices. This result allows us to conclude that this speedup will persist as the size of the task increases   As can be seen from Table 4, in some cases, the total number of iterations is fewer than when m = 100, but the algorithm is slower. This is due to the fact that at m = 100, at each restart, the program builds a smaller orthogonalization basis.  As one can see, the GMRES algorithm with ILU(0) preconditioning works 4.5-5 times faster than the algorithm without preconditioning for all matrices. This result allows us to conclude that this speedup will persist as the size of the task increases As one can see from Figure 2, the GMRES(m) algorithm takes less time than the other two computing algorithms. However, it was selected experimentally by repeatedly giving values ranging from 100 to 1500 to obtain the appropriate value of six different matrices. For example, experimental calculations for matrix #3 are shown in Table 3; as we have seen from this table, when m = 500, algorithms obtain the minimum computational time and number of iterations, and for matrix #4, as can be seen from Table 4, the algorithm is executed faster when m = 100. As can be seen from Table 4, in some cases, the total number of iterations is fewer than when m = 100, but the algorithm is slower. This is due to the fact that at m = 100, at each restart, the program builds a smaller orthogonalization basis.
The appropriate value of m for the matrix of Table 2 is given in Table 5. As we have noted, in different matrix sizes, the value of m for the GMRES(m) algorithm is different. However, the optimal m value of matrix #4, #5 and #6 is 100, but with substantial inner iterations (Figure 3). Although the ILU(0)-GMRES algorithm is slower than the GMRES(m) algorithm, there is no need to carry out repeated experiments to obtain the optimal value of m. Moreover, with the ILU(0)-GMRES algorithm, we had better convergence then GMRES(100) for matrix #4, #5 and #6. Moreover, the GMRES algorithm is the slowest and most assured the number of iterations.

Conclusions
This article discusses the Newton-ILU0-GMRES method for solving the problem of multiphase, multicomponent flow in a porous medium. The equations describing the motion of a multicomponent, multiphase flow in a porous medium were linearized using Newton's method. The resulting system of linear equations was solved using the GMRES algorithm. In addition, a preconditioner and a modification of the method with restarts (GMRES(m)) were used to speed up the method. The analysis and comparison (calculation time, convergence) of the Newton-GMRES, GMRES(m) and ILU0-GMRES methods were carried out. The numerical results demonstrate that for the one-dimensional problem of multicomponent flow in a porous medium, the GMRES algorithm is the most timeconsuming. The GMRES algorithm with ILU(0) preconditioning works 4.5-5 times faster than the algorithm without preconditioning. For the problem size equal or bigger than matrix #4 for the GMRES(m) algorithm, the suitable m value is 100, but convergence is slow. The ILU(0)-GMRES algorithm calculated slower than the GMRES(m) at the larger size of the matrix but with better convergence in solving the given problem.
Similar results can be obtained for two-dimensional and three-dimensional equations by applying to them an analogous method of solving, but with the condition that the matrices of the resulting systems of linear equations satisfy the constraints of Incomplete LU factorization.