Keywords

1 Introduction

Scientific real-time visualization techniques are important tools to understand what is almost impossible to be seen in numbers. When this visualization approaches are built into an interactive environment, a powerful workflow is available for the production and analysis pipeline. In the oil and gas industry, it is always very important to evaluate the technical and economical feasibility before starting the drilling process of a gas or oil reserve. The soil structure around the well must be known, in order to minimize the risks of collapse. The stability analysis of a gas or oil reserve is a central issue and a challenge for specialists. Good results at this stage could bring a deep impact in reduction of drilling costs. In the later years, wells have become longer and with higher inclination making it even more challenger and expensive.

According to Aadnoy [3], for years people have estimated the time loss associated with unexpected borehole stability problems to account for 10–15 % of the time required to drill a well. Since the rig time is the major cost factor in drilling operation, we understand that borehole stability problems are very costly for the industry. Borehole collapse is possibly the most costly single problem encountered during drilling of a well, and there is not a trivial solution for the problem.

This theory states that drilling generates changes in the stress field of the formation due to supporting material losses, inducing stresses that can result in more trouble [4]. If the stress is higher than the rock strength, rocks can cause the borehole collapse. So the main fundamental of the solution proposed in this work is to possibly prevent and reduce instability problems.

The better the planning of a well, the greater are the chances of success to be achieved. In this context, the word success means achieving the objectives of the project according to the safety standards of the company, time, and costs consistent with the ones of the market. However, to achieve this success, Geologists, Reservoir Engineers and Production Engineers should not only care to the optimization of the production of the reservoir but should also be aware of the operational risks and expenses of the project.

When the well is drilled and a part of its formation is removed, there is instability of stresses. In that moment comes one of the most important stages of the project of a well which is ensuring the stability of it, and to achieve this goal it is necessary to evaluate factors like: rock resistance, temperature variations, well trajectory, and geometry.

This work proposes a novel framework for a 3D geometric reconstruction and visualization of the bare holes and its components. Data structures and processes adopted allow a real-time interaction, using dedicated but not expensive graphic hardwares. New interfaces and data manipulation are proposed, increasing the workflow process. In order to maintain this real-time requirement, our system builds the geometry using a thread-based reconstruction model and level of detail algorithms for maintaining huge datasets in the memory.

2 Related Works

In [1] it presented a borehole visualization approach, more focused on stress and breakout analysis. Barton and Zoback [5] and Peska and Zoback [6] presents important factors to be considered in order to model the requirements associated to a detailed data processing and analysis of this kind of data, that will be considered on the proposed system.

In [7] the authors present a technique for modeling a 2D approach, so important requirements of these structures are maintained and can be analyzed, such as perforation fluid weight, rock strength, and hole geometry. Figure 13.1 shows the data obtained by a four arms caliper log. The 2D developed system shows an approximation of the borehole shape in a specific height (Fig. 13.2). Each colored profile is related to a caliper arm and is used for the 3D reconstruction.

Fig. 13.1
figure 1

Profiles obtained by a 4-arm caliper log

Fig. 13.2
figure 2

A screen of the 2D caliper analysis system

Despite allowing the user to obtain various types of information, this tool does not present a global spatial view of the three-dimensional geometry of the borehole, even the most experienced specialists can experience difficulties to imagine its geometry, being a restriction, but a key point to the proposed three-dimensional tool.

Debogurski [8] presents a procedural terrain generation using the recent Marching Cubes Histogram Pyramids (also known as HPmarcher) implementation. Perlin Noise function is used to procedurally create the terrain. This is an important approach related to our proposal, since it is a GPU-based approach for the modeling optimization, which allows a huge number of polygons to be handling in a Real-Time System.

This work merges characteristics from most of these works, enhancing the visualization process, since important data may be mapped into a huge and massively geometry borehole reconstruction.

3 Methodology

Our methodology is divided into six steps (Fig. 13.3). The process begins describing how the data is acquired by the Caliper tool. After this, the data is converted into a specific data structure. The third step consists on the calculations necessary for the geometric consistency, and on the fourth step some optimization are done, which means that we try to send to the next step only the necessary vertexes. To finish the process the user can make the analysis with the tool information and finally obtain useful knowledge. A more detailed explanation is described in the following subsections. This workflow is related to the usage process of the proposed system.

Fig. 13.3
figure 3

The framework of the 3D Caliper tool (GeoPoço 3D)

