Exerciseschevron_rightChapter 1chevron_right1.5
fitness_center

Exercise 1.5

Comparing Mud-Weight Options

Level 2
Chapter 1: Python Setup for Petroleum Engineering
descriptionProblem

Three rigs are bidding on the same well. Each proposes a different mud system, with these candidate weights:

  • 8.5 ppg: light water-based mud
  • 10.5 ppg: standard
  • 14.0 ppg: high-density invert emulsion

The drilling engineer wants a single chart comparing the static hydrostatic pressure each option would generate from surface to 12,000 ft TVD so they can pick the right system for the expected formation pressure.

Build the comparison:

  1. Create depths, a NumPy array of 13 evenly spaced depths from 0 to

12,000 ft (so each step is 1,000 ft).

  1. Compute three pressure profiles using P=0.052×MW×TVDP = 0.052 \times MW \times TVD:
  • pressure_8_5 for MW = 8.5 ppg
  • pressure_10_5 for MW = 10.5 ppg
  • pressure_14_0 for MW = 14.0 ppg
  1. Plot all three on a single chart. Depth must be on the **y-axis with the

axis inverted** (petroleum convention, depth increases downward) and pressure on the x-axis.

  1. Label both axes, give the chart a title, and include a legend that

identifies each mud weight.

> Think about it: at 10,000 ft, the spread between the lightest and > heaviest options is over 2,800 psi. Why would a drilling engineer ever > choose the heavier option if the lighter one is already enough to control > the formation?

lightbulbHints (0/4)

Stuck? Reveal hints one at a time — they progress from nudge to near-solution.

codeYour solution
main.py
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.

import numpy as np
import matplotlib.pyplot as plt

depths = np.linspace(0, 12000, 13)

pressure_8_5  = 0.052 *  8.5 * depths
pressure_10_5 = 0.052 * 10.5 * depths
pressure_14_0 = 0.052 * 14.0 * depths

fig, ax = plt.subplots(figsize=(6, 7))
ax.plot(pressure_8_5,  depths, "o-", label="8.5 ppg (light water-based)")
ax.plot(pressure_10_5, depths, "s-", label="10.5 ppg (standard)")
ax.plot(pressure_14_0, depths, "d-", label="14.0 ppg (high-density invert)")

ax.invert_yaxis()
ax.set_xlabel("Hydrostatic pressure (psi)")
ax.set_ylabel("True vertical depth (ft)")
ax.set_title("Pressure-depth profiles for three candidate mud weights")
ax.legend(loc="lower right")
ax.grid(True, alpha=0.3)

plt.tight_layout()
plt.show()

lockCopying code is a Full Access feature.