Tutorial 02: Advanced Geomodeling#
Note
This tutorial is available as a Python script examples/02_geomodel_cosim.py and an interactive Jupyter notebook examples/notebooks/02_geomodel_cosim.ipynb.
This tutorial covers advanced geostatistical techniques: multi-variable co-simulation, Sequential Gaussian Simulation (SGS), and variogram modeling.
What You Will Learn#
Use
CoSimConfigto generate correlated multi-variable fieldsRun unconditional SGS with Simple Kriging and Ordinary Kriging
Perform conditional SGS that honors well data
Build and visualize variogram models with
VariogramModel
Key Concepts#
Co-simulation produces multiple spatially correlated fields that respect inter-variable correlations. SGS visits grid nodes in random order, using kriging to estimate the local mean and variance, then drawing from the conditional distribution. Variograms describe how spatial correlation decays with distance.
Code#
import torch
from geobrain.geomodel import Simulator, CoSimConfig, SimulationConfig
# Co-simulation
corr = torch.tensor([[1.0, 0.7], [0.7, 1.0]])
config = CoSimConfig(
shape=(64, 64, 128),
n_variables=2,
correlation_matrix=corr,
field_names=["phi", "vsand"],
lh=20, lv=5,
seed=2025,
)
sim = Simulator.create("fft_ma")
fields = sim.simulate(config)
# SGS with conditioning
sim_sgs = Simulator.create("sgs", kriging_type="ok")
sim_sgs.set_conditioning(well_values, well_locations)
fields_cond = sim_sgs.simulate(sgs_config)
Results#
Fig. 31 Composite variogram model fitting.#
Fig. 32 SGS unconditional simulation with Simple and Ordinary Kriging.#
Fig. 33 SGS conditional simulation honoring well data.#
Fig. 34 Co-simulated porosity and sand volume fields.#