Part III: Reservoir & Production Engineering

Chapter 14

Drilling Analytics and Optimization

schedule15 min readfitness_center10 exercises

Why This Chapter Exists

Drilling a well is one of the most expensive operations in the petroleum industry. An onshore well might cost 5million.Adeepwaterwellcanexceed5 million. A deepwater well can exceed 150 million. Every day on the rig costs between 100,000and100,000 and 1,000,000 depending on the environment. When the rate of penetration drops, when the bit stalls, when the drillstring vibrates in ways it should not, the cost clock keeps ticking.

Drilling generates enormous volumes of real-time data: weight on bit, rotary speed, torque, rate of penetration, mud properties, pressures at multiple points in the system, vibration measurements, and more --- all recorded every few seconds. The problem is that most of this data is watched in real time by a driller staring at gauges, then archived and rarely analysed systematically.

Python changes that. This chapter teaches you to ingest drilling data, compute the engineering metrics that reveal inefficiency, detect common drilling dysfunctions from data patterns, and build models that predict rate of penetration. The goal is to turn drilling data from an archive into a decision-making tool.

infoWhat You Will Learn

  • Load, clean, and structure real-time drilling data
  • Calculate rate of penetration and drilling efficiency metrics
  • Compute Mechanical Specific Energy and interpret what it reveals
  • Detect drilling dysfunctions from data signatures
  • Build ROP prediction models using engineering features
  • Perform well time and cost analysis

Drilling Data

Drilling data arrives in time-indexed records, typically at intervals of one to ten seconds during active drilling. The primary measurements are:

  • Bit Depth / Hole Depth --- how deep the well currently is (feet or metres)
  • Rate of Penetration (ROP) --- how fast the bit is advancing through rock (ft/hr)
  • Weight on Bit (WOB) --- the force applied to the bit face (thousands of pounds, or klbf)
  • Rotary Speed (RPM) --- how fast the drillstring is turning (revolutions per minute)
  • Torque (TQ) --- the rotational force on the drillstring (ft-lbs)
  • Standpipe Pressure (SPP) --- the pressure of the mud being pumped downhole (psi)
  • Mud Weight In / Out --- the density of mud going in and coming back (ppg)
  • Flow Rate --- volume of mud being circulated (gal/min)

Not all of this data is useful at all times. When the driller is tripping pipe (pulling the drillstring out of the hole or running it back in), the ROP is zero and WOB is meaningless. When circulating without drilling, there is no rock being cut. Filtering the data to active drilling intervals is the first and most important preprocessing step.

main.py

Mechanical Specific Energy

Mechanical Specific Energy (MSE) is the single most important drilling efficiency metric. It represents the energy required to destroy a unit volume of rock:

MSE=480×T×RPMDb2×ROP+4×WOBπ×Db2MSE = \frac{480 \times T \times RPM}{D_b^2 \times ROP} + \frac{4 \times WOB}{\pi \times D_b^2}

where:

  • TT = torque (ft-lbs)
  • RPMRPM = rotary speed (rev/min)
  • DbD_b = bit diameter (inches)
  • ROPROP = rate of penetration (ft/hr)
  • WOBWOB = weight on bit (lbf)

MSE has units of psi (energy per unit volume of rock). In a perfectly efficient system, MSE would equal the rock's confined compressive strength (CCS). In practice, MSE is always higher than CCS because energy is wasted to friction, vibration, and inefficient cutting.

The ratio of CCS to MSE is the mechanical efficiency. An efficiency of 30–40% is typical. When efficiency drops below 20%, something is wrong --- the bit may be dull, the well may have vibration problems, or the drilling parameters may be poorly chosen.

main.py

Drilling Dysfunction Detection

Drilling dysfunctions waste time, damage equipment, and increase cost. The most common dysfunctions leave distinct signatures in the drilling data:

Stick-slip vibration occurs when the bit alternates between sticking (zero RPM at the bit) and spinning free (very high RPM). The surface RPM appears normal, but downhole the bit experiences extreme torsional oscillation. In the data, this manifests as high torque variability and inconsistent ROP at constant surface RPM.

