One Approach to Numerical Modeling of the Heat and Mass Transfers of Two-Phase Fluids in Fractured-Porous Reservoirs

: The work is devoted to numerical modeling of the processes of heat and mass transfer of a two-phase ﬂuid in the environment of a production well, which is necessary for monitoring the development of fractured-porous reservoirs. This work proposes an efﬁcient approach to constructing a solution to the problem. To solve the problem, a model of the “double medium” type is used, where the pore part of the reservoir is considered as the ﬁrst medium, and the system of natural fractures is considered as the second medium. For the resulting mathematical model, the difference schemes with time weights are constructed based on the algorithm of splitting by physical processes, which ensure the correctness and consistency of ﬂuxes in the fracture system and the pore reservoir. In the numerical solution, the approximations of differential operators obtained in the framework of the ﬁnite difference method are used. For the parallel implementation of the developed numerical approach, the domain decomposition method and the matrix sweep algorithm are chosen. The program implementation is made using the MPI standard. Computational experiments are carried out, the results of which conﬁrm the effectiveness of the developed numerical algorithm and its parallel implementation. In numerical experiments, the distributions of pressure and temperature near an operating production well are obtained, on the basis of which it is possible to adjust the operation of wells in order to increase production.


Introduction
Many processes of heat and mass transfer occurring in nature are accompanied by the transfer of the mass of one substance to the mass of another substance [1,2].These processes are of great practical importance in various fields.One of these areas is the oil and gas industry, where the use of scientific approaches to improve development technologies is an integral part.
To date, the scale of hydrocarbon production has significantly increased, new fields with complex geological conditions are being put into development.And each new open object most often has degraded filtration properties, which requires new approaches to development.In this regard, the level of requirements for the study of the movement of liquids (gas, oil and water) in operated reservoirs has significantly increased.
Oil fields are confined to uplifts of sedimentary rocks, which are accumulations of grains of minerals interconnected as a result of geological processes [3].In carbonate rocks, the pore system is characterized by strong heterogeneity, while the system of secondary voids is more developed.Secondary voids include fractures caused by tectonic stresses and caverns resulting from various chemical reactions [4,5].The length and dimensions of fractures and cavities may exceed the dimensions of primary pores.All of the above gives the features of the well-known theory of fluid filtration in reservoirs.One of them is the need to simultaneously consider processes in different media, namely, in two different systems (a system of natural fractures and a pore part of a reservoir (matrix)) with different reservoir properties, which numerically can reach a difference of several orders of magnitude [6,7].
Information about the reservoir consists of data from the study of rock samples, hydrodynamic studies of wells, analysis of the results of oil and formation water samples, and the history of field development [1].But with such a variety of data, the information obtained is limited and not always sufficient for unambiguously building a reservoir model.At the same time, conducted experiments at wells incur large economic costs, as well as large production losses due to shutdowns of wells for research.Under such conditions, the task of the study is to establish qualitative patterns, quantitative relationships that are resistant to variation in the initial data and expand the totality of information that cannot be obtained experimentally [8].Therefore, the solution of practical problems of the modern oil and gas industry is possible only with the help of numerical modeling, which requires the use of the most modern developments and fast solutions.
The process considered in this work is based on the well-known equations of hydrodynamics [2,9].For traditional filtration models of the "single medium" type, effective algorithms have been developed, both direct ones for modeling the filtration process, and methods for interpreting hydrodynamic research data to identify model parameters.However, the situation is significantly more complicated when using models related to the "dual medium" [10,11], which is associated with practical features (the presence of two systems-the pore part of the reservoir and fractures) of the process under consideration, which complicate the model.
The programs for analysis and interpretation of results that exist both in Russia and abroad do not allow for a full range of calculations and are not always computationally efficient, which limits the range of technical and economic development problems solved with their help.Therefore, there is a need to create a fast calculation tool based on effective numerical algorithms that will allow solving operational planning problems that arise during field development, which include an express assessment of the required shutdown duration before the study, as well as a thorough study of the behavior of fluid dynamics processes at various reservoir parameters.
The difficulty of solving the problem lies in the large number of variables that affect the ongoing processes, in the nonlinearity of the basic equations of hydrodynamics, heat and mass transfer, in the impossibility of obtaining all information about the course of the process due to the high laboriousness of experimental studies [12].
Numerical modeling of such processes is also associated with great difficulties, similarly associated with a large number of unknowns and the use of small time steps [12,13].The possibilities of modern computer technologies make it possible to implement tasks of this kind.To successfully solve the problem, an efficient numerical algorithm is needed, with the possibility of running on the architecture of large supercomputers.
In our previous works [14,15], the isothermal process of mass transfer of a two-phase fluid in a fractured-porous reservoir was considered in a one-dimensional setting.An original implicit finite-difference scheme on a non-uniform spatial grid and a parallel algorithm for solving the problem were proposed.The obtained calculation results confirmed the efficiency of the proposed algorithm and its parallel implementation.
In this work, we consider a non-isothermal process of heat and mass transfer of a two-phase fluid in a carbonate reservoir of a fractured porous type.A new mathematical model has been constructed for it, which additionally includes the energy equation.For this model, an original difference scheme with splitting by physical processes has been developed.The scheme ensures the correctness and consistency of fluxes between the natural fracture system and the pore reservoir.Within the framework of the program implementation, the proposed numerical algorithm was parallelized using the MPI standard and the domain decomposition technique.With the help of the developed program, a series of computational experiments was carried out.A feature of the performed calculations is the use of field and geophysical data on the production characteristics and the filtration and capacitance properties of the formations.The goals of the calculations were to determine: (a) the optimal number of processes for solving the system of difference equations; and (b) the pressure and temperature dynamics depending on formation permeability values.The results of numerical experiments confirmed the correctness and efficiency of the developed numerical approach.

