Creating well paths from control points

Well paths encode the trajectory and curvature of a wellbore – oftentimes tailored to avoid drilling hazards, improve productivity and reservoir contact, and reduce costs of drilling. There are consequently many factors that go into creating an ideal or optimized well path that reflect play characteristics, technology improvements, regional drilling environments and historical drilling performance. While there are many tools that provide functionality for designing wellbores, none have the ability to adapt to the drilling landscape and capture the historical performance statistics for a vendor or company. Enter Spotfire and its ad-hoc data and compute model.

The key selling point for Spotfire is that it can connect to corporate and public datastores to leverage this information and create an understanding of good and bad well design. In this post, we will walk through how we can design an initial wellbore design, which then can be sent through geologic, drilling, and economic analyses.

Spotfire isn’t meant to be the tool where you complete the design, but it’s a great place to start and combine relevant variables to make an improved and informed decision.

Making control points

We will use control points to design a well path. Control points will define the form of the well path and then we will use splines to make a smooth wellbore. This way, the user only needs to put initial well location, kickoff depths and target reservoir contacts for the algorithm to create a realistic wellbore trajectory. We will use this in the next post to calculate seismic along the well path.

Our final solution will look like this:

We are going to have the user provide the control points in a text box with comma delimited values. This could also come in from a different database or a more sophisticated user interface. For now, since we are focusing on how we do the calculation, we will be happy with our text box.

We will also have some other inputs including a smoothing factor and the number of points we want to put on the wellbore. Generating splines of this size is actually quite fast, so it will make for a nice interactive experience.

The first script we’ll write will convert the text box input into a data table. So, we just want to write a data function that takes as input a string (in csv format) and returns a data table. If you want to generalize it, you can also send in the column headers as a separate string so that the columns come back with reasonable names.

Here’s the code for this step:

lines = paste("X,Y,Z\n", DataText)
conn = textConnection(lines)
Markers = read.csv(conn)
close(conn)

Right now we are putting down control points manually, but you could also calculate control points based on constraints or areas you want to target. In this scenario, the user could identify target areas, potential drill sites, and areas to avoid. The system could then offer suggestions for control points which would then be fed into the wellbore system.

Making the spline

Next, we want to take a data table of control points, smoothing factor, and number of points and generate a smooth well path. At the heart of this routine is an R function ‘make.spline’ that comes built with TERR. We need to give it the X,Y of the control points and it will return a fit model which we can use with the ‘predict’ function. To cap it all off, we will assemble the new values into a data table for export.

There are several spline packages out there which provide advanced functionality. The spline functionality that comes with the basic TERR installation does a fine job, though, so we will just use that. Plus, then we have no dependencies to manage.

The smooth.spline function takes as input the x and y arrays, a smoothing parameter (spar) and the number of degrees of freedom (df) for the fit spline model. There are more options that we don’t need to use right now.

m = smooth.spline(x,y, spar=Smoothing, df=length(unique(x))-Df, all.knots=TRUE)

So, we just need to call smooth.spline on these parameters to build a fit model (m). Then, we apply that model to build out the more detailed spline. This is done with the predict(m, data) function.

The full function looks like this:

ControlPoints$Well = "Well"

x = ControlPoints$Z
y = ControlPoints$Y

m = smooth.spline(x,y, spar=Smoothing, df=length(unique(x))-Df, all.knots=TRUE)

zz = seq(min(x), max(x), length.out=NumPoints)
yy = predict(m, zz)
xx = rep(min(ControlPoints$X), length(zz))
well = rep("Well", length(zz))
WellSpline = data.frame(X=xx, Y=yy$y, Z=zz, Well=well)

We can then add this new data table to the 3D subsurface scene. In Spotfire, we could have this result append to an existing table or replace the data table. You may want to append, which would keep around the results. I’m going to replace the data table, meaning we get a new wellbore trajectory table each time.

This will smoothly update not only the wellbore but also the visualization. It will think for a sec, then draw the new curve. Because the computation is so fast, I’ve set it up to automatically recompute with any change rather than require the user to press a button.

Thoughts

So, in a short period of time, we’ve been able to put together a wellbore designer. There are some neat opportunities for improvements (including better placement of control points), but we can still get to a nice end product. I’ve left out building the well path in both the x and y dimensions, as right now I’m assuming a constant Y. You could build this with a two-dimensional spline model rather than a 1D version.

Also, I’ve walked through building a wellbore from scratch, but you could also use this spline code to interpolate between survey locations to make a smooth wellbore trajectory curve.

Now, we’ll continue with the process and leverage some of the flexibility of the ad-hoc data model of Spotfire to improve our wellbore by annotating it with seismic attributes. Check back in for the next installment.

You can get access to the 3D Subsurface Visualization used in this post off of Exchange.ai here.

Leave a Reply

Your email address will not be published. Required fields are marked *