Exercise 2.2
Productivity Index
The productivity index (PI, often written as J) measures how efficiently a well converts pressure drawdown into oil flow:
where is the oil rate (bopd), is the average reservoir pressure (psi), and is the flowing bottomhole pressure (psi).
Write productivity_index(oil_rate, reservoir_pressure, flowing_pressure) that:
- Validates the inputs. If
flowing_pressure >= reservoir_pressure,
flow would be reversed (or zero). That is a non-physical configuration. Raise ValueError instead of returning a meaningless number.
- Returns a tuple
(J, AOF)whereJis the productivity index in
bopd/psi and AOF = J × P_e is the Absolute Open Flow, the theoretical maximum rate if P_wf dropped to zero.
Test with: q_o = 1,200 bopd, P_e = 4,500 psi, P_wf = 2,800 psi.
> Think about it: is the AOF a realistic production target? What > happens to the well, the formation, and the recovery factor if you > actually try to pull P_wf down to zero?
Stuck? Reveal hints one at a time — they progress from nudge to near-solution.
visibilityReveal reference solutionexpand_more
Try solving it yourself first — the hints walk you through it. The solution below is one valid approach; yours may differ and still be correct.
def productivity_index(oil_rate, reservoir_pressure, flowing_pressure):
if flowing_pressure >= reservoir_pressure:
raise ValueError(
f"flowing_pressure ({flowing_pressure} psi) must be below "
f"reservoir_pressure ({reservoir_pressure} psi)"
)
J = oil_rate / (reservoir_pressure - flowing_pressure)
aof = J * reservoir_pressure
return J, aof
J, aof = productivity_index(1200, 4500, 2800)
print(f"J = {J:.4f} bopd/psi")
print(f"AOF = {aof:,.1f} bopd")
lockCopying code is a Full Access feature.