{ "cells": [ { "cell_type": "markdown", "id": "05-rev-and-u-00", "metadata": {}, "source": [ "[](https://colab.research.google.com/github/BASE-Laboratory/OpenImpala/blob/master/tutorials/05_rev_and_uncertainty.ipynb)\n", "\n", "# Representative Elementary Volume (REV) Convergence\n", "\n", "Tomographic fields of view are finite, so effective transport properties estimated on small subvolumes exhibit both sample-to-sample scatter and systematic finite-size bias. A subvolume of edge length $L$ qualifies as a Representative Elementary Volume (REV) once the ensemble mean $\\langle D_{\\text{eff},ii}(L) \\rangle$ stabilises and the coefficient of variation\n", "\n", "$$\\mathrm{CV}_i(L) = \\frac{\\sigma_{D_{ii}}(L)}{\\mu_{D_{ii}}(L)}$$\n", "\n", "falls below an engineering threshold (typically $5\\%$)." ] }, { "cell_type": "code", "execution_count": 1, "id": "05-rev-and-u-01", "metadata": { "execution": { "iopub.execute_input": "2026-11-18T09:45:14.718799Z", "iopub.status.busy": "2026-11-18T09:45:14.718645Z", "iopub.status.idle": "2026-11-18T09:45:14.724806Z", "shell.execute_reply": "2026-11-18T09:45:14.724063Z" }, "tags": [ "remove-cell" ] }, "outputs": [], "source": [ "import sys\n", "\n", "if \"google.colab\" in sys.modules:\n", " !pip install -q openimpala matplotlib" ] }, { "cell_type": "code", "execution_count": 2, "id": "05-rev-and-u-02", "metadata": { "execution": { "iopub.execute_input": "2026-11-18T09:45:14.726588Z", "iopub.status.busy": "2026-11-18T09:45:14.726391Z", "iopub.status.idle": "2026-11-18T09:45:15.105942Z", "shell.execute_reply": "2026-11-18T09:45:15.104447Z" } }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import openimpala as oi\n", "\n", "plt.rcParams.update({\n", " \"figure.dpi\": 120,\n", " \"axes.spines.top\": False,\n", " \"axes.spines.right\": False,\n", " \"font.size\": 10,\n", "})" ] }, { "cell_type": "markdown", "id": "05-rev-and-u-03", "metadata": {}, "source": [ "## Multi-Scale Subvolume Sampling with `rev_study`\n", "\n", "`oi.rev_study()` draws random cubic subvolumes of edge lengths `sizes` from a parent volume, solves the periodic homogenisation cell problem in $(x, y, z)$ on every realisation, and aggregates directional means and standard deviations. Here we sample $N_s = 5$ realisations at each window size $L \\in \\{16, 24, 36, 48, 64\\}$ voxels across the $100^3$ dataset `oi.datasets.two_phase_stack()` ($h = 0.5\\;\\mu\\mathrm{m}$, $50\\;\\mu\\mathrm{m}$ cube):" ] }, { "cell_type": "code", "execution_count": 3, "id": "05-rev-and-u-04", "metadata": { "execution": { "iopub.execute_input": "2026-11-18T09:45:15.108125Z", "iopub.status.busy": "2026-11-18T09:45:15.107897Z", "iopub.status.idle": "2026-11-18T09:46:40.823986Z", "shell.execute_reply": "2026-11-18T09:46:40.823617Z" } }, "outputs": [ { "data": { "text/html": [ "
| Window L | Mean D_xx | Mean D_yy | Mean D_zz | Mean ± SD (trace/3) |
|---|---|---|---|---|
| 16 | 0.14990 | 0.13849 | 0.11782 | 0.13540 ± 0.04306 |
| 24 | 0.19976 | 0.19891 | 0.16474 | 0.18780 ± 0.04939 |
| 36 | 0.13647 | 0.13674 | 0.14701 | 0.14007 ± 0.02414 |
| 48 | 0.12502 | 0.11160 | 0.11626 | 0.11763 ± 0.00810 |
| 64 | 0.13051 | 0.12933 | 0.12883 | 0.12956 ± 0.00593 |