3.1 Data Acquisition

A borehole failure can be detected by different measurement instruments, like the following caliper logs: Borehole Geometry Tool; Resistivity logs; Ultrasonic logs. The caliper tool is inserted into drilling spot to perform a series of measurements used to evaluate the borehole’s feasibility [1]. It measures the borehole diameter variation by depth, i.e., its shape and can also give other important information, as well hole irregularities or damages. The caliper log can have two, four, or more extendable arms arranged around the tool. Figure 13.4 shows a simple schema of the tools and obtained data. Among all these measures P1AZ represents the alignment of the first arm with the magnetic north in degrees, DEVI represents the tool’s inclination and combined with HAZI gives information about the direction. All this informations are strictly necessary to reconstruct the borehole geometry, and these variations on every section will allow the borehole to make curves, creating the sensation of a real borehole and not just a simple geometric form like a cylinder.

Fig. 13.4
figure 4

A 3D sketch of the Caliper tool orientation

For each position along the borehole, information such as sensors’ position and orientation, rock’s resistivity and acoustic data are obtained. These data allow the user to find flaws in the soil, leaving to the geologist the decision whether the well is feasible or not, and possible actions to minimize its usage risk. Figure 13.5 shows an example of a caliper sample file, as it is provided by the tool.

Fig. 13.5
figure 5

Sample data obtained from Caliper tool

Table 13.1 shows an example of a single line data obtained from a file of the Caliper Tool.

Table 13.1 A sample of some caliper fundamental measures data

3.2 Preprocessing

The borehole data is stored in a file and then read and loaded into the main memory. The reading process takes a while, due the large file size and the transformations that are applied to transform it into tridimensional data. For example, a 4 Km borehole is stored in a file of about 180 MB of raw data that must still be read and converted into the three-dimensional borehole geometry.

From a usability point of view, it is not convenient that the system stays locked until all the geometry is ready for rendering. Hence, we propose in our process to show some visual information in the screen as soon as possible. This is done by combining two working threads, one responsible for reading and transforming the data and the other that takes this data and builds the mesh geometry.

This threading part is managed with C++ Boost’s thread module [9], a portable library which allows execution of multiple threads with shared data and provides functions for thread management and synchronization.

3.3 Math

At this stage we implement one of the most important parts of the visualization tool, which is the transformation process of the 2D data obtained by the Caliper tool into 3D data. This effort is divided in 6 steps as can be see on the following subtopics.

3.3.1 Transformation of the Caliper Arms Length into a 2D Data

The Caliper data file stores the arms’ length as a single value that represents the distance from the tool center and the arm pad. This data must be transformed into 2D coordinates (and later 3D) in order to build the borehole geometry.

For the sake of simplicity, the tool axes are located in the center of the Cartesian coordinate system and the direction of the first arm coincides with the positive X-axis, as shown in Fig. 13.6. The arms can be described in polar coordinates, so each coordinate for the other arms can be obtained from equations in Table 13.2.

Fig. 13.6
figure 6

Top View of the Caliper tool inside a well bore

Table 13.2 How to calculate the X and Y coordinates

3.3.2 Interpolation of the Data with Splines to Obtain a Section with the Desirable Resolution

Given six 2D control points (obtained from the Caliper’s arm data) instead of simple connect the points (red lines in Fig. 13.7) a smooth curve is created (black lines in the same figure) to interpolate them using a closed natural cubic splines algorithm. An interesting demonstration can be found in [10].

Fig. 13.7
figure 7

Drawn in red is the original data acquired from the six-arms caliper control points. In blue is an approximation representation created with an interpolation of a closed natural cubic splines

3.3.3 Inclusion of the Rotation in P1AZ

The interpolated points are rotated around the section center in the Y-axis. The rotation angle is defined by the P1AZ value read by the sonde. This aligns the first arm with the earth’s magnetic north.

3.3.4 Inclusion of the Rotation in DEVI

DEVI value defines the sonde deviation from the surface. Combined with HAZI, it’s used to determine the tool’s inclination and direction.

3.3.5 Inclusion of the Rotation in HAZI

HAZI tells the borehole angle with the earth’s magnetic north. This value, combined with DEVI, allows finding out tool’s inclination and direction.

4 Optimization

Optimizations are necessary in order to keep the visualization system running in real-time at acceptable frame rates. This section describes some techniques used for this purpose for this work.

