Standard Galerkin method SG Petrov–Galerkin method PG

where M ik ¼ Z Q W i N k dQ The diagonalized lumped matrix coefficients are then M lump ii ¼ Z Q W i dQ ¼ : V i 13 Reformulating the discretized equations using eqn 10 and eqn 12 gives fV i Dt ˆS n þ 1 n , i ¹ ˆ S n n , i ¼ X j[h i Z Q ˆp n þ 1 w , j ¹ ˆp n þ 1 w , i ÿ ¹ r w g ˆ D j ¹ ˆ D i ÿ 3 l n þ 1 w , ij =W i ·K·=n j dQ ¹ q n þ 1 w , i V i ¹ m n þ 1 w , i ¹ fV i Dt ˆS n þ 1 n , i ¹ ˆ S n n , i ¼ X j[h i h ˆp n þ 1 w , j ¹ ˆp n þ 1 w , i ÿ þ ˆp n þ 1 c , j ¹ ˆp n þ 1 c , i ÿ ¹ r n g ˆ D j ¹ ˆ D i ÿ i l n þ 1 n , ij =W i ·K·=N j dQ ¹ q n þ 1 n , i V i ¹ m n þ 1 n , i ð 14Þ where q n þ 1 a , i V i ¼ Z Q W i q n þ 1 a dQ In the dp c dS w =S w formulation, the difference of the nodal capillary pressure values ˆp n þ 1 c , j ¹ ˆp n þ 1 c , i in the integral is replaced by ¹ dp c =dS w ˆS n þ 1 n , j ¹ ˆ S n þ 1 n , i . Since the node values of pressure and gravity in the integral terms above are constants, the equations are reduced to fV i Dt ˆS n þ 1 n , i ¹ ˆ S n n , i ¼ X j[h i ˆp n þ 1 w , j ¹ ˆp n þ 1 w , i ÿ ¹ r w g ˆ D j ¹ ˆ D i ÿ 3 Z Q l n þ 1 w , ij =W i ·K·=n j dQ ¹ q n þ 1 w , i V i ¹ m n þ 1 w , i ¹ fV i Dt ˆS n þ 1 n , i ¹ ˆ S n n , i ¼ X j[h i ˆp n þ 1 w , j ¹ ˆp n þ 1 w , i ÿ þ ˆp n þ 1 c , j ¹ ˆp n þ 1 c , i ÿ ¹r n g ˆ D j ¹ ˆ D i ÿ 3 Z Q l n þ 1 n , ij =W i ·K·=N j dQ ¹ q n þ 1 n , i V i ¹ m n þ 1 n , i ð 15Þ For homogeneous media, the permeability tensor K is constant over the entire domain. At interfaces between zones of different rock properties, K is harmonically weighted. We apply now the influence coefficient tech- nique 19,6 to all three discretization methods, characterized by the following approximation where l A a , ij ¼ l ¯S , ¯S being the saturation at some specific point in the intersection of the support of W a,i and N j . A and B are introduced as general superscripts indicating the choice of discretization for the mobility term l a and trans- missivity integral transmissibility g a , respectively. Sub- stitution of Eq. 16 into eqn 15 yields the following generalized Galerkin finite element formulation ¹ 1 d aw f ˆS n þ 1 n , i ¹ ˆ S n n , i V i Dt ¼ X j[h i l An þ 1 a , ij g B a , ij w n þ 1 a , j ¹ w n þ 1 a , i ÿ þ q n þ 1 a , i V i þ m n þ 1 a , i a [ {w , n} ð 17Þ where w n þ 1 a , i ¼ ˆp n þ 1 w , i þ d an ˆ P n þ 1 c , i ¹ r a g ˆ D i 18 In contrast to the generalized Galerkin finite element repre- sentation in eqn 17 for the =p c formulation, the integral terms of the dp c dS w =S w formulation are evaluated using a four-point Gauss quadrature rule. For the different discretization methods we will demon- strate that, in general, upstream weighting improves the front approximation for homogeneous media. However, not all choices of upstream weighting guarantee the correct physical behaviour of the numerical solution. The different discretizations of the mobility term and transmissivity integral are now presented, illustrated, and discussed.

3.1 Standard Galerkin method SG

The SG method is characterized by the same choice for linear test and shape functions, i.e. W i ¼ N i . Under the assumption of a linear approximation of the mobility l a over each element, the mobility term is arithmetically weighted, resulting in l SG a , ij ¼ 1 2 l a , i þ l a , j , a [ {w , n} 19 For capillary diffusion dominated processes, this method works quite well. However, when convection becomes dominant, it is well-known that the use of arithmetically averaged mobilities as it is done by SG renders the scheme unstable and produces oscillating non-physical solu- tions. 16,8 16 700 R. Helmig, R. Huber

3.2 Petrov–Galerkin method PG

In order to ensure convergence of the numerical solution, a modified Petrov–Galerkin method was devel- oped in which the test functions are up to two polynomial degrees higher than the shape function. 7,20,21 We consider the case of piecewise quadratic test functions in one dimension having the following representation for an ele- ment x i , x j W a , k ¼ N k þ ˜ a a , k F Q , k [ {i , j} and a [ {w , n} 20 where the quadratic term F Q is given by F Q ¼ 4 ˜x 2 ¹ ˜x ÿ ; ˜x ¼ x ¹ x i = x j ¹ x i . Let k ¼ i, then the corresponding upwind parameter ˜ a a , i for the a phase equation is defined by ˜ a a , i ¼ ¹ 1 if w a , j ¹ w a , i , 0 0 if w a , j ¹ w a , i ¼ , a [ {w , n} , 1 if w a , j ¹ w a , i . 0 8 : 21 where w a,i and w a,j are evaluated at the previous iteration step. The use of a two-point Gaussian quadrature rule with Gauss points at x i þ 1=2ð1 6 ð1=  3 p ÞÞ x j ¹ x i ÿ results in the following weighting of the nodal mobilities l PG a , ij ¼ 7 6 l a , i ¹ 1 6 l a , j 22 in the case that node i is the upstream node for phase a. Consequently, in this case the mobility term l PG a , ij is par- tially upstream weighted. The PG method coincides with the SG method in the case when ˜ a a ¼ 0. Analogously to the development of modified upwind weighting functions for linear one-dimensional elements, it is possible to derive polynomials for bi- and tri-linear elements in two and three dimensions, respectively. 7 In order to avoid artificial cross diffusion in multidimensional problems, the upwind para- meters ˜ a are calculated from the streamlines. Fig. 2 illus- trates this for the derivation of parameter ˜ a e ij between nodes i and j of a rectangular element e. The velocity is evaluated at the two nearest Gauss points with respect to an element side. The two velocity vectors are normalized and projected to this element side. Consequently, the value of higher magnitude is selected as the upwind parameter for this element side. This upwind parameter is used to modify the components of the weighting functions corres- ponding to nodes i and j in the direction of this element side. This method ensures that the residual of this ele- ment is weighted in the upstream direction. The extension to arbitrary quadrilateral elements is straightforward.

3.3 Fully-upwind Galerkin method FUG