Bit bounce is axial vibration where the bit repeatedly lifts off and impacts the rock. It causes low ROP relative to WOB and erratic weight measurements.

Whirl is lateral vibration where the bit orbits the borehole rather than rotating concentrically. It causes an enlarged, out-of-gauge hole and rapid bit wear.

main.py

ROP Prediction

Rate of penetration depends on controllable parameters (WOB, RPM, flow rate, mud weight) and uncontrollable parameters (rock strength, formation type, pore pressure). A prediction model that captures these relationships allows the drilling engineer to choose the controllable parameters that maximize ROP for the given formation.

main.py

Well Time and Cost Analysis

Every drilling operation is ultimately measured against two numbers: time and cost. A time-depth curve plots cumulative depth against elapsed time and is the standard way to compare drilling performance between wells, between rigs, or against the plan.

main.py

Exercises

fitness_center
Exercise 14.1Practice

-- Drilling Data Cleanup

Load a drilling dataset and filter it to active drilling intervals only (ROP > 0, WOB > 5 klbf, RPM > 30). What percentage of the raw data represents ...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 14.2Practice

-- MSE Calculation

Calculate MSE for a well drilled with an 8.5" bit. Plot MSE vs. depth and identify the depth intervals where MSE exceeds 3× the estimated rock strengt...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 14.3Practice

-- Bit Run Analysis

A well uses three bits across its total depth. Bit 1 drills 0–3,500 ft, Bit 2 drills 3,500–7,200 ft, Bit 3 drills 7,200–9,800 ft. For each bit run, ca...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 14.4Practice

-- Stick-Slip Severity Index

Extend the stick-slip detection function to return a severity index (0 to 1) based on the ratio of torque standard deviation to mean torque. Plot seve...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 14.5Practice

-- Optimal WOB and RPM

For a given depth interval (constant formation), vary WOB from 10 to 45 klbf and RPM from 60 to 180. Use the drilling data to find the WOB-RPM combina...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 14.6Practice

-- ROP Model with Domain Features

Build an ROP prediction model that includes engineered features: MSE, depth-normalized torque (torque/depth), specific energy ratio, and bit run foota...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 14.7Practice

-- Non-Productive Time Analysis

Categorize drilling data into productive time (drilling) and non-productive time (trips, connections, stuck pipe, circulation, waiting). Calculate the...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 14.8Practice

-- Offset Well Comparison

Given time-depth data for three offset wells and the current well, plot all four on the same chart. Calculate the composite best performance (taking t...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 14.9Practice

-- Cost per Foot Optimization

Bit replacement requires a round trip (pull out and run back in), which costs time. A dull bit drills slower but avoids the trip cost. Write a functio...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 14.10Practice

-- Drilling Performance Dashboard

Build a comprehensive drilling dashboard for a single well that displays: time-depth curve vs. plan and offset, ROP vs. depth with formation tops, MSE...

arrow_forward
codePythonSolve Nowarrow_forward

Summary

  • Drilling data is time-indexed and high-frequency. Filtering to active drilling intervals is essential before any analysis.
  • Mechanical Specific Energy quantifies how efficiently the drill bit converts energy into rock destruction. It is calculated from torque, RPM, WOB, ROP, and bit diameter. Low efficiency (MSE >> rock strength) signals a problem.
  • Drilling dysfunctions such as stick-slip, bit bounce, and whirl leave identifiable patterns in the data. Automated detection enables faster intervention.
  • ROP prediction models combine controllable drilling parameters with formation properties to forecast penetration rate. Depth-based train/test splits are more realistic than random splits because they simulate predicting into unknown formations.
  • Time-depth and cost analysis provide the ultimate benchmarks for drilling performance. Non-productive time identification and offset well comparison drive continuous improvement.
  • Every day saved on the rig saves hundreds of thousands of dollars. The tools in this chapter turn drilling data from a passive record into an active decision-support system.