Tutorial 03: Implicit Geological Modeling#
Note
This tutorial is available as a Python script examples/03_implicit_modeling.py and an interactive Jupyter notebook examples/notebooks/03_implicit_modeling.ipynb.
This tutorial demonstrates how to build differentiable implicit geological models using Universal Cokriging (Lajaunie et al. 1997).
What You Will Learn#
Define surface contact points and orientation data
Build single-series models with 1 or 2 surfaces
Stack multiple series with ERODE relations
Model fault displacement using
FaultDefinitionVerify end-to-end differentiability with PyTorch autograd
Key Concepts#
Implicit modeling represents geological interfaces as iso-surfaces of a scalar field interpolated from sparse contact points and orientation measurements. The Cokriging formulation jointly honors both data types and supports polynomial drift for regional trends.
Multi-series stacking combines independent interpolations: ERODE lets younger series overwrite older ones, while ONLAP fills only unoccupied regions.
Differentiability means gradients flow from any loss function back through the block model, scalar field, and Cokriging system to the input data — enabling gradient-based inversion of geological parameters.
Code#
import torch
from geobrain.geomodel.implicit import (
ImplicitModel, ImplicitModelConfig,
SeriesDefinition, SurfacePointData, OrientationData,
)
config = ImplicitModelConfig(
extent=(0.0, 1.0, 0.0, 1.0),
resolution=(80, 80),
dtype="float64",
)
sp = SurfacePointData(
coords=torch.tensor([[0.2, 0.55], [0.5, 0.50], [0.8, 0.45]],
dtype=torch.float64),
surface_id=torch.tensor([0, 0, 0]),
)
ori = OrientationData(
coords=torch.tensor([[0.35, 0.52], [0.65, 0.48]], dtype=torch.float64),
gradients=torch.tensor([[0.0, 1.0], [0.0, 1.0]], dtype=torch.float64),
)
model = ImplicitModel(config, series=[SeriesDefinition("strata", sp, ori)])
result = model(soft=True, temperature=50.0)
block = result['block'] # (6400,) soft lithology ids
sf = result['scalar_fields'][0] # (6400,) scalar field
Results#
Fig. 35 Two-layer implicit model from surface points and orientations.#
Fig. 36 Three-layer model with two surfaces.#
Fig. 37 Multi-series stacking with erosion.#
Fig. 38 Fault displacement modeling.#
Fig. 39 Gradient verification: differentiable implicit modeling.#