Python Presets
Learning objectives
- Reproduce five of the course's models in real, runnable Python
- Copy Gassmann, soft-sand, Backus, fluid-and-Vs, and inclusion-model programs that print the course anchors
- Confirm each program reproduces a number you already trust
- Leave the browser for a numerical runtime when a slider is no longer enough
The Same Physics, in Real Code
The Lab runs the kernels in the browser for instant feedback. This section closes the gap to a real numerical runtime by giving you five self-contained Python programs, actual runnable code in numpy, not pseudocode, that reproduce the models you have been driving with sliders. Open one in the Python Playground with a click, download it, or copy it into your own environment; then run it and change it. Each depends only on numpy and matplotlib, prints a small table that reproduces a course anchor exactly, so you can trust it the moment it runs, and closes with its model's natural figure.
Five Programs, Five Anchors
The first is GASSMANN FLUID SUBSTITUTION, the Part 4.2 workflow forward and backward. It takes the soft sand of Part 4, a dry frame of GPa at porosity with quartz grains, saturates it with brine, oil, and gas in turn, and then runs the inverse to prove the round trip is exact. Its anchor is the brine case: forward Gassmann prints GPa, and the inverse recovers GPa to the digit. The second is the SOFT-SAND LINE, the Part 5.2 and 5.3 model: Hertz-Mindlin sets the dry pack at the critical porosity and the modified Hashin-Shtrikman lower bound carries it up in porosity. For quartz at , , and 20 MPa it prints the pack modulus GPa at the critical porosity and GPa at , the same soft-sand line you read off the plot in Part 5. The third is BACKUS AVERAGE AND THOMSEN, the Part 9.2 workflow: it laminates a stiff sand with the Ogbon-1 shale and averages them the exact long-wavelength way into one anisotropic medium. At a fifty-fifty mix it prints Thomsen , , and , the anchor from the layered-earth section. The fourth is BATZLE-WANG FLUIDS AND VS PREDICTION, the Part 3 and Part 7 backbones in one program: brine, gas, and oil at reservoir temperature and pressure, then the Greenberg-Castagna brine lines. Its anchors are the 100,000 ppm brine at 50 degrees and 25 MPa printing GPa, the gas that collapses from 0.061 to 0.008 GPa on the lift to 5 MPa, and the Vs trio at km/s: mudrock 1.845, sandstone 1.959, limestone 1.853. The fifth is INCLUSION MODELS, the Part 6 machinery end to end: Berryman spheroids, DEM embedding pores a pinch at a time, Gassmann, and Xu-White. It prints the DEM ladder for aspect-0.15 pores in calcite, 54.0 down to 10.9 GPa, the pore-type spread , 4.92, and 2.72 km/s at fifteen percent porosity, and the Xu-White clay anchors 3.40, 2.75, and 2.33, then draws the pore-type fan those numbers sit on.
The point of printing anchors is trust. When a program you copied reproduces a number you already worked out in an earlier part, you know the code is faithful, and only then is it safe to change. Move a porosity, add a fluid, laminate three lithologies instead of two, and the program keeps computing correctly because its kernel is the course's kernel.
When the Slider Runs Out
A browser slider is bounded on purpose: it explores a few parameters fast. Real work outgrows it, a hundred wells to substitute, a Monte Carlo over aspect ratios, a whole log to Backus-average bed by bed, and that is when you carry the physics into Python where a loop can run a thousand times. Nothing changes but the scale; the equations are the ones on this page. These five programs are the on-ramp, small enough to read in minutes and correct enough to build on. The next section looks up from the code to the horizon: what the skills you now hold let you do, and where in research and in the wider platform they lead.
References
- Mavko, G., Mukerji, T., & Dvorkin, J. (2009). The Rock Physics Handbook (2nd ed.). Cambridge University Press.
- Avseth, P., Mukerji, T., & Mavko, G. (2005). Quantitative Seismic Interpretation. Cambridge University Press.