4.1 Level of Detail

Due to the common large size of the boreholes, it is not practical to render its entire geometry in every frame. This could easily lead to GPU memory overflow and even if memory is not an issue, processing time should still be taken into account. But as in many visualization systems, it is not mandatory to render the entire geometry with full detail and some simplification for distant objects is accepted. So, the level of detail technique [11] can be applied to increase the system performance.

Keeping a low polygon count is the key point to achieve high frame rates, so before sending geometry to the render stage in the graphics pipeline, the model is processed and only parts near to the camera are built in high level of detail. Distant parts are built in lower level of detail, but it is well-balanced enough that major features of the borehole (such as its direction and curvature) are not lost and can still be visualized from distance, while that small details from distant sections are ignored. As the camera moves through the borehole, the level of detail is dynamically updated, so the user always visualizes the high-resolution mesh when it’s near enough, ensuring that the user will never see problems on the geometry due to the low resolution.

In Fig. 13.8, we present a fake borehole built for demonstration only. The first frame (a) shows a borehole represented with full resolution. Here, all the borehole data is used for rendering. The next frame (b) shows how the borehole should be represented with a lower resolution. The sections are not interpolated, so each one is in fact a hexagon, and only a small fraction of the original data is used to build the geometry, this maintains the overall shape of the borehole, but small variations are lost. The last frame (c) mixes these two visualizations and shows a high-resolution borehole for parts that are near to the camera. As the camera moves away, lower detail level is required, while the viewer still has the impression that the geometry is unchanged. This happens because, different from this example, in the actual system we only apply the level of detail for parts that are really far away from the camera and smaller geometry changes may go unnoticed.

Fig. 13.8
figure 8

A fake borehole three-dimensional mesh with different levels of detail

4.2 Concurrent Mesh Manipulation and Parallelism

As described in Sect. 13.3.2—Preprocessing, the borehole data is loaded without locking the visualization window. Whenever a thread finishes loading a part of the borehole, it is immediately sent to the rendering without major performance costs. The process for changing the level of detail after the model is fully loaded uses a similar technique.

For memory space reasons, only one mesh for a given part of the borehole is stored in the GPU memory at a time. Whenever the level of details changes, a new mesh with a different level of detail is again built by the CPU and sent to the GPU. The older mesh is still rendered until the new mesh is ready, so a gap is never formed while the meshes are changed. The building process of a new mesh is done by a concurrent thread, so no slow down is noticed. When it’s ready for rendering, the older mesh is removed from memory and the new one becomes visible.

The borehole is divided in a variable number of meshes depending on the borehole size. Anytime the level of detail should be changed, i.e., when the camera moves, only the closer meshes are updated, not the borehole model. This is a different approach from the commonly used technique, where the model is fully changed for each level of detail.

5 Rendering

Once the data is fully loaded into the main memory and processed, it’s possible to reconstruct a three-dimensional representation of the borehole. As previously described, some transformations are applied to caliper arm’s points in order to transform them from a bi-dimensional plane to a three-dimensional space. The next step is to combine each section and create a 3D model of the borehole that can be used for visualization and analysis. If this combination had not been done, the model would simply look like as a simple stack of slices instead of a reliable three-dimensional representation of the borehole.

The representation of the borehole as a series of connected sections makes the usage of triangle strips [12] a natural choice for building the geometry. The connection between two adjacent sections is built with a single triangle strip, instead of a collection of independent triangles. This results in lower memory usage by the GPU and better performance. Figure 13.9 shows how we start from points obtained from the spline interpolation (a) and build the borehole geometry (b and c).

Fig. 13.9
figure 9

Borehole reconstruction using triangle strips

Figure 13.10 shows one simple example of this process. Given a pair of sections, let’s call A the upper section indicated by black dots and B the white ones. From left to right (i.e., from the first arm or control point to the last one), we add to the triangle strip the first vertex from A and B, in this order (points 1 and 7 in the figure). Then, we move to the next pair and add the new points from A and B (2 and 8), and so on until all vertex from both sections are added. The first two points are added again in the end, so the strip closes the section. Each new point added after the first pair results in the creation of a new triangle (1-7-2 and 7-2-8, for example). When the process is over, a small mesh connecting two sections is created. Applying these steps to all sections it results in a 3D representation of the borehole. Listing 13.1 describes a pseudo-code for this process.

