# Oil industry for engineers, programmers, mathematicians and the masses of workers, part 1

Want to know how and where oil is produced, and why do we need mathematicians, engineers and programmers for this? This is the first part of a series of articles that is a very quick overview introduction to the subject area for future mathematicians and programmers who have to solve problems associated with modeling oil production and developing engineering software in the field of oil production support. In order to understand everything that is written here, no special knowledge is required: only common sense and the school “arsenal” of mathematics and physics are enough. But work in this area, unlike some kind of workflow, takes place at the junction of mathematical, natural-scientific and technical disciplines and is full of interesting cross-disciplinary tasks.

#### Introduction

You can’t just get and extract oil: you need to have some kind of tactic from the very beginning, and you should adhere to it, because regulatory organizations strictly monitor this. For any operation during oil production, it is necessary to have a prepared plan, and for any complex engineering operation, it is necessary to have a model that predicts in advance what result you will get.

If someone thought that the oil under the ground is in large voids, tanks, like buried Aframax class tankers, into which it is enough to get into the pipe and pump it to the drain, then I have a surprise for you: it is tight with voids under the ground.

Oil is located in porous rock at depths from 2 to 3 kilometers. It is easiest to imagine such a rock in the form of a sponge, although in fact it looks like very strongly compressed sand (good, highly permeable rocks can be compared to ordinary red bricks, and low-permeable rocks that we most often deal with in Russia can be compared to dense concrete ), in which grains can be seen with the naked eye, and can only be seen under a microscope. The rock itself is most often sedimentary, that is, once it was the surface of the earth, the bottom of a river or ocean, and everything was besieged on it: somewhere there were blockages of large gravel, somewhere dunes of fine sand, and somewhere – the hills of the most small particles when sticking together to form clay.

Oil does not impregnate the particles themselves, of course, but the pores between them. If you start to extract oil from some place, it will begin to flow from all sides, filtered through the pores of the rock. Having drilled a well, that is, a hole in the ground with walls fixed from the collapse, and after reaching the oil-saturated rock, lowering the pipe with the pump, you can start pumping oil to the surface and process it into “tasty” gasoline, healthy plastic and the national welfare fund. It would seem, what could be the problem or the problem here? But there are really a lot of problems.

First, you need to know where to look. Oil is buried underground, to put it mildly, not everywhere, and it needs to be discovered. Geological prospectors, knowing the general principles of the formation of oil fields and the geological and paleohistorical history of different regions, can tell in advance where it makes sense to look and where not. Then, in promising regions, seismic surveys are carried out, sending acoustic waves deep into the earth and catching their reflection from various layers at great depths. The resulting three-dimensional picture (seismic model) allows us to find suspicious “traps” areas where oil could theoretically accumulate if it were there. But to find out if it is there really is possible only by drilling a well into such a “trap”. Perhaps there will be a rock there without grains and voids at all, perhaps the grains and voids between them will be filled with water, and perhaps – and then some will receive a bonus – the voids between the grains will be filled with oil and gas. Of course, this entire search process already represents a difficult engineering task that requires the use of software developed by mathematicians and programmers: seismic data must be processed, three-dimensional seismic models of the distribution of rock layers underground must be built, displayed and analyzed.

By the way, last year one of the largest hackathons, the Rosneft Seismic Challenge, was held, where participants analyzed seismic data using machine learning methods.

Secondly, you need to know where to drill. Seismic exploration gives a very approximate picture of what is underground (the seismic resolution is limited by the length of the acoustic waves and equal to 20-60 m.), But as we drill exploration, and then production and all other wells, we get more and more information about the rock layers in which the deposit lies. The problem is that this information is very scarce. Take a large voodoo doll and pierce it in several places with needles – you will receive information about the internal structure of the doll only in some places (where it is pierced with needles), but your knowledge and assumptions about what materials voodoo dolls usually make will allow you to with a certain degree of confidence to judge how the doll is arranged between the needles. The field is also “pierced” by wells only in some places (usually the wells are located no closer than 500 m from each other, and we know the properties of the formation within a radius of 0.5-1 m from the well), but knowledge of geology allows us to make assumptions about what happens with the rock between the wells. These assumptions, using the knowledge of geologists, mathematical models and software in which they are implemented, should turn into a three-dimensional geological model of the field and give predictions about where the next well is and where it is not worth drilling. These predictions will be confirmed or refuted by subsequent drilling, which, in turn, will provide new information for updating the geological model, and so on.

