Python Presets

Part 12, Part 12: The Geomechanics Lab

Learning objectives

  • Take five complete, runnable Python programs, one per pillar of the course
  • Run each to print the Ogbon-1 canon anchors, every value validated with real Python
  • See each draw its natural figure, from the Mohr circle to the subsidence bowl
  • Extend from a checked base: copy into the Python Playground or your own code

The Kernels in Your Own Hands

The reference deck gave you the equations; this section gives you the code. Five self-contained Python programs, numpy for the physics and matplotlib for the figure, each a pillar of the course: the Mohr circle and principal stresses, the stress polygon and mobilized friction, the Kirsch wellbore and mud window, Eaton and Bowers pore pressure, and depletion with the Geertsma subsidence bowl. Each program computes from first principles, prints the Ogbon-1 canon anchors, then draws its natural figure, so you extend from a base that is already checked.

Python PresetsInteractive figure, enable JavaScript to interact.

Every printed number was validated with real Python before shipping, against the same anchors the kernel gate pins: the Mohr program prints sigma_1=34.142\sigma_1 = 34.142 and the invariant trace 40.000; the polygon prints q(0.6)=3.119q(0.6) = 3.119, the floor 42.29 and ceiling 146.90, and the Ogbon-1 point inside at mobilized friction 0.583; the wellbore prints the max hoop 68.70, the breakout 27.83 degrees, and the mud limits 39.70, 40.70, 50.70; the pore-pressure program prints the hydrostatic identity 30.31 at ratio one and Eaton 40.44 at ratio 0.9; and the depletion program prints the stress path 0.6667, the Geertsma ratio 0.4393, and the McGarr magnitude 3.585, with the numeric subsidence bowl matching the closed form exactly. If your extension breaks an anchor, you know before you trust it.

How to Use Them

Open a preset in the Python Playground under Tools and run it right here, or download the file and take it to your own environment. Each is deliberately short and readable, the physics in a few functions with the anchors printed at the top, so it is a starting point rather than a black box. Change the Ogbon-1 state to your own field, add a stress path to the polygon, or extend the mud window with a thermal term; the printed anchors catch a blunder while you build. The programs are the course made executable, and the next section closes the loop: an advisor that reads your problem and points you at the model, the section, and the preset to start from.

References

  • Zoback, M. D. (2007). Reservoir Geomechanics. Cambridge University Press.
  • Harris, C. R., Millman, K. J., van der Walt, S. J., et al. (2020). Array programming with NumPy. Nature, 585, 357-362.

This page is prerendered for SEO and accessibility. The interactive widgets above hydrate on JavaScript load.