Fig. 13.10
figure 10

Sample triangle strip connecting two sections

Fig. 13.11
figure 11

Comparison of performance of the FPS rate versus the growth of the well length

Fig. 13.12
figure 12

Comparison of the growth of the well length versus the amount of triangles

Listing 13.1
figure 13

Pseudocode for creating the triangle strips

6 Analysis and Information

Study of borehole stability requires not only a deep knowledge of problems’ sources, but it is accurate identification and modeling. When a borehole is drilled in a nonisotropic prestressed rock, we can note a failure, which is a result from the reorientation of the stress field and the stress concentration around the borehole wall. The stability of an oil reservoir is a challenge for specialists of the petroleum industry; therefore, a correct analysis of this question can reduce the perforation cost significantly. It can be considering that a considerable time expense to perforate a hole is related to the analysis of its stability, which means an annually high cost.

The caliper tool is used in this purpose for gathering data such as resistivity and acoustic measures of the borehole wall, as well as diameter for each section. These data can be used to identify problematic points where tension could lead to the borehole’s collapse.

The three-dimensional model of the borehole allows the user to visualize the possible problematic points and have access to collected data for the sections. For each section, the user is able to request many calculations, such as sections diameters relation, section angle, and cut type classification. This combination of data and visual information allows an easier way to identify whether the borehole is stable and which actions should be taken.

7 The Implementation of the Three-Dimensional Visualization System

The visualization system, named “GeoPoço 3D”, was written in C++ with an OpenGL-based graphics framework. An initial prototype was made using Irrlicht [13], an open-source 3D engine that provides a certain level of abstraction of hardware resources by its API and great performance. A new version is under development using Open Inventor [14] instead of Irrlicht.

The tests were carried out on a desktop with the Windows XP Professional SP2 operating system was installed, with a Core 2 Duo processor E7500 2.93 Ghz and 2 GB of RAM. The graphic card used it was an NVidia GeForce 9600 GT with 512 MB of RAM and 64 stream processors. The former prototype.

8 Results

A key point in this visualization system is that very large boreholes can be analyzed without visible performance loss. Should the borehole be rendered entirely in high-resolution, the GPU would quickly run out of video memory and its processing power is very likely to not be able to deal with this data flow.

The level of detail technique allows the borehole to be fully visualized, but only the nearest parts are rendered with full detail level. Distant parts are built with very simple geometry that still looks like the original borehole, but lacks detail.

This technique allows the visualization of very large boreholes without major performance issues. As the borehole gets bigger, only a small fraction of its structure is added to the scene graph, so the frame rate tends to be stable. Figure 13.11 demonstrates how the system behaves as the borehole size increases. A 10 meter borehole runs at more than 800 frames per second. In this case, no level of detail was applied. The frame rate drops more than 2.5 times for a borehole 10 times larger (100 m), with level of detail already applied. One should expect that when we double the borehole size, the frame rate should drop 5 times and so on. But with the level of detail applied, the triangle count does not grow much fast and the frame rate becomes stable.

The system is scalable for visualization of very large boreholes. Since it’s estimated that specialists will analyze sections of 500 m or less at a time, the current performance is more than enough for a completely smooth analysis.

Figure 13.12 shows how the number of triangles does not increase as fast as the borehole length, consequence of the level of detail used to render the scene, what means that only the necessary triangles are sent to GPU memory. This allows larger sections and higher resolutions without significant rate loss.

9 Conclusions

In this chapter, the authors presented a framework for real-time visualization and geometry reconstruction of large oil and gas boreholes.

The visualization of a borehole is a relevant issue for the oil and gas industry as well for the productivity of the field. If you know where the problem can occur or where it is better to drill you can increase your production.

The tool proved to be able to scale up for really huge wells since in all the instances clearly show that even on the wellbores with thousands of meters the system provides an interactive rate of at least 200 frames per second for all the well-visualization tasks like moving, zooming, rotation, and translation.

The tool can help you spend less time analyzing wellbore stability issues, helping decisions, reducing project risks, drilling costs, and increasing the project profit.

However, there are still many features to be implemented as you can see on the future work section.

10 Future Works

At present, we are only using a simple interface with a mouse and a 3D view. The next aim is to provide a better visualization of the well using a touch surface table, controllers, and 3D glasses. As future work, we also intend to target it at further development, increasing interaction and automated diagnosis of failures on the well.