A method for solving the pressure equation in reservoir numerical simulation based on quantum computing
By adopting quantum computing methods in reservoir numerical simulation, using VQLS to solve the reservoir numerical simulation pressure equation, and using the grid sequence number adjustment strategy, the problems of solving accuracy and convergence speed of the pressure equation in reservoir numerical simulation are solved, and a better solution is achieved. High accuracy and faster convergence of reservoir pressure distribution calculations.
Patent Information
- Application Number
- CN202410126362.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-30
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-01-30
AI Technical Summary
In existing reservoir numerical simulations, it is difficult to obtain high accuracy in solving the pressure equation, and the convergence speed during the optimization process is slow, which affects the accuracy of reservoir calculations.
Using a method based on quantum computing, the finite volume method is used to calculate the linearized discrete pressure equation, and the variational quantum linear solver (VQLS) is used to solve it, combined with the grid number adjustment strategy to reduce the complexity of preparing quantum states and improve Optimize convergence speed.
A more accurate pressure solution is achieved under the same number of optimization steps, which improves the accuracy and convergence speed of reservoir numerical simulation.
Smart Images

Figure CN118070696B
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of oil fields, and in particular to a method for solving a reservoir numerical simulation pressure equation based on quantum computing. Background Art
[0002] Quantum computing is a new computing paradigm based on the principles of quantum mechanics that has the potential to surpass classical computing. The progress and breakthroughs in quantum computing are closely related to the introduction of quantum algorithms, which demonstrate the advantages of quantum computing in solving complex problems. Experimental progress in quantum computing began in the 1990s, when scholars explored the use of different physical systems to realize qubits and quantum operations.
[0003] However, current quantum computers face challenges such as difficulty in noise isolation and immature error correction technology, so it is expected that they will remain in the current intermediate-noise-scale quantum era (NISQ) for quite some time. At present, a variety of variational quantum algorithms suitable for NISQ quantum computers have been formed. These methods use parameterized quantum circuits and classical optimizers to approximate the solutions to specific problems, such as variational quantum eigensolvers (VQE), variational quantum linear solvers (VQLS), etc. In recent years, VQLS has been applied to solve linear equations in the numerical calculation of partial differential equations. For example, Liu et al. in 2021 and Cappanera in 2021 combined VQLS to solve the Poisson equation. In 2022, Liu et al. applied it to solve the heat conduction equation and verified the time complexity. In 2023, Trahan et al. applied VQLS to solve the finite element discrete solutions of the steady-state Poisson equation and the time-varying heat conduction and wave equations. In 2023, Ali and Kabel conducted extensive research on using VQLS to solve the Poisson equation and found that the performance of VQLS is limited by many factors and is difficult to converge in many cases. In 2023, Hosaka et al. found that preprocessing linear equations can reduce the number of ansatz layers required to achieve convergence, thereby improving the performance of VQLS.
[0004] Numerical simulation of oil reservoirs is essentially to use various numerical methods, mainly finite volume method, to discretize the partial differential equations of oil reservoir fluid flow to obtain the corresponding algebraic equations for solution. When the implicit pressure explicit saturation format is used, the calculation of the linearized pressure equation is the first step of oil reservoir simulation, which determines the distribution of seepage velocity in the calculation domain of the oil reservoir. However, there has been no research on the application of quantum computing in the field of numerical simulation of oil reservoirs. Summary of the invention
[0005] The purpose of the present invention is to provide a method for solving the reservoir numerical simulation pressure equation based on quantum computing, which can obtain high-precision reservoir pressure distribution, and the practical strategy provided can accelerate the convergence speed in the optimization process, thereby obtaining a more accurate pressure solution under the same number of optimization steps.
[0006] To achieve the above object, the present invention provides a method for solving the reservoir numerical simulation pressure equation based on quantum computing, comprising the following steps:
[0007] S1. Calculate the linearized discrete pressure equation using the finite volume method;
[0008] S2. The discrete pressure equation is solved using a variational quantum linear solver to obtain the pressure distribution in the reservoir area.
[0009] Preferably, in step S1, calculating the linearized discrete pressure equation using the finite volume method comprises the following steps:
[0010] Calculate the material conservation equation for phase a:
[0011]
[0012] in, is the divergence operator; v a is the seepage velocity of phase a; q a is the source and sink term of phase a; t is time; φ is saturation; S a is the saturation of phase a;
[0013] Let a = o or a = w; o represents the oil phase, w represents the water phase;
[0014] According to Darcy's law, we get:
[0015]
[0016] Among them, λ a , p a , k ra , μ a are the mobility, pressure, relative permeability and viscosity of phase a respectively; k is the permeability tensor;
[0017] Ignoring the capillary force and superimposing the material conservation equations of the oil phase and the water phase, we obtain the pressure equation:
[0018]
[0019] Among them, λ t =λ o +λ w is the total flow, λ o is the oil phase fluidity, λ w is the water phase mobility; p = po =p w is the fluid pressure, p o is the oil phase pressure, p w is the water phase pressure; is the comprehensive compression coefficient; q o is the source and sink term of the oil phase; q w is the source and sink term of the water phase;
[0020] Substituting equation (3) in the control volume Ω of grid i i Integrating over the time interval [t, t+Vt] yields:
[0021]
[0022] is the volume flow rate of the oil phase; is the volume flow rate of the water phase;
[0023] Among them, p t+Δt is the pressure at time t+Δt; p t is the pressure at time t; dΩ is the area Ω i The volume element inside; Δt is the time step;
[0024] According to the divergence theorem, the left side of equation (4) Rewritten as:
[0025]
[0026] Among them, l ij is the intersection of mesh i and mesh j; n is Ω i In l ij The external normal vector at i is the number of grids adjacent to grid i; dA is l ij The area element on F ij is the grid i in l ij The external normal flow on the surface is estimated using a two-point linear scheme. ij ,Right now:
[0027]
[0028] In the formula, p i is the pressure at the center of grid i; p j is the pressure at the center of grid j; λ t,ij k ra,ij and μ a,ij The single-point upwind format and arithmetic mean format in formula (7) are used respectively;
[0029] As shown in formula (8), T ij Calculated as half of the harmonic mean of the conductivity of grid i and grid j;
[0030]
[0031]
[0032] Among them, λ t,ij is the total flow rate in the flow expression between grid i and grid j; k ra,ij is the relative permeability value of phase a in the flow expression between grid i and grid j; μ a,ij is the relative permeability value of phase a in the flow expression between grid i and grid j; μ a,i is the viscosity value of phase a in grid i; μ a,j is the viscosity value of phase a in grid j; k ra (S a,j ) is based on the grid j phase a saturation value S a,j Calculated relative permeability value of phase a; k ra (S a,i ) is based on the saturation value S of phase i in the grid a,i Calculated relative permeability value of phase a; T ij is the conductivity between grid i and grid j; T i is the conductivity of grid i; T j is the conductivity of grid j; A ij is the intersection area of grid i and grid j; d i The distance from the center of grid i to the intersection of grid i and grid j; d j The distance from the center of grid j to the intersection of grid i and grid j;
[0033] The discretized format of the pressure equation for grid i is obtained:
[0034]
[0035] in, is the pressure at the center of grid i at time t+Δt; is the pressure at the center of grid i at time t; Δt is the time step;
[0036] Integrating the discrete formats of all grid pressure equations, we get the following linear equations for the pressure value of each grid at time t+Vt:
[0037] Tp=b (10)
[0038] Where T is the coefficient matrix of the equations; p is the vector formed by the pressure at the center of each grid; b is the coefficient vector of the equations;
[0039] Among them, the i-th row and j-th column of the coefficient matrix T The i-th row of the coefficient vector b
[0040] Preferably, in step S2, the discrete pressure equation is solved using a variational quantum linear solver to obtain the pressure distribution in the reservoir region, comprising the following steps:
[0041] For the linear system Tp=b, if ||b||2=0, then since T is reversible, the system is trivial and has only zeros;
[0042] If ||b||2≠0, first regularize b, that is, let ||b||2=1, and get the new system of equations In the formula, The variational quantum linear solver then searches for a quantum state |p> such that Collinear with |b>, that is:
[0043]
[0044] In the formula, is from The prepared quantum state;
[0045] The coefficient matrix Decompose into a unitary matrix:
[0046] Let the coefficient matrix The dimension is 2 n ×2 n , that is, the number of grids in the reservoir model is 2 n , then |p> and are all quantum states corresponding to n quantum bits;
[0047] Can be composed of size 2 n ×2 n A set of complete orthogonal bases of the matrix space of , where P l ∈{I,X,Y,Z}, l=1,2,L,n, I is the unit matrix, X, Y, Z are Pauli X-gate, Y-gate and Z-gate respectively;
[0048]
[0049] The matrix In the complete base Decomposing it, we get:
[0050]
[0051] Among them, c m is n The ground state T m The corresponding complex coefficient; m represents the sequence number;
[0052] By calculating the inner product, we get:
[0053]
[0054] Where Tr represents the trace of the matrix;
[0055] For quantum states Preparation, using the unitary matrix U Where |0> is the ground state;
[0056] Next, a quantum circuit V(α) with a variable parameter α is constructed to act on the ground state |0> to obtain the quantum state |p> corresponding to the pressure vector p, that is, equation (15);
[0057] |p>=V(α)|0> (15)
[0058] Obtaining a quantum state |p> that satisfies equation (11) has the following cost function:
[0059]
[0060] Substituting equation (13) and equation (15) into equation (16), we obtain:
[0061]
[0062] In the formula, the subscripts l and l' both represent from 1 to 4 n The superscript * indicates that the conjugate complex number of the corresponding complex number is taken. It means taking the conjugate transpose of the corresponding matrix;
[0063] Replace the projection operator |0><0| in equation (17) with the operator represented by equation (18), and propose another cost function C in equation (19): L ,and
[0064]
[0065] In the formula, Z μ is the Pauli Z gate acting on the μth qubit;
[0066]
[0067] In the formula, when Z0=I,
[0068] When the Hadamard test is used to calculate the When V performs controlled operation;
[0069] Cost function C LAfter the value C is obtained through the Hadamard test, it is passed to the optimizer of the classical calculator, and the accuracy requirement γ is set to make C < γ, then the optimization is stopped and the corresponding parameter α is taken as the optimal parameter α opt ,
[0070] By observing |p>=V(α opt )|0>, calculate the solution p of Tp=b according to formula (20);
[0071]
[0072] Preferably, when the initial pressure value of the reservoir calculation domain is equal everywhere, the pressure to be calculated is subtracted from the initial pressure, so that the elements in the vector b corresponding to the grid without injection and production wells are 0, which reduces the preparation The complexity of the quantum state corresponding to the coefficient vector of the pressure equation.
[0073] Preferably, by adjusting the grid number, the grid where the injection and production wells are located can be arranged in front of the vector b, thereby reducing the preparation The use of controlled NOT gates in the required quantum circuits reduces the preparation The complexity of the quantum state corresponding to the coefficient vector of the pressure equation.
[0074] Therefore, the present invention adopts the above-mentioned method for solving the reservoir numerical simulation pressure equation based on quantum computing, and its technical effects are as follows:
[0075] (1) VQLS solves the pressure equation and its accuracy performance is evaluated;
[0076] (2) Strategies such as adjusting the grid number can help reduce the complexity of preparing quantum states and accelerate the optimization convergence speed, thereby obtaining a more accurate solution with the same number of optimization steps.
[0077] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] Figure 1 This is the workflow diagram of the variational quantum linear solver;
[0079] Figure 2 are the physical property parameters in the examples; wherein, Figure 2 (a) is the initial grid number; Figure 2 (b) is the preparation of the corresponding initial grid number quantum circuits; Figure 2 (c) in the figure is the adjusted grid number; Figure 2 (d) is the grid number after preparation and adjustment. quantum circuits;
[0080] Figure 3 is the parameter-containing quantum circuit V(α) used in the embodiment;
[0081] Figure 4 Comparison of case 1 and case 2 calculation results obtained using Xanadu's Pennylane open source platform; Figure 4 (a) in the figure is the cost function vs. optimization step in case 1; Figure 4 (b) is the comparison between the quantum state probability distribution of |p> in case 1 and the quantum state probability distribution corresponding to the true solution p; Figure 4 (c) in the figure is the cost function vs. optimization step in case 2; Figure 4 (d) in the figure is the comparison between the quantum state probability distribution of |p> in case 2 and the quantum state probability distribution corresponding to the true solution p;
[0082] Figure 5 is the L2 relative error of the pressure change of each grid calculated under different conditions;
[0083] Figure 6 The cost function change curve and probability distribution calculated when Δt = 0.001 days with 1 and 2 ansatz layers respectively are compared; where, Figure 6 (a) is the cost function change curve calculated when there is 1 layer of ansatz; Figure 6 (b) is the probability distribution comparison when there is 1 layer of ansatz; Figure 6 (c) is the cost function change curve calculated when there are 2 layers of ansatz; Figure 6 (d) is the probability distribution comparison of 2-layer ansatz;
[0084] Figure 7 The cost function change curve and probability distribution calculated when Δt = 1 day with 1 and 2 ansatz layers respectively are compared; where, Figure 7 (a) is the cost function change curve calculated when there is 1 layer of ansatz; Figure 7 (b) is the probability distribution comparison when there is 1 layer of ansatz; Figure 7 (c) is the cost function change curve calculated when there are 2 layers of ansatz; Figure 7 (d) in the figure is the probability distribution comparison for 2-layer ansatz. DETAILED DESCRIPTION
[0085] The technical solution of the present invention is further described below through the accompanying drawings and embodiments.
[0086] Unless otherwise defined, technical or scientific terms used in the present invention shall have the common meanings understood by one having ordinary skills in the field to which the present invention belongs.
[0087] Embodiment 1
[0088] like Figure 1 As shown in Figure 1, this is the workflow diagram of the variational quantum linear solver.
[0089] The method for solving the pressure equation of reservoir numerical simulation based on quantum computing includes the following steps:
[0090] S1. Calculate the linearized discrete pressure equation using the finite volume method;
[0091] S2. The discrete pressure equation is solved using a variational quantum linear solver to obtain the pressure distribution in the reservoir area.
[0092] In step S1, the linearized discrete pressure equation is calculated using the finite volume method, including the following steps:
[0093] Calculate the material conservation equation for phase a:
[0094]
[0095] in, is the divergence operator; v a is the seepage velocity of phase a; q a is the source and sink term of phase a; t is time; φ is saturation; S a is the saturation of phase a;
[0096] Let a = o or a = w; o represents the oil phase, w represents the water phase;
[0097] According to Darcy's law, we get:
[0098]
[0099] Among them, λ a , p a , k ra , μ a are the mobility, pressure, relative permeability and viscosity of phase a respectively; k is the permeability tensor;
[0100] Ignoring the capillary force and superimposing the material conservation equations of the oil phase and the water phase, we obtain the pressure equation:
[0101]
[0102] Among them, λ t =λ o +λ w is the total flow, λ o is the oil phase fluidity, λw is the water phase mobility; p = p o =p w is the fluid pressure, p o is the oil phase pressure, p w is the water phase pressure; is the comprehensive compression coefficient; q o is the source and sink term of the oil phase; q w is the source and sink term of the water phase;
[0103] Substituting equation (3) in the control volume Ω of grid i i Integrating over the time interval [t, t+Vt] yields:
[0104]
[0105] is the volume flow rate of the oil phase; is the volume flow rate of the water phase;
[0106] Among them, p t+Δt is the pressure at time t+Δt; p t is the pressure at time t; dΩ is the area Ω i The volume element inside; Δt is the time step;
[0107] According to the divergence theorem, the left side of equation (4) Rewritten as:
[0108]
[0109] Among them, l ij is the intersection of mesh i and mesh j; n is Ω i In l ij The external normal vector at i is the number of grids adjacent to grid i; dA is l ij The area element on F ij is the grid i in l ij The external normal flow on the surface is estimated using a two-point linear scheme. ij ,Right now:
[0110]
[0111] In the formula, p i is the pressure at the center of grid i; p j is the pressure at the center of grid j; λ t,ij k ra,ij and μ a,ij The single-point upwind format and arithmetic mean format in formula (7) are used respectively;
[0112] As shown in formula (8), T ijCalculated as half of the harmonic mean of the conductivity of grid i and grid j;
[0113]
[0114]
[0115] Among them, λ t,ij is the total flow rate in the flow expression between grid i and grid j; k ra,i j is the relative permeability value of phase a in the flow expression between grids i and j; μ a,ij is the relative permeability value of phase a in the flow expression between grid i and grid j; μ a,i is the viscosity value of phase a in grid i; μ a,j is the viscosity value of phase a in grid j; k ra (S a,j ) is based on the grid j phase a saturation value S a,j Calculated relative permeability value of phase a; k ra (S a,i ) is based on the saturation value S of phase i in the grid a,i Calculated relative permeability value of phase a; T ij is the conductivity between grid i and grid j; T i is the conductivity of grid i; T j is the conductivity of grid j; A ij is the intersection area of grid i and grid j; d i The distance from the center of grid i to the intersection of grid i and grid j; d j The distance from the center of grid j to the intersection of grid i and grid j;
[0116] The discretized format of the pressure equation for grid i is obtained:
[0117]
[0118] in, is the pressure at the center of grid i at time t+Δt; is the pressure at the center of grid i at time t; Δt is the time step;
[0119] Integrating the discrete formats of all grid pressure equations, we get the following linear equations for the pressure value of each grid at time t+Vt:
[0120] Tp=b (10)
[0121] Where T is the coefficient matrix of the equations; p is the vector formed by the pressure at the center of each grid; b is the coefficient vector of the equations;
[0122] Among them, the i-th row and j-th column of the coefficient matrix T The i-th row of the coefficient vector b
[0123] In step S2, the discrete pressure equation is solved by using a variational quantum linear solver to obtain the pressure distribution in the reservoir area, including the following steps:
[0124] For the linear system Tp=b, if ||b||2=0, then since T is reversible, the system is trivial and has only zeros;
[0125] If ||b||2≠0, first regularize b, that is, let ||b||2=1, and get the new system of equations In the formula, The variational quantum linear solver then searches for a quantum state |p> such that Collinear with |b>, that is:
[0126]
[0127] In the formula, is from The prepared quantum state;
[0128] The coefficient matrix Decompose into a unitary matrix:
[0129] Let the coefficient matrix The dimension is 2 n ×2 n , that is, the number of grids in the reservoir model is 2 n , then |p> and are all quantum states corresponding to n quantum bits;
[0130] Can be composed of size 2 n ×2 n A set of complete orthogonal bases of the matrix space of , where P l ∈{I,X,Y,Z}, l=1,2,L,n, I is the unit matrix, X, Y, Z are Pauli X-gate, Y-gate and Z-gate respectively;
[0131]
[0132] The matrix In the complete base Decomposing it, we get:
[0133]
[0134] Among them, c m is n The ground state T mThe corresponding complex coefficient; m represents the sequence number;
[0135] By calculating the inner product, we get:
[0136]
[0137] Where Tr represents the trace of the matrix;
[0138] For quantum states Preparation, using the unitary matrix U Where |0> is the ground state;
[0139] In order to facilitate the preparation of the quantum state of vector b, when the initial pressure value of the reservoir calculation domain is equal everywhere, the pressure to be calculated can be subtracted from the initial pressure, so that the elements in vector b corresponding to the grid without injection and production wells (i.e. source and sink terms) are 0. In addition, the grid number can be adjusted so that the grid where the injection and production wells are located can be arranged in front of vector b, thereby reducing the preparation time. The use of controlled NOT gates in the required quantum circuits reduces the preparation difficulty.
[0140] Next, a quantum circuit V(α) with a variable parameter α is constructed to act on the ground state |0> to obtain the quantum state |p> corresponding to the pressure vector p, that is, equation (15);
[0141] |p>=V(α)|0> (15)
[0142] Obtaining a quantum state |p> that satisfies equation (11) has the following cost function:
[0143]
[0144] Substituting equation (13) and equation (15) into equation (16), we obtain:
[0145]
[0146] In the formula, the subscripts l and l' both represent from 1 to 4 n The superscript * indicates that the conjugate complex number of the corresponding complex number is taken. It means taking the conjugate transpose of the corresponding matrix;
[0147] Replace the projection operator |0><0| in equation (17) with the operator represented by equation (18), and propose another cost function C in equation (19): L ,and
[0148]
[0149] In the formula, Z μis the Pauli Z gate acting on the μth qubit;
[0150]
[0151] In the formula, when Z0=I,
[0152] When the Hadamard test is used to calculate the When V performs controlled operation;
[0153] Cost function C L After the value C is obtained through the Hadamard test, it is passed to the optimizer of the classical calculator, and the accuracy requirement γ is set to make C < γ, then the optimization is stopped and the corresponding parameter α is taken as the optimal parameter α opt , we can observe that |p>=V(α opt )|0>, calculate the solution p of Tp=b according to formula (20);
[0154]
[0155] The technical effect of the method proposed in the present invention is illustrated by two specific examples below.
[0156] Example 1
[0157] A simple example of a 2×2 grid is designed to demonstrate the technical details of the present invention through specific calculations. Figure 2 (a) shows a two-dimensional homogeneous reservoir model. For the convenience of demonstration, this embodiment only uses a 2×2 grid, and the size of each grid is 10 m×10 m×10 m. There is a water injection well and a production well in the lower left corner and the upper right corner respectively. The water injection rate is 10 cubic meters / day. The time step Δt=0.001 day is taken to calculate one time step. The liquid production rate is also 10 cubic meters / day. Other physical parameters of the reservoir are shown in Table 1.
[0158] Table 1 Physical parameters in the example
[0159]
[0160] Using the aforementioned finite volume format of the pressure equation, we can obtain the following linear equations for the pressure values of these four grids:
[0161]
[0162] When the initial pressure value is the same, the linear equations in equation (21) can be rewritten as equation (22) by subtracting the initial pressure value from the substitute pressure. It can be seen that the vectors on the right side of equation (22) are all zero except for the first and fourth rows corresponding to grid 1 and grid 4 where the injection and production wells are located, which makes it easier to prepare the quantum state corresponding to the vector on the right side.
[0163]
[0164] After normalization, we get equation (23):
[0165]
[0166] According to formula (13) and formula (14), we can get:
[0167]
[0168] therefore, Can be Figure 2 (b) can be prepared by using the quantum circuit The corresponding unitary matrix U is:
[0169]
[0170] Among them, H is the matrix corresponding to the Hadamard gate in quantum computing.
[0171] Figure 4 (a) and Figure 4 (b) shows the change in the cost function within 80 optimization steps obtained by implementing the calculation using the Pennylane open source platform, as well as the comparison between the quantum state probability distribution of |p> after 80 iterations and the probability distribution corresponding to the true solution p. With the initial pressure, the pressure value obtained by quantum calculation and the true solution are shown in Equations (26) and (27), respectively. It can be seen that the quantum calculation results are very consistent with the true solution.
[0172]
[0173]
[0174] When the number of grids increases, the length of vector b also increases. If the number and location of injection and production wells also change, the quantum state corresponding to the preparation vector b will be The required quantum circuit becomes very complicated. To solve this problem, the order of the equations in the equation group (22) can be adjusted, that is, the grid number can be adjusted so that the equation groups corresponding to the grid where the injection and production wells are located are arranged in sequence from the first row, so as to reduce the use of CNOT gates to reduce the preparation time. For the purpose of difficulty. For the convenience of description, the above situation without adjusting the grid number is called case 1, and the situation after adjusting the grid number is called case 2.
[0175] For example, the grid number after adjustment is Figure 2 As shown in (c), at this time,
[0176]
[0177] at this time,
[0178]
[0179] As you can see, at this time The second qubit in is always |0>, so in case 2, Figure 2 As shown in (d), the first qubit can be prepared by operating only the X gate and the Hadamard gate. The corresponding unitary matrix U is:
[0180]
[0181] Figure 4 (c) and Figure 4 (d) shows the change of the cost function within 80 optimization steps in case 2, and the comparison between the probability distribution of the quantum state of |p> after 80 iterations and the probability distribution corresponding to the true solution p. Equation (26) shows the specific pressure value obtained by calculation. It can be seen that the result of quantum calculation in case 2 is still very consistent with the true solution, and the high-precision pressure value can also be calculated. However, compared with case 1, its cost function decreases significantly faster, and the accuracy obtained after the same 80 iterations is also higher than that of case 1. This is due to the adjustment of the grid order. This is related to the fact that quantum circuits are easier to prepare and have lower complexity, which quantitatively illustrates the importance of the grid number adjustment strategy.
[0182]
[0183] Example 2
[0184] Example 2: The homogeneous permeability in Example 1 is changed to heterogeneous permeability, that is, the permeabilities of the grids are set to 5mD, 10mD, 10mD and 15mD respectively, and other physical parameters and production systems remain unchanged. Using the above grid renumbering strategy, the number of Hadamard test samples is set to 1×10 7, in this example, different time steps Δt = 0.001 day, 0.01 day, 0.1 and 1 day are used, and one time step is calculated. According to formula (13), the coefficient matrix of the corresponding linear equation system is decomposed into 7 Pauli bases in Table 2. Therefore, the number of Pauli bases decomposed in the inhomogeneous case is significantly more than that in the homogeneous case. When different time steps are used, only the coefficients of the I1I2 basis change, and the other coefficients do not change. Calculations are performed using 1 layer ansatz and 2 layers ansatz respectively. Table 3 shows in detail the probability distribution, corresponding pressure distribution and classical solution calculated by VQLS under different time steps and different ansatz layers.
[0185] Figure 5 The L2 relative error of the pressure change of each grid calculated under different conditions in Table 3 was calculated (it should be pointed out that it is not the L2 relative error of the pressure distribution. This is because the absolute value of the pressure distribution will significantly reduce the relative error value, so it is more reasonable to compare the relative error of the pressure increment value).
[0186] Figure 6 and Figure 7 The changes in the cost function within 200 optimization steps calculated using 1-layer ansatz and 2-layer ansatz based on Xanadu's Pennylane open source platform when Δt=0.01 day and Δt=0.1 day are shown respectively, and the probability distribution corresponding to the obtained |p> is compared with the probability distribution corresponding to the true solution p.
[0187] (1) Except for Δt = 0.001 days, the calculation error of the two-layer ansatz is similar to that of the one-layer ansatz. As Δt increases, the calculation accuracy of the two-layer ansatz is significantly higher than that of the one-layer ansatz, and the relative error of the two-layer ansatz is very obvious. Figure 7 (a) It can also be seen that it failed to converge at Δt = 1 day, and the error function value remained at around 0.25 during the optimization process. Compared with the first embodiment, it is explained that with the increase of heterogeneity, not only the number of bubble niche terms after decomposition increases, but also more layers of ansatz are required to make VQLS converge and obtain sufficiently high accuracy.
[0188] (2) When the number of ansatz layers is fixed, the smaller the time step Δt is, the higher the calculation accuracy of VQLS is and the easier it is to converge. As mentioned above, from the number of Pauli terms and corresponding coefficients obtained under different Δt conditions shown in Table 2, it can be seen that different time steps do not change the number and type of Pauli, but only change the coefficients of Pauli I1I2. The larger the coefficient, the more dominant the main diagonal elements of the corresponding linear equations are. Therefore, the different analysis time steps affect the structural properties of the coefficient matrix of the linear equations, thereby affecting the convergence and calculation accuracy of VQLS.
[0189] Table 2 Decomposition of the coefficient matrix T of the equation system corresponding to different time steps on the Pauli basis
[0190] <![CDATA[I1I2]]> <![CDATA[X1I2]]> <![CDATA[X1X2]]> <![CDATA[Y1Y2]]> <![CDATA[I1Z2]]> <![CDATA[X1Z2]]> <![CDATA[Z1Z2]]> 0.001 days 36.1280 -8.0640 -8.0640 -2.3040 -2.3040 2.3040 -2.3040 0.01 day 18.1280 -8.0640 -8.0640 -2.3040 -2.3040 2.3040 -2.3040 0.1 day 16.3280 -8.0640 -8.0640 -2.3040 -2.3040 2.3040 -2.3040 1 day 16.1480 -8.0640 -8.0640 -2.3040 -2.3040 2.3040 -2.3040
[0191] Table 3 Probability distribution, corresponding pressure distribution and classical solution calculated by VQLS under different conditions
[0192]
[0193] Therefore, the present invention adopts the above-mentioned method for solving the reservoir numerical simulation pressure equation based on quantum computing to obtain high-precision reservoir pressure distribution, and the practical strategy provided can accelerate the convergence speed in the optimization process, thereby obtaining a more accurate pressure solution under the same number of optimization steps.
[0194] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.
Claims
1. A method for solving the pressure equation of oil reservoir numerical simulation based on quantum computing, characterized in that: The following steps are involved: S1. Calculate the linearized discrete pressure equation using the finite volume method, including: Calculate the material conservation equation for phase a: Among them, ▽ is the divergence operator; v a is the seepage velocity of phase a; q a is the source and sink term of phase a; t is time; φ is saturation; S a is the saturation of phase a; Let a = o or a = w; o represents the oil phase, w represents the water phase; According to Darcy's law, we get: Among them, λ a , p a , k ra , μ a are the mobility, pressure, relative permeability and viscosity of phase a respectively; k is the permeability tensor; Ignoring the capillary force and superimposing the material conservation equations of the oil phase and the water phase, we obtain the pressure equation: Among them, λ t =λ o +λ w is the total flow, λ o is the oil phase fluidity, λ w is the water phase mobility; p = p o =p w is the fluid pressure, p o is the oil phase pressure, p w is the water phase pressure; is the comprehensive compression coefficient; q o is the source and sink term of the oil phase; q w is the source and sink term of the water phase; Substituting equation (3) in the control volume Ω of grid i i Integrating over the time interval [t, t+Vt] yields: is the volume flow rate of the oil phase; is the volume flow rate of the water phase; Among them, p t+Δt is the pressure at time t+Δt; p t is the pressure at time t; dΩ is the area Ω i The volume element inside; Δt is the time step; According to the divergence theorem, the left side of equation (4) Rewritten as: Among them, l ij is the intersection of mesh i and mesh j; n is Ω i In l ij The external normal vector at i is the number of grids adjacent to grid i; dA is l ij The area of the infinitesimal element on the ij is the grid i in l ij The external normal flow on the surface is estimated using a two-point linear scheme. ij ,Right now: In the formula, p i is the pressure at the center of grid i; p j is the pressure at the center of grid j; λ t,ij k ra,ij and μ a,ij The single-point upwind format and arithmetic mean format in formula (7) are used respectively; As shown in formula (8), T ij Calculated as half of the harmonic mean of the conductivity of grid i and grid j; Among them, λ t,ij is the total flow rate in the flow expression between grid i and grid j; k ra,ij is the relative permeability value of phase a in the flow expression between grid i and grid j; μ a,ij is the relative permeability value of phase a in the flow expression between grid i and grid j; μ a,i is the viscosity value of phase a in grid i; μ a,j is the viscosity value of phase a in grid j; k ra (S a,j ) is based on the grid j phase a saturation value S a,j Calculated relative permeability value of phase a; k ra (S a,i ) is based on the saturation value S of phase i in the grid a,i Calculated relative permeability value of phase a; T ij is the conductivity between grid i and grid j; T i is the conductivity of grid i; T j is the conductivity of grid j; A ij is the intersection area of grid i and grid j; d i The distance from the center of grid i to the intersection of grid i and grid j; d j The distance from the center of grid j to the intersection of grid i and grid j; The discretized format of the pressure equation for grid i is obtained: in, is the pressure at the center of grid i at time t+Δt; is the pressure at the center of grid i at time t; Δt is the time step; Integrating the discrete formats of all grid pressure equations, we get the following linear equations for the pressure value of each grid at time t+Vt: Tp=b (10) Where T is the coefficient matrix of the equations; p is the vector formed by the pressure at the center of each grid; b is the coefficient vector of the equations; Among them, the i-th row and j-th column of the coefficient matrix T The i-th row of the coefficient vector b S2. Use the variational quantum linear solver to solve the discrete pressure equation and obtain the pressure distribution in the reservoir area, including: For the linear system Tp=b, if ||b||2=0, then since T is reversible, the system is trivial and has only zeros; If ||b||2≠0, first regularize b, that is, let ||b||2=1, and get the new system of equations In the formula, The variational quantum linear solver then searches for a quantum state |p> such that Collinear with |b>, that is, In the formula, is from The prepared quantum state; The coefficient matrix Decompose into a unitary matrix: Let the coefficient matrix The dimension is 2 n ×2 n , that is, the number of grids in the reservoir model is 2 n , then |p> and are all quantum states corresponding to n quantum bits; Can be composed of size 2 n ×2 n A set of complete orthogonal bases of the matrix space of , where P l ∈{I,X,Y,Z}, l=1,2,L,n, I is the unit matrix, X, Y, Z are Pauli X-gate, Y-gate and Z-gate respectively; The matrix In the complete base Decomposing it, we get: Among them, c m is n The ground state T m The corresponding complex coefficient; m represents the sequence number; By calculating the inner product, we get: Where Tr represents the trace of the matrix; For quantum states Preparation, using the unitary matrix U Where |0> is the ground state; Next, a quantum circuit V(α) with a variable parameter α is constructed to act on the ground state |0> to obtain the quantum state |p> corresponding to the pressure vector p, that is, equation (15); |p>=V(α)|0> (15) Obtaining a quantum state |p> that satisfies equation (11) has the following cost function: Substituting equation (13) and equation (15) into equation (16), we obtain: In the formula, the subscripts l and l' both represent from 1 to 4 n The superscript * indicates that the conjugate complex number of the corresponding complex number is taken. It means taking the conjugate transpose of the corresponding matrix; Replace the projection operator |0><0| in equation (17) with the operator represented by equation (18), and propose another cost function C in equation (19): L ,and In the formula, Z μ is the Pauli Z gate acting on the μth qubit; In the formula, when Z0=I, When the Hadamard test is used to calculate the When V performs controlled operation; Cost function C L After the value C is obtained through the Hadamard test, it is passed to the optimizer of the classical calculator, and the accuracy requirement γ is set to make C < γ, then the optimization is stopped and the corresponding parameter α is taken as the optimal parameter α opt , we can observe that |p>=V(α opt )|0>, calculate the solution p of Tp=b according to formula (20);
Citation Information
Patent Citations
Flow unit numerical simulation method based on multi-scale mixed finite elements
CN110263434A
Oil reservoir numerical simulation equivalent wellbore radius calculation method
CN111339702A
Oil reservoir numerical simulation method based on meshless connecting element
CN113836695A
Complex fracture network oil reservoir flow simulation method
CN113919247A
Rapid simulation and optimization method suitable for low-permeability fractured reservoir
CN117077577A
