Automatic control method for simulating carbon dioxide corrosion reaction of oil and gas reservoir
By establishing mathematical models and writing custom scripts in numerical simulation software, automated control of carbon dioxide dissolution reactions in oil and gas reservoirs is solved, and the problem of difficulty and cost of adding new seepage mechanisms is reduced.
Patent Information
- Application Number
- CN202311701721.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-12
- Publication Date
- 2025-06-13
AI Technical Summary
The existing technology is difficult to accurately predict the impact of carbon dioxide dissolution reaction on permeability in oil and gas reservoirs in numerical simulation software, and the software source code needs to be modified when adding a new seepage mechanism model, which has problems with technical thresholds and huge costs.
By establishing a mathematical model that implements the penetration mechanism, writing a custom script, pausing the initialization of the numerical simulation, executing custom code, calculating intermediate variables and outputting them to the numerical simulation software, automatic control of carbon dioxide dissolution reaction is achieved.
The source code of the numerical simulation software is not required, which reduces the difficulty and cost of implementing the new seepage mechanism model and improves the efficiency of adding a new seepage mechanism to the numerical simulation software.
Smart Images

Figure CN120148667A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of oil exploitation, and particularly to an automatic control method for simulating the carbon dioxide dissolution reaction in oil and gas reservoirs. Background Art
[0002] During the implementation of CCUS, carbon dioxide injected into the formation will chemically react with the reservoir rock. On the one hand, carbon dioxide will dissolve the rock minerals, resulting in an increase in rock permeability. On the other hand, as the pressure in the near-wellbore zone decreases, carbon dioxide escapes, causing the rock minerals originally dissolved in the formation water to precipitate and block the pores.
[0003] In the commercially available numerical simulation software for oil and gas reservoirs commonly used in the prior art, these new seepage models are often not included, so accurate predictions of oil and gas reservoir production cannot be made based on the models.
[0004] Currently, there are mainly two ways to implement the above seepage model in numerical simulation: One is to establish a simple dissolution relationship between parameters such as CO2 concentration / injection pressure / contact time and rock porosity / permeability, and establish a simple mechanism model. The advantage of this method is its simplicity in implementation, and the disadvantage is its low accuracy. The other is to build a completely new numerical simulation software containing new mechanisms from scratch, or modify the open-source code based on open-source numerical simulation software such as OPM and add new models. The advantage of this method is its high accuracy, and the disadvantage is that the software engineering is huge, the time and economic costs are extremely high, and it has a very high technical threshold. Both of the above methods require modifying the simulator kernel code, which poses great difficulties in actual operation. Summary of the Invention
[0005] In view of the above problems, the present invention is proposed to provide an automatic control method for simulating the carbon dioxide dissolution reaction in oil and gas reservoirs that overcomes the above problems or at least partially solves the above problems.
[0006] According to one aspect of the present invention, there is provided an automatic control method for simulating the carbon dioxide dissolution reaction in oil and gas reservoirs, the control method comprising:
[0007] Step S1: Establish a mathematical model for realizing the seepage mechanism;
[0008] Step S2: Write a custom script according to the mathematical model;
[0009] Step S3: After the numerical simulation is initialized, pause and execute the custom code;
[0010] Step S4: Calculate intermediate variables and output them to the numerical simulation software;
[0011] Step S5: Start the numerical simulation of the next time step;
[0012] Step S6: Repeat steps S1 - S5 until the simulation ends.
[0013] Optionally, step S1: Establishing a mathematical model for realizing the penetration mechanism specifically includes:
[0014] Establish a functional relationship between the geological model property y and the simulation intermediate variable x in the reservoir, y = f(x).
[0015] Optionally, the geological model property is porosity φ and permeability k.
[0016] Optionally, the intermediate variables include pressure, saturation, and time.
[0017] Optionally, the functional relationship is obtained through an experimental method to determine the parameter values in the function relationship f in step S1. The fitting parameters in the experimental method are the first fitting parameter A and the second fitting parameter B.
[0018] Optionally, step S2: Writing a custom script according to the mathematical model specifically includes:
[0019] Obtain the effective grid number of the numerical simulation model through the GRIDALLOCSIZE function. The specific script code is: GRIDNUM = SIM.GRIDALLOCSIZE(parameter);
[0020] Obtain the pressure at the initial moment through the GETMYARRAY function. The specific script code is:
[0021] P 0 = SIM.GETMYARRY("P 0 ")
[0022] Obtain the pressure at the current moment through the GETMYARRAY function. The specific script code is:
[0023] POIL = SIM.GETARRAY("POIL")
[0024] Use a loop to obtain the permeabilities in three directions through the GETARRY function. The specific script code is:
[0025] PERMX = SIM.GETARRAY(“PERMX”, GRIDNUM)
[0026] PERMY = SIM.GETARRAY(“PERMY”, GRIDNUM)
[0027] PERMZ = SIM.GETARRAY(“PERMZ”, GRIDNUM)
[0028] Assign values to the first fitting parameter A and the second fitting parameter B;
[0029] Use a loop to traverse each grid, substitute the simulation result P of each grid into the quantitative relationship between the permeability k and the pressure simulation result P, calculate the updated permeability multiplier for each grid, and re-enter it back into the numerical simulation software.
[0030] Optionally, step S3: After the numerical simulation is initialized, pause and execute the custom code specifically includes:
[0031] Run the numerical simulation software, pause at the first time step, and execute the custom script code in step B;
[0032] Extract the intermediate variables of the numerical simulation software according to the content of the script code.
[0033] Optionally, the intermediate variables include the number of effective grids, the pressure at the initial moment, the pressure at the current moment, and the permeability multipliers in three directions.
[0034] Optionally, step S4: Calculate the intermediate variables and output them to the numerical simulation software specifically includes:
[0035] Calculate the intermediate variables according to the seepage mathematical model to obtain the calculation results;
[0036] Input the calculation results back into the numerical simulation software.
[0037] Optionally, step S6: Repeat steps S1 - S5 until the simulation ends specifically includes:
[0038] Set the minimum time interval Δt c , determine whether the time interval between the current time and the time of the last property update satisfies Δt > Δt c , if not, continue to run the next step of the numerical simulation, if so, repeat steps B to E until the simulation ends.
[0039] An automatic control method for simulating the carbon dioxide corrosion reaction in an oil and gas reservoir provided by the present invention, the control method includes: step S1: Establish a mathematical model for realizing the seepage mechanism; step S2: Write a custom script according to the mathematical model; step S3: After the numerical simulation is initialized, pause and execute the custom code; step S4: Calculate the intermediate variables and output them to the numerical simulation software; step S5: Start the numerical simulation of the next time step; step S6: Repeat steps S1 - S5 until the simulation ends. The method for quickly realizing the seepage mechanism by the custom script of the oil and gas reservoir numerical simulation does not require modifying the source code of the numerical simulation software when adding a new seepage mechanism, reduces the difficulty of implementing the new seepage mechanism model, and improves the efficiency of adding a new seepage mechanism in the numerical simulation software.
[0040] The above description is only an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the content of the specification. And in order to make the above and other objects, features and advantages of the present invention more obvious and understandable, the specific embodiments of the present invention are hereinafter specifically exemplified. Brief Description of the Drawings
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0042] Figure 1 It is a flowchart of an automatic control method for simulating the carbon dioxide dissolution reaction in an oil and gas reservoir provided by an embodiment of the present invention;
[0043] Figure 2 It is a schematic diagram of a numerical model provided by an embodiment of the present invention;
[0044] Figure 3 It is an example of a custom LUA script code in an embodiment of the present invention;
[0045] Figure 4 It is the numerical simulation initialization (0 days), pause and execute custom code provided by an embodiment of the present invention;
[0046] Figure 5 It is a schematic diagram of permeability update and re - running calculation provided by an embodiment of the present invention;
[0047] Figure 6 It is a schematic diagram of repeatedly executing the permeability update step to simulate the change in permeability caused by dissolution provided by an embodiment of the present invention;
[0048] Figure 7 It is a schematic diagram of whether to consider the influence of dissolution effect on the bottom - hole pressure of PRO - 81H provided by an embodiment of the present invention;
[0049] Figure 8 It is a schematic diagram of whether to consider the influence of dissolution effect on the gas production of PRO - 81H provided by an embodiment of the present invention;
[0050] Figure 9 It is a schematic diagram of the oil saturation distribution at 18,000 days provided by an embodiment of the present invention;
[0051] Figure 10 It is a schematic diagram of whether to consider the influence of dissolution effect on the oil production of PRO - 81H provided by an embodiment of the present invention. Detailed Embodiments
[0052] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be fully conveyed to those skilled in the art.
[0053] The terms "including" and "having" and any variations thereof in the description, claims, and drawings of the present invention are intended to cover non-exclusive inclusion. For example, including a series of steps or units.
[0054] The technical solution of the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments.
[0055] The present invention provides a method for quickly realizing seepage mechanisms with a custom script for numerical simulation of oil and gas reservoirs. The content of the present invention will be described below by taking a model in which compaction occurs with pressure changes and the rock permeability decreases as an example of a custom script.
[0056] The present invention is implemented as follows ( Figure 1 ):
[0057] A. Establish a mathematical model
[0058] According to academic research results, establish a mathematical model for a seepage mechanism not implemented in the simulation software. The specific process is as follows:
[0059] (1) Establish the functional relationship between a certain geological model property y and the simulation intermediate variable x in the reservoir, that is, y = f(x). The geological model property can be porosity φ, permeability k, etc., and the intermediate variables mainly include pressure, saturation, and time, etc. The functional relationship is generally obtained through experiments or experience, etc.;
[0060] (2) Determine the parameter values in the function relationship f in step 1. In this example, they are the experimental fitting parameters A and B.
[0061] B. Write a custom script according to the constructed mathematical model
[0062] Figure 3 It is the LUA script for the mechanism model. The meanings of each line of the custom script are as follows:
[0063] (1) Obtain the effective grid number of the numerical simulation model through the GRIDALLOCSIZE function. The specific script code is:
[0064] GRIDNUM = SIM.GRIDALLOCSIZE()
[0065] (2) Obtain the pressure at the initial moment through the GETMYARRAY function. The specific script code is as follows:
[0066] P 0 = SIM.GETMYARRY("P 0 ")
[0067] (3) Obtain the pressure at the current moment through the GETMYARRAY function. The specific script code is as follows:
[0068] POIL = SIM.GETARRAY("POIL")
[0069] (4) Use a loop to obtain the permeabilities in three directions through the GETARRY function. The specific script code is as follows:
[0070] PERMX = SIM.GETARRAY(“PERMX”,GRIDNUM)
[0071] PERMY = SIM.GETARRAY(“PERMY”,GRIDNUM)
[0072] PERMZ = SIM.GETARRAY(“PERMZ”,GRIDNUM)
[0073] (5) Assign values to the experimental fitting parameters A and B;
[0074] (6) Use a loop to traverse each grid, substitute the simulation result P of each grid into the quantitative relationship between the permeability k and the simulation result P of the pressure change, calculate the updated permeability multiplier for each grid, and re-enter it into the numerical simulation software.
[0075] C. After the numerical simulation is initialized, pause and execute the custom code
[0076] Run the numerical simulation software, pause at the first time step, and execute the custom script code in step B. Extract the intermediate variables of the numerical simulation software according to the script code content. The intermediate variables include the number of effective grids, the pressure at the initial moment, the pressure at the current moment, and the permeability multipliers in three directions.
[0077] D. Calculate the intermediate variables and output them to the numerical simulation software
[0078] Calculate the intermediate variables according to the seepage mathematical model and output the calculation results back to the numerical simulation software. In this example, use the relationship established in step A1, modify the permeability multiplier, and re-enter it into the numerical simulation software.
[0079] E. Start the numerical simulation of the next time step
[0080] F. Repeat the above steps
[0081] Set the minimum time interval Δt c , and determine whether the time interval between the current time and the time when the attributes were last updated satisfies Δt > Δt c . If not, continue to run the next numerical simulation step. If so, repeat steps B to E until the simulation ends.
[0082] When carbon dioxide is injected into the formation, it will chemically react with the reservoir rock. On the one hand, carbon dioxide will dissolve the rock minerals, resulting in an increase in rock permeability. On the other hand, as the pressure in the near-wellbore zone drops, carbon dioxide escapes, causing the rock minerals originally dissolved in the formation water to precipitate and block the pores. Assume that due to the dissolution effect, the functional relationship between the rock permeability evolving with pressure, saturation, and time is:
[0083]
[0084] where k 0 is the permeability at the previous moment, S g is the current gas saturation, S g0 is the initial gas saturation, P is the pressure at the current moment, P 0 is the initial pressure, Δt is the time step interval, and A and B are experimental fitting parameters.
[0085] According to the model, when the carbon dioxide concentration is high, the reservoir pressure is high, and the reaction time is long, the dissolution effect is obvious and the permeability increase is large. In this example, from laboratory research and numerical simulation research, the fitting parameter A is 0.03703 and B is 0.2737.
[0086] Run the numerical simulation software, pause at the first time step, and execute the custom script code in step B. Extract the numerical simulation software simulation intermediate variables according to the Figure 3 script code content. In this example, the obtained simulation intermediate variables include the effective number of grids, the pressure at the initial moment, the pressure at the current moment, and the permeability multipliers in three directions ( Figure 4 ). Transmit the recalculated updated permeability field to the numerical simulation software and continue to run the numerical simulation ( Figure 5 ). Until the numerical simulation runs to completion.
[0087] Figure 6 Shows the phenomenon that as carbon dioxide is injected into the formation, the rock reacts with carbon dioxide, resulting in an increase in permeability. As can be seen from the figure, the pressure near the injection well is relatively high, and the relatively high carbon dioxide concentration causes a strong dissolution effect, and the reservoir permeability increases significantly. As the development progresses, a high-permeability area gradually forms between the injection well and the production well. The production well initially produces at a fixed liquid production rate of 2000 stb / Day. Due to the formation of the high-permeability zone and considering the dissolution effect, the pressure difference required for the bottom hole pressure to produce the same amount of oil is smaller, and the bottom hole flowing pressure of the production well is relatively high (Figure 7 As shown. When considering the dissolution effect, the injected carbon dioxide is more likely to enter the production well along the high-permeability zone, resulting in a relatively high gas production rate in the production well ( Figure 8 ), and the final swept area of carbon dioxide is relatively small ( Figure 9 ), and the oil displacement effect of carbon dioxide becomes poor ( Figure 10 ).
[0088] Beneficial effects: In the embodiments of the present invention, according to academic research results, a mathematical model of the CO2 dissolution reaction in the CCUS process that cannot be achieved in the numerical simulation software is established; a custom script is written in LUA language according to the constructed mathematical model; the numerical simulation software is run and paused after the end of the first time step, and the custom script is executed. According to the content of the script, the intermediate variables in the numerical simulation software are extracted by using the intermediate variable reading module of the numerical simulation software; based on the custom script operation module, the intermediate variables are calculated according to the seepage mathematical model, and the calculation results are input back into the numerical simulation software through the custom script and the numerical simulation software interaction module. The numerical simulation of the next time step is carried out. The above steps are repeated until the simulation ends. The method for quickly realizing the seepage mechanism by the custom script of the reservoir numerical simulation in the present invention does not require modification of the source code of the numerical simulation software when adding a new seepage mechanism, greatly reducing the difficulty of implementing the new seepage mechanism model and improving the efficiency of adding a new seepage mechanism in the numerical simulation software.
[0089] The above specific embodiments further elaborate on the purpose, technical solutions, and beneficial effects of the present invention. It should be understood that the above are only specific embodiments of the present invention and are not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included in the protection scope of the present invention.
Claims
1. An automated control method for simulating the carbon dioxide corrosion reaction in an oil and gas reservoir, characterized in that, the control method includes: Step S1: Establish a mathematical model for realizing the penetration mechanism; Step S2: Write a custom script according to the mathematical model; Step S3: After the numerical simulation is initialized, pause and execute the custom code; Step S4: Calculate the intermediate variables and output them to the numerical simulation software; Step S5: Start the numerical simulation of the next time step; Step S6: Repeat Steps S1 - S5 until the simulation ends.
2. The automated control method for simulating the carbon dioxide corrosion reaction in an oil and gas reservoir according to claim 1, characterized in that, the Step S1: Establishing a mathematical model for realizing the penetration mechanism specifically includes: Establish a functional relationship between the geological model property y and the simulation intermediate variable x in the reservoir, y = f(x).
3. The automated control method for simulating the carbon dioxide corrosion reaction in an oil and gas reservoir according to claim 2, characterized in that, the geological model property is porosity φ and permeability k.
4. The automated control method for simulating the carbon dioxide corrosion reaction in an oil and gas reservoir according to claim 2, characterized in that, the intermediate variables include pressure, saturation, and time.
5. The automated control method for simulating the carbon dioxide corrosion reaction in an oil and gas reservoir according to claim 2, characterized in that, the functional relationship is obtained through an experimental method, and the parameter values in the function relationship f in Step S1 are determined. The fitting parameters in the experimental method are the first fitting parameter A and the second fitting parameter B.
6. The automated control method for simulating the carbon dioxide corrosion reaction in an oil and gas reservoir according to claim 1, characterized in that, the Step S2: Writing a custom script according to the mathematical model specifically includes: Obtain the effective grid number of the numerical simulation model through the GRIDALLOCSIZE function, and the specific script code is: GRIDNUM = SIM.GRIDALLOCSIZE(parameter); Obtain the pressure at the initial moment through the GETMYARRAY function, and the specific script code is: P 0 = SIM.GETMYARRY(″P 0 ″) Obtain the pressure at the current moment through the GETMYARRAY function, and the specific script code is: POIL = SIM.GETARRAY(″POIL″) Use a loop to obtain the permeabilities in three directions through the GETARRY function, and the specific script code is: PERMX = SIM.GETARRAY("PERMX”,GRIDNUM) PERMY = SIM.GETARRAY("PERMY”,GRIDNUM) PERMZ = SIM.GETARRAY("PERMZ”,GRIDNUM) Assign values to the first fitting parameter A and the second fitting parameter B; Use a loop to traverse each grid, substitute the simulation result P of each grid into the quantitative relationship between the permeability k and the pressure simulation result P, calculate the updated permeability multiplier for each grid, and re - input it back into the numerical simulation software.
7. The automated control method for simulating the carbon dioxide corrosion reaction in an oil and gas reservoir according to claim 1, characterized in that, The step S3: After the numerical simulation initialization is completed, pause and execute the custom code, specifically including: Run the numerical simulation software, pause at the first time step, and execute the custom script code in step B; Extract the intermediate variables of the numerical simulation software according to the content of the script code.
8. An automated control method for simulating the carbon dioxide dissolution reaction in an oil and gas reservoir according to claim 7, characterized in that the intermediate variables include the number of effective grids, the pressure at the initial moment, the pressure at the current moment, and the permeability multipliers in three directions.
9. An automated control method for simulating the carbon dioxide dissolution reaction in an oil and gas reservoir according to claim 1, characterized in that the step S4: Calculate the intermediate variables and output them to the numerical simulation software, specifically including: Calculate the intermediate variables according to the seepage mathematical model to obtain the calculation results; Input the calculation results back into the numerical simulation software.
10. An automated control method for simulating the carbon dioxide dissolution reaction in an oil and gas reservoir according to claim 1, characterized in that the step S6: Repeat steps S1 - S5 until the simulation ends, specifically including: Set the minimum time interval Δt c , and determine whether the time interval between the current time and the time when the attributes were last updated satisfies Δt > Δt c , if not, continue to run the next numerical simulation, if yes, repeat steps B to E until the simulation ends.