Problem Statement
The process of heat and mass transfer of a two-phase fluid in a carbonate reservoir (see Figure 1) is considered, where there are two pore systems-a system of fractures and the pore part of the reservoir (matrices).Figure 1 presents a fragment of the reservoir.Each of the systems is characterized by its own reservoir parameters (k, φ), the difference between which is achieved from one to several orders.At the initial moment of time, the formation is not disturbed, i.e., initial formation pressures (P 0 ) and temperature (T 0 ) are set.The well is put into operation with constant bottom hole pressure (Pw f ).At the moment of putting into operation, due to the created depression, the inflow of fluid from the formation to the well begins.The fluid flow occurs only along the fractures, and the pore part of the reservoir (matrix) is a certain capacity of fluid accumulation and is taken into account by introducing special functions [16].When the pressure in the fracture system decreases lower than in the pore part (matrix), fluid flows from the matrix into the fractures.
It is assumed that the reservoir is homogeneous and isotropic.The flow of a weakly compressible fluid in a system of fractures is within the validity of Darcy's law.It is necessary to reproduce the dynamics of pressure and temperature during the operation of the well at different times and distances from the well at different values of fracture and matrix permeability.Figure 1 shows a scheme of a well and a reservoir.
The Christmas tree in Figure 1 is the system of mechanisms and devices designed to seal the mouth of pumping and fountain wells and their mutual isolation; fractures are the secondary voids caused by tectonic stresses, through which fluid flows; the pore part of the formation (matrices) is the rock that has physical properties that allow it to accumulate water, oil and gas, as well as filter and release them in the presence of a pressure drop; the carbonate reservoir is the type of reservoir, which mainly consists of limestone and dolomite, with a developed system of secondary voids; R = L is the distance to which reservoir disturbances reach during well operation; P f w is the bottom hole pressure; and P 0 and T 0 are the initial reservoir pressure and temperature.
The mathematical description of the filtration processes is presented on the basis of the classical laws of continuum mechanics [1,2].
Here, α = f , m, where f is the fracture system, m is the matrix system, i = o, w, where o is the oil, w is the water, P f is the formation pressure in the fracture system (Pa), P m is the formation pressure in the matrix (Pa), φ f is the porosity in the fracture system, φ m is the porosity in the matrix, ρ α o is the density of oil (g/m 3 ), ρ α w is the density of water (g/m 3 ), is the saturation of oil or water in the fracture system, S m i is the saturation of oil or water in the matrix, U α i is the flow velocity of oil or water, q α i is the function of redistribution of the fluid between the matrix and the fractures, σ is the coefficient of fractured rock (1/m 2 ), ε α i is the energy of oil/water, s is rock skeleton, ρ s , ε s is the density and energy of the system, k α is the absolute permeability (m 2 ), k rw and k ro are the relative phase permeabilities of water and oil, µ o is the viscosity of oil (Pa•s), and µ w is the viscosity of water (Pa•s).
Let us introduce notations: where T is the temperature (K), and η f w , η m w , η s are the thermal conductivity coefficients in the system of fracture, matrix and skeleton.
The flow of fluid from the pore part of the reservoir into fractures is described by the following functions: The generalized Darcy's law is applied, according to which the filtration velocities of oil and water are equal to: Here, α = f , U m o = U m w = 0. We note that the investigated well is not affected by wells of the environment, while the reservoir is presented as infinite.In this regard, the right boundary condition is represented by constant pressure and temperature at the boundary, the left boundary condition is set by constant bottom hole pressure and temperature.For the initial condition, reservoir pressures and temperatures in the matrix and fractures at the initial time are used.
Problems ( 1)-( 7) are a complex system of equations of mathematical physics of a mixed type.An important circumstance is that the problem formulated in the form of conservation laws, with a common matrix of the system with respect to water saturation, pressure and temperature, has mixed hyperbolic and parabolic properties.The direct use of such a system for the purposes of determining the dynamics of the above variables and constructing an implicit difference scheme required for calculating parabolic equations with large time steps is difficult.Accordingly, the numerical solution is not a trivial problem.To solve this problem for the initial equations, the method of splitting by physical processes [9,12,17,18] is used, where the equations are separated into the piezoconductive part and with respect to saturation transfer.
System (1)-( 7), after some algebraic transformations, will be presented in the following form:

