Part III: Reservoir & Production Engineering

Chapter 13

Production Optimization

schedule15 min readfitness_center10 exercises

Why This Chapter Exists

A petroleum engineer responsible for a producing field faces a daily allocation problem. Multiple wells share limited processing capacity --- gas handling, water treatment, pipeline throughput, power supply. Each well has different characteristics: different reservoir pressures, different water cuts, different gas-oil ratios, different decline rates. The question is not simply "how much can each well produce?" but "how should production be distributed across all wells to maximize total output within the constraints the facilities impose?"

This is an optimization problem, and it is one of the most practically valuable skills a production engineer can have. A field producing 20,000 barrels per day under a naive allocation might produce 23,000 under an optimized one --- with the same wells, the same facilities, and the same reservoir. The difference is entirely in how the rates are distributed.

This chapter teaches you to formulate production problems as mathematical optimization problems, solve them in Python, and interpret the results in engineering terms. You will also build automated surveillance tools that flag when a well is underperforming relative to its potential.

infoWhat You Will Learn

  • Formulate production allocation as a constrained optimization problem
  • Use scipy.optimize for linear and nonlinear optimization
  • Allocate rates across wells to maximize total oil production
  • Optimize gas lift injection rates across a field
  • Build production surveillance dashboards
  • Detect underperforming wells using statistical methods

The Allocation Problem

Consider a field with five producing wells feeding into a single processing facility. The facility can handle at most 3,000 barrels of total liquid per day, 5 MMscf of gas per day, and 1,200 barrels of water per day. Each well has a different IPR, a different gas-oil ratio, and a different water cut. Some wells are more oil-rich but gas-heavy. Others produce mostly water with modest oil.

The naive approach is to let each well produce at its natural rate. But the natural rates may exceed the facility limits, requiring some wells to be choked back. The question becomes: which wells do you choke, and by how much?

The optimal answer is not obvious. Choking the highest-GOR well saves gas capacity but may sacrifice more oil than choking a lower-rate well with moderate GOR. The right allocation depends on the interaction between all the constraints simultaneously.

main.py

Linear Optimization — Maximizing Oil Production

When the relationship between the decision variables (well rates) and the objective (total oil) is linear, and the constraints are linear inequalities, the problem can be solved using linear programming. This is the simplest and most common formulation for production allocation.

The objective is to maximize total oil production:

Maximize: i=1nqo,i\text{Maximize: } \sum_{i=1}^{n} q_{o,i}

subject to:

i=1nqo,i×11WCiQliquid,max(total liquid constraint)\sum_{i=1}^{n} q_{o,i} \times \frac{1}{1 - WC_i} \leq Q_{liquid,max} \quad \text{(total liquid constraint)}
i=1nqo,i×GORiQgas,max(gas handling constraint)\sum_{i=1}^{n} q_{o,i} \times GOR_i \leq Q_{gas,max} \quad \text{(gas handling constraint)}
i=1nqo,i×WCi1WCiQwater,max(water disposal constraint)\sum_{i=1}^{n} q_{o,i} \times \frac{WC_i}{1 - WC_i} \leq Q_{water,max} \quad \text{(water disposal constraint)}
0qo,iqo,i,max(individual well limits)0 \leq q_{o,i} \leq q_{o,i,max} \quad \text{(individual well limits)}
main.py

Gas Lift Optimization

Gas lift optimization across a field is a classic nonlinear allocation problem. Each well responds to gas injection with diminishing returns --- the first 500 Mscf/d of lift gas might add 300 barrels of oil, but the next 500 Mscf/d might only add 100. The total lift gas available is limited by compressor capacity. The question is: how to distribute the available gas across wells to maximize total oil production.

main.py

The optimizer allocates more gas to wells with steeper response curves (higher marginal oil gain per unit of gas) and less to wells that are already near their plateau. This is the principle of marginal analysis: distribute the resource to where it produces the greatest incremental return.

Production Surveillance

Optimization is not a one-time exercise. Reservoir conditions change, wells water out, equipment degrades. Production engineers need automated tools that continuously monitor well performance and flag anomalies.

main.py

Exercises

fitness_center
Exercise 13.1Practice

-- Basic Rate Allocation

Three wells with maximum rates of 1,000, 800, and 1,500 STB/day share a pipeline with 2,500 STB/day capacity. Each well has operating costs of 10,10, ...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 13.2Practice

-- Adding a Gas Constraint

Extend Exercise 13.1 with GORs of 600, 1,500, and 400 scf/STB and a gas handling limit of 2.5 MMscf/day. How does the optimal allocation change?...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 13.3Practice

-- Water Disposal Cost

A field produces 4,000 bbl/day of water that must be disposed at $2.50/bbl. Write a function that calculates net revenue (oil revenue minus water disp...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 13.4Practice

-- Gas Lift Marginal Analysis

For a well with gas lift response q = 300 + 600 × G / (200 + G), calculate the marginal oil gain (dq/dG) at injection rates of 100, 300, 500, 1000, an...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 13.5Practice

-- Multi-Well Gas Lift

Six wells compete for 3,500 Mscf/d of lift gas. Define response curves for each well and find the optimal distribution. Compare the optimized total ag...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 13.6Practice

-- Choke Size Optimization

A well produces through an adjustable choke. The choke performance equation relates upstream pressure, downstream pressure, and choke diameter to flow...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 13.7Practice

-- Anomaly Detection Tuning

Using the surveillance framework from this chapter, experiment with different window sizes (7, 14, 30, 60 days) and different sigma thresholds (1.5, 2...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 13.8Practice

-- Decline-Aware Allocation

Production allocation should account for the fact that wells decline at different rates. Modify the allocation model so that each well's maximum rate ...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 13.9Practice

-- ESP vs. Gas Lift Economic Comparison

A well can be put on either an ESP (capital cost 350,000,operatingcost350,000, operating cost 350,000,operatingcost5/STB, expected rate 2,200 STB/d) o...

arrow_forward
codePythonSolve Nowarrow_forward
fitness_center
Exercise 13.10Practice

-- Full Field Optimization Report

Build a complete field optimization for 8 wells with realistic parameters. Include: optimal rate allocation with facility constraints, gas lift optimi...

arrow_forward
codePythonSolve Nowarrow_forward

Summary

  • Production allocation is a constrained optimization problem: maximize total oil (or profit) subject to facility limits on liquid, gas, and water handling.
  • Linear programming (scipy.optimize.linprog) solves allocation problems where the relationships between rates and constraints are linear.
  • Nonlinear optimization (scipy.optimize.minimize) handles problems like gas lift allocation where well responses follow diminishing-returns curves.
  • Marginal analysis is the guiding principle: allocate each unit of constrained resource to where it produces the greatest incremental return.
  • Production surveillance uses rolling statistics and anomaly detection to flag wells that deviate from expected behavior, enabling rapid intervention.
  • The gap between naive allocation and optimized allocation can be hundreds or thousands of barrels per day across a field --- a significant economic impact with no additional capital investment.