Thirdly, having discovered an oil deposit, one must be able to correctly extract “all” (in reality, it is usually possible to extract no more than 30–40% of oil from conventional fields, and for shale deposits, the technological limit is 3–7%) of the discovered oil. Each well gives a certain amount of oil per day (oil companies call it the rate, not to be confused with the “debit” of financiers), and the more wells we drill, the more and faster we can pump oil out of the field – but only to a certain limit. Drilling a well is a very expensive operation, and any plan for drilling a field will lead to the fact that we will simultaneously spend money on drilling wells and receive returns from the sale of produced oil, and different development plans for the field will give different results for the funds spent and received, and, more importantly, the different total volume of oil produced. Yes, it may seem strange, but it’s just for a Coca-Cola bottle it doesn’t matter how fast you drink from it – the total volume will be the same. The share of oil produced from the total volume of oil in the field, the oil recovery coefficient (CIN) will be very different with different methods and strategies of production. With certain production methods, part of the oil will simply remain in the reservoir in places where it can no longer be pulled out. Therefore, in accordance with the set goal (faster, but less – or slower, but more) it will be necessary to build an optimal economic model of production. The quieter you go, the further you’ll get.

Fourth, the problem is that with the barbaric method of oil extraction described above, only a small part of the entire oil of the field can be extracted (get a very low oil recovery factor of 3-5%). Oil underground is under pressure, but as soon as we start to extract it from there, the pressure drops, the pumps produce less and less, and finally, production simply stops because oil stops flowing to the production site from all sides. A paradoxical situation is that there is still oil, but it is no longer flowing and it is impossible to produce it. In order to avoid such an unpleasant situation, other injection wells are drilled through which water is pumped into the field and, thus, the formation pressure inside the rock is maintained. Of course, this water, together with the water that was present in the field from the very beginning, begins to be filtered through the rock along with the oil, and together with the oil it gets into producing wells, which instead of “tasty” black fatty oil begin to produce “on mountain ”dirty smelly water that no one needs. I think you have already guessed that the result depends on where to drill such injection wells and when and at what speed to pump water through them: how much oil can be extracted from the field. Therefore, in the process of field development, the so-called hydrodynamic models are built and maintained in the current state, which predict that at what speed and where it will flow, it is filtered if production and injection wells are drilled in the right places and turned on in a certain mode.

Fifth, little oil to get. It is necessary to separate it from the water and associated gas on the surface, clean and reuse the water, try to drive the gas into the gas pipeline or use it right in the field with benefit, and also clean the oil and put it into the oil pipeline. For this, all this superficial arrangement should also be ready. There is no point in extracting oil at a faster rate than the pipelines available at the field can pump it – this oil will simply have nowhere to go (ask the owners of the May futures for WTI for advice). It is also irrational to build more pipelines than necessary to pump the oil planned for production, so all this surface economy must also be optimally modeled, planned and built.

Sixthly, all wells need to be serviced periodically, and this is not so simple. Even to clean the sewers in the apartment, you need very long and dexterous hands, but the length of the sewer pipes in the apartment is a few meters. In the case of a well, operations have to be carried out at a depth of two to three kilometers, and accidentally getting a sledgehammer is not so easy. Most well operations require a detailed action plan. For example, you need to know in advance how to drill and how to equip a particular well. Anyone who at least once digged wells on the beach in childhood understands that any hole in the ground has the ability to drag out. The walls of the borehole can collapse directly during the drilling process and clamp the drilling tool, and you need to be able to predict in advance possible complications during the drilling process. When drilling, as well as during any other complex technical operation, there is always diagnostic equipment that shows certain parameters in real time – for example, the load on the drill bit, or, for example, the weight of the pipe being lifted, several kilometers long. For any such more or less complicated operation, it is necessary to build a mathematical model of the future operation in specialized software before it starts, in order to calculate, for example, whether the upper part of the pipe will tear under its own weight when its lower part begins to rub against the walls of the well and get stuck on a two-kilometer depth, and so on. Of course, the predictions of any models very much depend on the correctness of the data that will be embedded in these models.

Thus, almost the entire oil production process requires the adoption of optimal decisions, and this is possible only if there are mathematical models, methods and software in which all this is implemented. Of course, software cannot bring any benefit and correctly predict the future if it was developed and used by people who do not understand the essence of the processes occurring in reality or how these processes are modeled using physical and mathematical models.

To be continued…