Developing AI System for Oil and Gas Industry: Optimization of Production and Well Analysis
The oil and gas industry is one of the most mature users of ML: sensors on every well, vast volumes of geological and geophysical data, high cost of decisions. AI optimizes production, forecasts well productivity, and prevents emergency situations.
Well Productivity Forecasting
Decline Curve Analysis (DCA) + ML:
Classical DCA (Arps) describes the curve of oil/gas productivity decline over time. ML improves DCA by accounting for reservoir physical parameters and operational modes:
import numpy as np
from scipy.optimize import curve_fit
from sklearn.ensemble import GradientBoostingRegressor
import pandas as pd
class WellProductionPredictor:
"""Combined well productivity forecast model: DCA + ML corrections"""
def arps_decline(self, t, qi, di, b):
"""Hyperbolic decline curve (Arps): q(t) = qi / (1 + b*di*t)^(1/b)"""
return qi / (1 + b * di * t) ** (1 / b)
def fit_dca(self, time_days, production_bbl_day):
"""DCA parameter fitting for well"""
try:
popt, _ = curve_fit(
self.arps_decline,
time_days, production_bbl_day,
p0=[production_bbl_day[0], 0.01, 0.5],
bounds=([0, 1e-6, 0], [1e6, 2.0, 2.0]),
maxfev=5000
)
return {'qi': popt[0], 'di': popt[1], 'b': popt[2]}
except:
return None
def ml_correction_features(self, well_data):
"""Features for ML DCA correction"""
return {
'reservoir_pressure': well_data['bhp_current_psi'],
'water_cut': well_data['water_cut_pct'],
'choke_size': well_data['choke_size_64th'],
'esp_frequency': well_data.get('esp_hz', 50),
'glr': well_data.get('gas_liquid_ratio', 0),
'cumulative_oil': well_data['cumulative_oil_bbl'],
'days_producing': well_data['days_on_production'],
'dca_residual': well_data['actual'] - well_data['dca_predicted']
}
Physics-Informed ML:
Filtration equations (Darcy): real wells require geological reservoir model. PINN on diffusivity equation provides physically justified forecast even with small data volumes.
Optimization of Operating Modes
Deep Well Pump Optimization (ESP Optimization):
Electric Submersible Pump (ESP) — the main method of mechanized extraction:
- Task: find optimal ESP frequency to maximize production at minimum energy consumption
- ML surrogate pump curve: predicts productivity and efficiency at given frequency and intake pressure
- RL agent: manages frequency as reservoir pressure and water cut change
from stable_baselines3 import SAC
import gymnasium as gym
class ESPOptimizationEnv(gym.Env):
"""Environment for ESP optimization RL"""
def __init__(self, well_simulator):
self.simulator = well_simulator
self.action_space = gym.spaces.Box(low=40, high=60, shape=(1,)) # ESP frequency (Hz)
self.observation_space = gym.spaces.Box(
low=0, high=np.inf,
shape=(6,) # intake pressure, production, water cut, current, time, cumulative
)
def step(self, action):
freq = float(action[0])
new_state, production_bbl_day, power_kw = self.simulator.step(freq)
# Reward: oil production - electricity cost
oil_rate = production_bbl_day * (1 - new_state[2]/100) # accounting for water cut
reward = oil_rate * 0.5 - power_kw * 0.01 # in normalized units
return new_state, reward, False, False, {}
Well Integrity Monitoring
Anomalous Well Behavior:
LSTM-Autoencoder on multidimensional time series (pressure, temperature, liquid rate, gas rate, ESP currents):
- Reconstruction error → anomaly
- Typical anomalies: water breakthrough, ESP plugging, packer seal failure
Sand Production Detection:
Acoustic sensors on wellhead → FFT → classifier (CNN on spectrograms):
- Sand creates characteristic high-frequency noise
- Early detection → reduce drawdown before erosion formation
Geophysics and Drilling
MWD/LWD Interpretation:
Measurement/Logging While Drilling — real-time data from sensors in drill string. ML interpretation:
- Lithological prediction from well logs (GR, SP, resistivity) → facies classifier
- Geo-steering: where to direct well bore for optimal reservoir penetration
- Rate of penetration (ROP) forecast → drilling optimization
Seismic:
- Full Waveform Inversion (FWI) with ML acceleration: velocity model reconstruction → structural geology
- Automatic fault picking: U-Net segmentation of seismic sections → fault delineation
Development timeline: 6–10 months for AI well analysis platform with productivity forecast, ESP optimization, and integrity monitoring.