Difference Scheme Construction
A one-dimensional statement of Problems ( 1)-( 7) is considered.An implicit finite-difference scheme on a uniform grid is used to solve partial differential equations [15,19,20].Note that the approach presented below will be the basis for the problem in the multidimensional case.The use of a non-uniform grid is also possible for this statement.(11) where x i are the coordinates of grid nodes in space, h is the grid step in radius, t j are the coordinates of grid nodes in time, τ is the grid step in time, and N and M are the number of nodes in space and time, respectively.The grid values (pressure and saturation) are determined in x i .The i + 1/2-th cell of a one-dimensional grid 1)-( 3) are approximated by their grid analogues [19,20]: (φ [(φ Here, φ = hφ, (1 denotes the approximation of the grid function a between the layers in time t and t, t = t + τ, τ is the time step, and up denotes an upstream approximation of the expression, (DINa) i = (a i+ 1 2 . After splitting, the system ( 12)-( 14) has the form: As a result of the linearization of Equation ( 16), we obtain a relationship between the increments of pressures in the matrix (δP f ) and in the fracture (δP m ), temperature (δT) and the residual (Φ ms ). where Here, a ≈ means that the meanings of the value of the implicit layer in time are taken at a known iteration.The index s, denoting a known computed iteration, has the same sense.The prime denotes the derivative with respect to thermodynamic variables (pressure or temperature).Here, F ms is taken from (17) with the meanings of the values of the implicit layer in time from the s-th iteration.Further, the linearized system of Equations ( 15) and ( 17), taking into account Equation (18), will have the form: where the matrices have the following form: Here, F f s is taken from (14) with the meanings of the values of the implicit layer in time from the s-th iteration.Then, the index k ± 1/2 is replaced by k ± 1/2. where Here, it is supposed to be P s = (φ f P f + φ m P m )/(φ f + φ m ).Next, we denote the specific heat capacity at constant pressure by C p and have the following: where Here, we accept (P s ) P m = φ m /(φ f + φ m ) and, with this in mind, (P Here, Φ εk is taken from Equation ( 17), with the meanings of the values of the implicit layer in time from the s-th iteration.
We take The resulting Equation ( 22) is represented by a system of linear algebraic equations, which is solved using a matrix sweep method on each time layer.

Matrix Sweep
The implicit in pressure and implicit in saturation (IMPIS) method [9] was used to numerically solve the system of equations of two-phase filtration in a fractured-pore type collector ( 8)- (10).The first block with respect to the pressure and temperature equations was solved using an implicit finite-difference scheme; after finding these parameters in the matrix and fractures, they proceeded to calculate the second block with respect to saturation.
As a result of the approximation of partial derivatives by the corresponding finite differences, we obtain a system of linear algebraic Equations (SLAE) (10) with a matrix of a block-tridiagonal structure [19].For the convenience of solving, we write the SLAE (22) in the canonical form: Here, A, B, C are the square matrices (blocks) of dimension 2 by 2 (the first line is the piezoconductive part, the second line is the energy part, numbering from 0); y are the desired pressure δP and temperature δT, and F are the vectors of dimension 2 × 1.
To solve System (48), we used the matrix sweep method, which is similar to the sweep method for scalar three-point equations [19].To implement the method, operations on matrices are required: addition, multiplication and transposition, which were implemented as separate functions.The matrix sweep method itself is moved to a separate function, because during the calculation, it will be accessed on each layer in time (iteration).The solution consists of two steps, namely moving forward and moving backward: The formulated problem is very time-consuming; this is manifested in the modeling of filtration processes in long reservoirs.To do this, it is necessary to use grids with a large number of nodes, as a result of which the computation time increases significantly.To solve this problem, parallelization of the algorithm is used.
The matrix sweep parallelization algorithm is based on the well-known scalar sweep parallelization algorithm, and is implemented in program language C using the MPI standard [21].But it is worth noting that, compared with scalar sweep, the coefficients of the equation in this case are matrices and vectors, respectively; it is necessary to allocate more memory for variables with the help of which the collective interaction of processes takes place.
To describe the parallel algorithm, we introduced a uniform partition of the set of grid node numbers Ω = 0, 1, . . ., N into adjacent non-intersecting subsets (m = 0, . . .,p − 1 is the logical number of the MPI process).
One of the stages of parallelizing the sweep is the solution of a short problem: where the index i ± 1 is understood as the transition to the corresponding neighboring element from the set Ω = {i (0) 1 , . . ., i }. A, B, C, F are the coefficients of the equation, which are found from the coefficients of Equation ( 48) and the basis functions.
To solve a short problem, all MPI processes carry out a collective exchange of coefficients; the details of the algorithm are presented in [15].This algorithm is implemented using the MPI_Allreduce function, the parameters of which are presented below.
For a scalar sweep, the call to this function has the following form: MPI_Allreduce(dd,ee,4*ncp,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD), where the function parameters are as follows: dd is the address of the beginning of the input buffer; ee is the address of the beginning of the receive buffer; 4*ncp is the number of elements in the input buffer; MPI_DOUBLE is the type of elements in the input buffer; MPI_SUM is the operation by which the reduction is performed; and MPI_COMM_WORLD is the communicator.
For a matrix sweep with a matrix dimension of 2 × 2, the call to this function has the following form: MPI_Allreduce(dd,ee,14*ncp,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD).Here, in the arrays dd and ee, there are three matrices, each with four elements, and one vector with two elements.The number of elements (A, B, C, F) from Equation (48) is 14.
Each internal process needs 14 × 2 (left and right borders) = 28 elements of the dd array.The zero and last processes have 14 elements, respectively, i.e., the number of elements in the send buffer changes.
The calculations were performed on the K100 hybrid supercomputer at the Center of Collective Usage of KIAM RAS [22].
To check the quality of parallelization with a change in the number of processes, a number of calculations were carried out for a small number of calculated time steps.For example, as a result of running the program on a grid with 1000 spatial steps and 70,000 time steps in serial mode, the calculation time is 25 s; in parallel mode on 16 processes, the calculation time is 2.8 s, while the parallelization efficiency is 0.558.This means that the overhead in the parallel variant is slightly less than half the estimated time.However, this is offset by an acceleration of almost nine times.
In the case of a multidimensional boundary value problem in rectangular domains, it is possible to effectively use the parallel sweep algorithm at the stages of implementation of iterative or time schemes with a factorized operator [23,24].The examples are solving the multidimensional Poisson equation by the alternating direction method or solving the multidimensional heat equation using locally one-dimensional difference schemes.

Results
Based on the developed module, a series of computational calculations was carried out.We note that the input parameters are taken and varied on the basis of field studies at wells and various carbonate deposits in Russia.To verify the model, the calculated data were compared with the field data.
The following condition was considered for the formulation under consideration.The well has been idle for a long time.It is assumed that the pressure and temperature in the The computational domain starts at a distance of 0.1 m from the borehole axis, and ends at a distance of 1 m from this axis.The dimensions of the computational grid are determined by the constant spatial step h = 0.0009 m and the total number of steps N = 1000, which is 0.9 m.The initial time step is set equal to τ = 0.1, and varies depending on the number of iterations.
The change in permeability has the greatest effect on the pressure and temperature distribution front.Therefore, in the calculations, we will vary the values of absolute permeability in fractures.Figure 2 shows the dynamics of the pressure stabilization curves near the well for three absolute permeabilities, corresponding to 1 × 10 −12 m 2 , 1 × 10 −13 m 2 , 1 × 10 −15 m 2 We note that under given conditions with permeability, the pressure drops faster.In this regard, for reservoirs with high permeability k f = 1 × 10 −12 m 2 , it is necessary to select the characteristics of the well operation so that the pressure sinks more slowly over a short period of operation, otherwise this will lead to rapid depletion of the reservoir.Figure 3 shows the dependence of pressure on the radius for various values of absolute permeability in fractures at the final time.Based on these calculations, it is possible to determine the area of pressure distribution for various time values.We note that at high permeability, the pressure distribution has a larger radius around the production well, which indicates a larger drainage zone.Figures 4 and 5 show temperature versus time and distance, respectively.Note that the rate of temperature propagation in comparison with pressure is negligible.However, there is a difference.The radius of change in the temperature front will be slower than with pressure.To study the properties of the matrix sweep parallelization algorithm and compare it with a sequential code, we use such characteristics as speedup coefficients (S m ) and efficiency coefficients (E m ).
where S m is the speedup, E m is the efficiency, T m is the execution time of the parallel program on m processes, and T 1 is the execution time of the sequential program.
Table 1 shows the speedup and efficiency factors depending on the number of processes.We see that the speedup grows, and the efficiency decreases moderately.The analysis of Table 1 showed that the matrix sweep algorithm accelerates the calculation time, which confirms the validity of using multiprocessor calculations for the problem under consideration.

Conclusions
The mathematical model of the mass transfer process taking into account the nonisothermal nature of a two-phase fluid in a fractured-porous reservoir based on a dual porosity model was developed.Based on the algorithm of splitting by physical processes, a difference scheme with time weights was constructed, which ensured the correctness and consistency of fluxes between the system of natural fractures and the pore reservoir.For the numerical solution of the problem, an original implicit finite-difference scheme on a spatial grid was proposed.The resulting system of equations was solved using a parallel matrix sweep algorithm.A series of computational experiments was carried out, the results of which confirmed the effectiveness of the developed numerical algorithm and its parallel implementation.Let us pay attention to the advantages of the proposed algorithm in comparison with a completely implicit scheme: three systems of equations of a smaller dimension were solved, instead of one.In all calculations, it was found that such an approach, when the system was split by physical processes, and the groups of equations were solved implicitly, ensured the reliability of the calculation in the investigated range of parameters and acceptable speed, which was quite suitable for solving practical problems.The calculated data were compared with field data; the error did not exceed 5%.The coefficients of speedup and efficiency for a different number of processes were presented.The optimal number of processes was obtained for fixed grid parameters.The result of the modeling was the distribution of pressure and temperature in a fracturedporous reservoir near an operating production well with varying permeability values in fractures.It was noted that the higher the permeability in the system, the faster the pressure dropped during the well operation.These calculations will allow us to monitor and regulate the work of wells in order to increase production.

Figure 1 .
Figure 1.Scheme of the well and reservoir.
formation around the well have recovered to the initial values: P f 0 = 36 MPa, P m 0 = 36 MPa, T 0 = 96 • C. Wells in the environment are not affected.Then, the well in question is put into operation with a constant bottomhole pressure P f w f = P m w f = 28 MPa.At the moment of start-up, a depression funnel is formed in the reservoir and fluid begins to flow into the well.It is necessary to investigate the behavior of pressure and temperature around the operating well at various permeability values.The following parameters were used in the calculation: P f 0 = 36 MPa, P m 0 = 36 MPa, P f w f = 28 MPa, P m w f = 28 MPa, φ f = 0.01, φ m = 0.1, ρ o = 740 kg/m 3 , ρ w = 1118 kg/m 3 , S f w = 0.4, S m w

Figure 2 .
Figure 2. Pressure curves for different absolute permeabilities in fractures.

Figure 3 .
Figure 3. Pressure curves for different absolute permeabilities in fractures at the end time.

Figure 4 .
Figure 4. Dynamics of temperature curves for different absolute permeabilities in fractures.

Figure 5 .
Figure 5. Temperature curves for different absolute permeabilities in fractures.

Table 1 .
The speedup and efficiency of the parallel algorithm.