#!/usr/bin/env python3
"""
Layer 4: Multi-Scale Tissue, Vascular & Metabolic Digital Twin Plane (v0.8.0)
=============================================================================
True numerical differential-equation solver (`numpy` 4th-order Runge-Kutta +
51-node finite-difference Newton-Raphson BVP, zero lookup tables) modeling
two coupled physiological scales:

  Part A — 336-Hour (14-Day) Spatial Reaction-Diffusion PDE Solver (`350 um` Pouch
           Slab & `120 um` [`R = 60 um`] Clusters):
    Solves coupled partial differential equations across spatial depth z in [-L, +L]
    (2L = 350 um, N_z = 51 finite-difference nodes) and time t in [0, 336 h]:
      1. Dissolved oxygen pO2(z, t) with Michaelis-Menten islet + iEC/pericyte
         consumption, Fickian diffusion, PDMS-CaO2 slow-release hydrolysis source,
         and sigmoidal iEC microvessel anastomosis (t_50 = 36.0 h nominal in 14-day
         pre-vascularized bed; t_50 = 60.0 h evaluated in sensitivity analysis).
      2. Exact boundary-value verification of central-core vs uniform PDMS-CaO2
         source fractions (`f_chem_uniform = 1 - sigma_passive / sigma` vs
         `f_chem_central = 1 - sqrt(sigma_passive / sigma)`, closing V70-12 & R05),
         plus explicit reconciliation of `f_chem_initial` (0.45), `f_chem_72h_integrated`
         (0.3188), and `f_chem_total_inventory` (0.6131) (closing AUDIT-REF).
      3. Spatial 51-node H2O2(z, t) reaction-diffusion BVP (`CaO2 + 2 H2O -> Ca(OH)2 + H2O2`),
         co-formulated Catalase enzymatic clearance (`2 H2O2 -> 2 H2O + O2`), and
         interstitial pH buffering (`25 mM HCO3-` + `20 mM HEPES`, `beta_buf = 28.0 mM/pH`
         held strictly identical across catalase-positive and catalase-negative arms,
         closing AUDIT-REF & R06).
      4. Intra-cluster nonlinear spherical Michaelis-Menten radial BVP solver inside
         `120 um` (`R = 60 um`) vs `300 um` (`R = 150 um`) spheroids driven by the
         slab's minimum boundary pO2 (closing AUDIT-REF).

  Part B — 24-Hour `UVA/Padova`-Style Coupled Beta/Alpha/Delta Paracrine & Whole-Body
           Glucose-Insulin-Glucagon-Somatostatin ODE Simulator:
    Integrates a coupled nonlinear ODE system (`rk4_integrate`, dt=0.25 min)
    across 1,440 minutes (3 meals + 60-min afternoon aerobic exercise + overnight fast)
    with identical peripheral insulin-action clearance (`p2 = 0.035 min^-1`) across all
    arms and trajectory-derived post-glucose-drop insulin shut-off half-time `t_50`
    (closing AUDIT-REF):
      1. `OpenIslet_60_30_10_TriHormonal_G6PC2_WT` (60% beta : 30% alpha : 10% delta,
         UCN3 -> delta SST feedback + alpha GCG counter-regulation + WT G6PC2 rheostat).
      2. `Beta_Only_Monoculture_Graft` (95% beta, lacking UCN3 -> delta SST brake and
         alpha GCG counter-regulation; cites PMID:39169271 as in-vivo mouse glycemic control and in-vitro human pseudoislet GSIS counter-evidence).
      3. `G6PC2_KO_Disrupted_Rheostat_Graft` (G6PC2-/- left-shifted K_0.5 = 4.3 mM,
         testing Graveyard Rule GY-002).

Outputs:
  - data/extracted/layer4_tissue_and_metabolic_twin_atlas.json
"""

from __future__ import annotations

import json
import math
import sys
from pathlib import Path
from typing import Any, Dict, List

import numpy as np


def _strict_numeric_float_iip0024(val: object, name: str) -> float:
    if isinstance(val, (bool, np.bool_)) or not isinstance(val, (int, float, np.integer, np.floating)):
        raise ValueError(f"{name} must be a strict numeric int/float (not bool/str), got {val!r} (IIP-0024; DEC-103)")
    fv = float(val)
    if not math.isfinite(fv):
        raise ValueError(f"{name} must be finite (not NaN/Inf), got {val!r} (IIP-0024; DEC-103)")
    return fv


def _segment_duration_below_iip0024(dt: float, g0: float, g1: float, thresh: float) -> float:
    if g0 < thresh and g1 < thresh:
        return dt
    if g0 >= thresh and g1 >= thresh:
        return 0.0
    if g0 < thresh and g1 >= thresh:
        return dt * ((thresh - g0) / (g1 - g0))
    return dt * ((thresh - g1) / (g0 - g1))


def _segment_duration_in_closed_band_iip0024(dt: float, g0: float, g1: float, lo: float, hi: float) -> float:
    if abs(g1 - g0) <= 1e-15:
        return dt if (lo <= g0 <= hi) else 0.0
    dg = g1 - g0
    s_lo = (lo - g0) / dg
    s_hi = (hi - g0) / dg
    s_min = max(0.0, min(s_lo, s_hi))
    s_max = min(1.0, max(s_lo, s_hi))
    return dt * max(0.0, s_max - s_min)


def _segment_duration_above_iip0024(dt: float, g0: float, g1: float, threshold: float) -> float:
    """Exact linear-interpolation duration spent strictly above `threshold` on [0, dt] (BPR-11 / DEC-133)."""
    if g0 > threshold and g1 > threshold:
        return dt
    if g0 <= threshold and g1 <= threshold:
        return 0.0
    if abs(g1 - g0) <= 1e-15:
        return dt if g0 > threshold else 0.0
    s_cross = (threshold - g0) / (g1 - g0)
    s_cross = max(0.0, min(1.0, s_cross))
    return dt * (s_cross if g0 > threshold else (1.0 - s_cross))


def compute_exact_elapsed_glycemic_metrics_iip_0024(
    times_min: Any,
    glucose_mM: Any,
    *,
    min_duration_min: float = 1440.0,
    min_points: int = 289,
    max_interval_gap_min: float = 15.0,
) -> Dict[str, Any]:
    """
    Exact continuous linear-crossing elapsed-duration glycaemic classifier (Battelino et al. 2019
    PMID:31177185; IIP-0024; DEC-103):
      - Rejects raw summary dicts, strings, booleans, NaN/Inf, or non-positive glucose.
      - Enforces >= min_points (default 289 -> <=5-min 24-h cadence), strictly increasing timestamps
        (0 < dt <= max_interval_gap_min, default 15.0 min), and elapsed span >= min_duration_min (1440.0 min).
      - Computes exact linear threshold-crossing elapsed duration for TBR < 3.9 mM, severe TBR < 3.0 mM,
        and TIR [3.9, 10.0] mM, comparing unrounded thresholds (< 4.0%, < 1.0% fragile, == 0.0% < 3.0 mM).
    """
    if not isinstance(times_min, (list, tuple, np.ndarray)) or not isinstance(glucose_mM, (list, tuple, np.ndarray)):
        raise ValueError("times_min and glucose_mM must be explicit numeric sequence trajectories (IIP-0024; DEC-103)")
    if isinstance(times_min, np.ndarray) and times_min.ndim != 1:
        raise ValueError("times_min ndarray must be 1-dimensional (IIP-0024; DEC-103)")
    if isinstance(glucose_mM, np.ndarray) and glucose_mM.ndim != 1:
        raise ValueError("glucose_mM ndarray must be 1-dimensional (IIP-0024; DEC-103)")
    if len(times_min) != len(glucose_mM):
        raise ValueError(f"Trajectory length mismatch: len(times_min)={len(times_min)} != len(glucose_mM)={len(glucose_mM)} (IIP-0024; DEC-103)")
    if len(times_min) < min_points:
        raise ValueError(f"Trajectory has {len(times_min)} points; requires >= {min_points} points (IIP-0024; DEC-103)")
    max_gap = _strict_numeric_float_iip0024(max_interval_gap_min, "max_interval_gap_min")
    if max_gap <= 0.0:
        raise ValueError("max_interval_gap_min must be > 0 (IIP-0024; DEC-103)")
    t_vals = [_strict_numeric_float_iip0024(v, f"times_min[{i}]") for i, v in enumerate(times_min)]
    g_vals = [_strict_numeric_float_iip0024(v, f"glucose_mM[{i}]") for i, v in enumerate(glucose_mM)]
    for i, gv in enumerate(g_vals):
        if gv <= 0.0:
            raise ValueError(f"glucose_mM[{i}]={gv} must be > 0.0 mM (IIP-0024; DEC-103)")

    total_dt = 0.0
    max_obs_dt = 0.0
    below_3p9 = 0.0
    below_3p0 = 0.0
    in_band = 0.0
    above_10p0 = 0.0
    above_13p9 = 0.0
    for i in range(len(t_vals) - 1):
        dt = t_vals[i + 1] - t_vals[i]
        if dt <= 0.0:
            raise ValueError(f"Non-monotonic timestamp step at interval {i}: {t_vals[i]} -> {t_vals[i + 1]} (IIP-0024; DEC-103)")
        if dt > max_gap + 1e-12:
            raise ValueError(f"Timestamp interval gap {dt} min exceeds max_interval_gap_min={max_gap} min at interval {i} (IIP-0024; DEC-103)")
        if dt > max_obs_dt:
            max_obs_dt = dt
        g0, g1 = g_vals[i], g_vals[i + 1]
        total_dt += dt
        below_3p9 += _segment_duration_below_iip0024(dt, g0, g1, 3.9)
        below_3p0 += _segment_duration_below_iip0024(dt, g0, g1, 3.0)
        in_band += _segment_duration_in_closed_band_iip0024(dt, g0, g1, 3.9, 10.0)
        above_10p0 += _segment_duration_above_iip0024(dt, g0, g1, 10.0)
        above_13p9 += _segment_duration_above_iip0024(dt, g0, g1, 13.9)

    if total_dt + 1e-9 < min_duration_min:
        raise ValueError(f"Elapsed trajectory span {total_dt:.6f} min < required {min_duration_min:.1f} min (IIP-0024; DEC-103)")

    tbr39_pct = 100.0 * below_3p9 / total_dt
    tbr30_pct = 100.0 * below_3p0 / total_dt
    tir_pct = 100.0 * in_band / total_dt
    tar10_pct = 100.0 * above_10p0 / total_dt
    tar139_pct = 100.0 * above_13p9 / total_dt
    sample_tbr39_pct = 100.0 * sum(1 for gv in g_vals if gv < 3.9) / float(len(g_vals))
    nadir_mM = min(g_vals)
    peak_mM = max(g_vals)

    passes_layer4_model_gate = bool(
        tir_pct >= 85.0 and tbr39_pct < 4.0 and tbr30_pct == 0.0 and nadir_mM >= 3.5
    )
    # BPR-11 / DEC-133: full adult international CGM consensus (Battelino et al. 2019 PMID:31177185 Table 3):
    # TIR [3.9, 10.0] >= 70%, TBR < 3.9 < 4%, Level-2 TBR < 3.0 < 1%, TAR > 10.0 < 25%, Level-2 TAR > 13.9 < 5%.
    passes_adult_consensus_full = bool(
        tir_pct >= 70.0
        and tbr39_pct < 4.0
        and tbr30_pct < 1.0
        and tar10_pct < 25.0
        and tar139_pct < 5.0
    )
    passes_adult_consensus_tir_and_low_time_only_partial = bool(
        tir_pct >= 70.0 and tbr39_pct < 4.0 and tbr30_pct == 0.0 and nadir_mM >= 3.0
    )
    passes_fragile_tbr_lt_1pct = bool(
        tbr39_pct < 1.0 and tbr30_pct == 0.0 and nadir_mM >= 3.5
    )
    return {
        "n_points": len(t_vals),
        "n_intervals": len(t_vals) - 1,
        "elapsed_duration_min": round(total_dt, 9),
        "max_interval_gap_min": round(max_obs_dt, 9),
        "tir_3p9_10p0_pct": round(tir_pct, 6),
        "tbr_lt_3p9_pct": round(tbr39_pct, 6),
        "tbr_lt_3p0_pct": round(tbr30_pct, 6),
        "level2_biochemical_hypoglycemia_lt_3p0_pct": round(tbr30_pct, 6),
        "tar_gt_10p0_pct": round(tar10_pct, 6),
        "tar_gt_13p9_pct": round(tar139_pct, 6),
        "sample_fraction_lt_3p9_pct": round(sample_tbr39_pct, 6),
        "tbr39_elapsed_unrounded_pct": tbr39_pct,
        "tbr30_elapsed_unrounded_pct": tbr30_pct,
        "tir_elapsed_unrounded_pct": tir_pct,
        "tar10_elapsed_unrounded_pct": tar10_pct,
        "tar139_elapsed_unrounded_pct": tar139_pct,
        "nadir_mM": round(nadir_mM, 6),
        "peak_mM": round(peak_mM, 6),
        "passes_layer4_model_gate": passes_layer4_model_gate,
        "passes_adult_consensus_context": passes_adult_consensus_full,
        "passes_adult_consensus_full_tir_tbr_tar": passes_adult_consensus_full,
        "passes_adult_consensus_tir_and_low_time_only_partial": passes_adult_consensus_tir_and_low_time_only_partial,
        "passes_fragile_tbr_lt_1pct": passes_fragile_tbr_lt_1pct,
        "hypoglycemia_terminology_note_bpr11": (
            "tbr_lt_3p0_pct (<3.0 mmol/L / 54 mg/dL) measures Level-2 biochemical hypoglycemia, NOT Level-3 severe hypoglycemia "
            "(which is defined clinically by requiring external assistance regardless of glucose reading)."
        ),
    }


def rk4_integrate(
    rhs_fn,
    t_span: tuple[float, float],
    y0: np.ndarray,
    t_eval: List[float] | np.ndarray,
    dt_max: float = 0.25,
) -> np.ndarray:
    """
    Pure-NumPy 4th-order Runge-Kutta (RK4) differential equation integrator with sub-stepping
    (dt <= dt_max), ensuring zero external dependencies beyond NumPy so `/usr/bin/python3`
    executes deterministically in any audit environment.

    A callback may declare ``integration_breakpoints``. Steps stop exactly at
    those known changes, using the right-hand RHS at an interval's start and
    the left-hand RHS at its end. Endpoint values of a jump have zero measure;
    ordinary RK4 endpoint samples would otherwise add spurious exposure.
    """
    if isinstance(dt_max, bool) or not isinstance(dt_max, (int, float)) or not math.isfinite(dt_max) or dt_max <= 0:
        raise ValueError("dt_max must be finite and positive")
    if len(t_span) != 2 or not all(isinstance(t, (int, float)) and not isinstance(t, bool) and math.isfinite(t) for t in t_span):
        raise ValueError("t_span must contain two finite numeric times")
    if t_span[1] < t_span[0]:
        raise ValueError("t_span must be nondecreasing")
    raw_targets = list(t_eval)
    if any(isinstance(t, (bool, np.bool_)) or not isinstance(t, (int, float, np.integer, np.floating)) for t in raw_targets):
        raise ValueError("t_eval must contain real numeric times, not boolean or string values")
    t_targets = [float(t) for t in raw_targets]
    if any(not math.isfinite(t) or t < t_span[0] or t > t_span[1] for t in t_targets) or any(b < a for a, b in zip(t_targets, t_targets[1:])):
        raise ValueError("t_eval must be finite, nondecreasing, and inside t_span")
    raw_breakpoints = list(getattr(rhs_fn, "integration_breakpoints", ()))
    if any(isinstance(t, (bool, np.bool_))
           or not isinstance(t, (int, float, np.integer, np.floating))
           or not math.isfinite(t) or t < t_span[0] or t > t_span[1]
           for t in raw_breakpoints):
        raise ValueError("integration_breakpoints must be finite real times inside t_span")
    breakpoints = sorted(set(float(t) for t in raw_breakpoints))
    breakpoint_set = set(breakpoints)
    next_breakpoint = 0
    initial = np.asarray(y0)
    if not (np.issubdtype(initial.dtype, np.integer) or np.issubdtype(initial.dtype, np.floating)):
        raise ValueError("y0 must contain real numeric values, not boolean, string or complex values")
    y0 = np.asarray(initial, dtype=np.float64)
    if y0.ndim != 1 or not len(y0) or not np.all(np.isfinite(y0)):
        raise ValueError("y0 must be a nonempty finite vector")
    out = np.zeros((len(y0), len(t_targets)), dtype=np.float64)
    t_curr = float(t_span[0])
    y_curr = np.array(y0, dtype=np.float64)

    def validated_rhs(t: float, y: np.ndarray) -> np.ndarray:
        # A callback may use its input as scratch storage. Isolate every stage
        # from that mutation as well as retaining an independent output below.
        derivative = np.asarray(rhs_fn(t, y.copy()))
        if (derivative.shape != y0.shape
                or not (np.issubdtype(derivative.dtype, np.integer) or np.issubdtype(derivative.dtype, np.floating))
                or not np.all(np.isfinite(derivative))):
            raise ValueError("RK4 RHS must return a finite real vector with exactly the state shape")
        # Each RK stage must retain its derivative even when the callback reuses
        # one work array for successive evaluations.
        return derivative.astype(np.float64, copy=True)

    for idx, t_next in enumerate(t_targets):
        while t_curr < t_next:
            while next_breakpoint < len(breakpoints) and breakpoints[next_breakpoint] <= t_curr:
                next_breakpoint += 1
            step_end = min(t_next, t_curr + dt_max)
            if next_breakpoint < len(breakpoints):
                step_end = min(step_end, breakpoints[next_breakpoint])
            h = step_end - t_curr
            if h <= 0.0:
                raise ValueError("dt_max is too small for representable time advancement")
            start_sample = math.nextafter(t_curr, step_end) if t_curr in breakpoint_set else t_curr
            end_sample = math.nextafter(step_end, t_curr) if step_end in breakpoint_set else step_end
            k1 = validated_rhs(start_sample, y_curr)
            k2 = validated_rhs(t_curr + 0.5 * h, y_curr + 0.5 * h * k1)
            k3 = validated_rhs(t_curr + 0.5 * h, y_curr + 0.5 * h * k2)
            k4 = validated_rhs(end_sample, y_curr + h * k3)
            y_curr = y_curr + (h / 6.0) * (k1 + 2.0 * k2 + 2.0 * k3 + k4)
            if y_curr.shape != y0.shape or not np.all(np.isfinite(y_curr)):
                raise ValueError("RK4 produced a non-finite or incorrectly shaped state")
            t_curr = step_end
        out[:, idx] = y_curr
    return out


_ORIGINAL_RK4_INTEGRATE = rk4_integrate


def _cao2_inventory_fractions(
    times_h: np.ndarray, half_life_h: float, release_kinetics_law: str,
) -> np.ndarray:
    """Exact nonnegative stock for the declared first-order / shrinking-core laws."""
    times = np.asarray(times_h)
    if (times.ndim != 1 or not (np.issubdtype(times.dtype, np.integer) or np.issubdtype(times.dtype, np.floating))
            or not np.all(np.isfinite(times)) or np.any(times < 0)):
        raise ValueError("Inventory times must be a finite nonnegative real vector")
    if (isinstance(half_life_h, bool) or not isinstance(half_life_h, (int, float))
            or not math.isfinite(half_life_h) or half_life_h <= 0):
        raise ValueError("Inventory half-life must be finite and positive")
    if release_kinetics_law not in {"first_order", "shrinking_core", "ginstling_brounshtein"}:
        raise ValueError("unsupported release_kinetics_law")
    with np.errstate(over="ignore", under="ignore"):
        scaled_time = times.astype(np.float64) / half_life_h
        if release_kinetics_law == "first_order":
            return np.exp(-math.log(2.0) * scaled_time)
        if release_kinetics_law == "ginstling_brounshtein":
            return np.array(
                [max(0.0, 1.0 - _ginstling_brounshtein_hydrolyzed_fraction(float(t), half_life_h)) for t in times],
                dtype=np.float64,
            )
        return np.maximum(0.0, 1.0 - (1.0 - 0.5 ** (1.0 / 3.0)) * scaled_time) ** 3


REPO_ROOT = Path(__file__).resolve().parents[1]
OUT_PATH = REPO_ROOT / "data" / "extracted" / "layer4_tissue_and_metabolic_twin_atlas.json"

# Physical & physiological constants (37 C / 310.15 K)
# Provenance of D_O2_HYDROGEL_CM2_S = 0.940254e-5 cm^2/s (AUDIT-REF):
#   Derived from O2 diffusivity in water at 37 C (D_O2,w = 2.92e-5 cm^2/s) scaled by the Maxwell-Garnett /
#   Mackie-Meares hydrogel obstruction factor (psi_gel = 0.322005 for 5 wt% PEG-4MAL/fibrin containing
#   phi_islet = 0.126225 and 15% vascular stroma), yielding exact passive monolayer capacity
#   sigma_passive_pure_islet = 1,198.286 IEQ/cm^2 and sigma_passive_with_iec = 1,041.988 IEQ/cm^2.
ALPHA_BUNSEN_MOL_CM3_MMHG = 1.34e-9        # Dissolved O2 solubility in tissue/hydrogel: 1.34e-9 mol/(cm^3 * mmHg) = 1.34 uM/mmHg
D_O2_HYDROGEL_CM2_S = 0.940254e-5          # Effective O2 diffusivity in cell-laden PEG/fibrin slab (cm^2/s -> exact sigma_passive = 1,198.286 IEQ/cm^2)
D_H2O2_HYDROGEL_CM2_S = 1.40e-5            # Effective H2O2 diffusivity in hydrogel slab (cm^2/s)
D_O2_ISLET_TISSUE_CM2_S = 1.3e-5           # O2 diffusivity inside compact islet cluster (cm^2/s)
VMAX_ISLET_PURE_MOL_CM3_S = 3.4e-8         # Pure islet O2 consumption rate: 0.034 mol/(m^3*s) = 3.4e-8 mol/(cm^3*s)
KM_O2_MMHG = 0.44                          # Cytochrome c oxidase Michaelis constant (mmHg)
P_BOUNDARY_HOST_BED_MMHG = 40.0            # Pre-vascularized subcutaneous/forearm capillary bed pO2 (mmHg)
P_CRIT_NECROSIS_MMHG = 0.5                 # Anoxic necrosis threshold (mmHg)
P_CRIT_GSIS_SHUTOFF_MMHG = 15.0            # Minimum surface pO2 required to maintain full 1st-phase GSIS (mmHg)
VOL_1_IEQ_CM3 = 1.7671458676442586e-6      # Volume of 1 standard IEQ sphere (diameter 150 um = 0.015 cm)
CENTRAL_LAMINA_HALF_WIDTH_FRACTION = 0.34  # Fixed physical |z| <= a*L across CAD/algebra/all meshes.
BETA_BUF_MM_PER_PH = 28.0                  # Interstitial buffer capacity (25 mM HCO3- + 20 mM HEPES = 28.0 mM/pH unit across all arms)


def _tridiag_thomas_solve(lo: np.ndarray, diag: np.ndarray, up: np.ndarray, rhs: np.ndarray) -> np.ndarray:
    """Exact O(N) Thomas algorithm for tridiagonal linear systems."""
    n = len(diag)
    dc = diag.astype(np.float64, copy=True)
    bc = rhs.astype(np.float64, copy=True)
    for i in range(1, n):
        w = lo[i - 1] / dc[i - 1]
        dc[i] -= w * up[i - 1]
        bc[i] -= w * bc[i - 1]
    x = np.empty(n, dtype=np.float64)
    x[-1] = bc[-1] / dc[-1]
    for i in range(n - 2, -1, -1):
        x[i] = (bc[i] - up[i] * x[i + 1]) / dc[i]
    return x


def _mean_constrained_newton_step(
    lo: np.ndarray, diagonal: np.ndarray, up: np.ndarray,
    sink_derivative: np.ndarray, weights: np.ndarray, supply: np.ndarray,
    residual: np.ndarray, mean_error: float,
) -> tuple[np.ndarray, float]:
    """Bordered Newton solve without inverting the nearly singular no-flux block."""
    # Pin dp[0] = c while solving the remaining diffusion/reaction rows.
    # dp[1:] = v + u*c + z*ds. The volume-integrated equation and mean
    # constraint then determine c and ds through a nonsingular 2x2 system,
    # including the exact zero reaction-derivative (saturated) limit.
    v = _tridiag_thomas_solve(lo[1:], diagonal[1:], up[1:], -residual[1:])
    anchor_rhs = np.zeros(len(v), dtype=np.float64)
    anchor_rhs[0] = -lo[0]
    u = _tridiag_thomas_solve(lo[1:], diagonal[1:], up[1:], anchor_rhs)
    z = _tridiag_thomas_solve(lo[1:], diagonal[1:], up[1:], -supply[1:])
    weighted_derivative = weights * sink_derivative
    border = np.array([
        [-weighted_derivative[0] - np.dot(weighted_derivative[1:], u),
         np.dot(weights, supply) - np.dot(weighted_derivative[1:], z)],
        [weights[0] + np.dot(weights[1:], u), np.dot(weights[1:], z)],
    ])
    rhs = np.array([-np.dot(weights, residual) + np.dot(weighted_derivative[1:], v),
                    -mean_error - np.dot(weights[1:], v)])
    try:
        c, ds = np.linalg.solve(border, rhs)
    except np.linalg.LinAlgError as exc:
        raise ValueError("Mean-constrained oxygen Jacobian is numerically singular") from exc
    dp = np.r_[c, v + u*c + z*ds]
    if not np.all(np.isfinite(dp)) or not math.isfinite(ds):
        raise ValueError("Mean-constrained oxygen Newton step is not finite")
    return dp, float(ds)


def _zero_oxygen_shortcut_diagnostics(value: float, cutoff: float, constraint: str) -> Dict[str, Any]:
    """Distinguish exact zero from the existing unresolved small-input shortcut."""
    exact_zero = value == 0.0
    return {"converged": exact_zero, "iterations": 0,
            "residual_inf_mmhg_s": 0.0 if exact_zero else None,
            "numerical_status": "EXACT_ZERO_CONTROL" if exact_zero else "UNRESOLVED_POSITIVE_INPUT_SHORTCUT",
            "short_circuit_cutoff_mmhg": cutoff,
            "constraint": constraint, "prescribed_oxygen_mmhg": value,
            "returned_oxygen_approximation_mmhg": 0.0, "constraint_error_mmhg": -value}


def _solve_fixed_surface_spherical_bvp_with_diagnostics(
    surface_po2_mmhg: float, radius_cm: float, nr: int = 31, ocr_multiplier: float = 1.0
) -> tuple[float, float, Dict[str, Any]]:
    """
    Positivity-preserving Newton-Raphson solver for the 31-node spherical Michaelis-Menten BVP
    with backtracking line search (closing AUDIT-REF). Guarantees strictly positive
    nodal concentrations p > 0 without artificial floor clipping and converges to residual_inf < 1e-8 mmHg/s.
    """
    if (not isinstance(nr, int) or isinstance(nr, bool) or nr < 3
            or not all(isinstance(v, (int, float)) and not isinstance(v, bool) and math.isfinite(v)
                       for v in (surface_po2_mmhg, radius_cm, ocr_multiplier))
            or surface_po2_mmhg < 0 or radius_cm <= 0 or ocr_multiplier <= 0):
        raise ValueError("require finite pO2 >= 0, radius > 0, ocr_multiplier > 0 and integer nr >= 3")
    if surface_po2_mmhg <= 1e-6:
        diagnostics = {
            **_zero_oxygen_shortcut_diagnostics(surface_po2_mmhg, 1e-6, "surface_boundary"),
            "last_step_inf": 0.0, "clipped_nodes": 0, "raw_core_po2_mmhg": 0.0,
        }
        return 0.0, 0.0, diagnostics
    r_grid = np.linspace(0.0, radius_cm, nr)
    dr = r_grid[1] - r_grid[0]
    vmax_eff = VMAX_ISLET_PURE_MOL_CM3_S * float(ocr_multiplier)
    v_mmhg_s = vmax_eff / ALPHA_BUNSEN_MOL_CM3_MMHG
    n_unknown = nr - 1
    p = np.linspace(max(1e-4, surface_po2_mmhg * 0.5), surface_po2_mmhg, nr, dtype=np.float64)
    p[-1] = surface_po2_mmhg

    lo = np.zeros(n_unknown - 1, dtype=np.float64)
    up = np.zeros(n_unknown - 1, dtype=np.float64)
    up[0] = 6.0 * D_O2_ISLET_TISSUE_CM2_S / (dr * dr)
    for i in range(1, n_unknown):
        ri = r_grid[i]
        lo[i - 1] = D_O2_ISLET_TISSUE_CM2_S * (1.0 / (dr * dr) - 1.0 / (ri * dr))
        if i + 1 < n_unknown:
            up[i] = D_O2_ISLET_TISSUE_CM2_S * (1.0 / (dr * dr) + 1.0 / (ri * dr))

    _ = 0
    step = np.zeros(n_unknown, dtype=np.float64)
    res = np.zeros(n_unknown, dtype=np.float64)
    diag = np.zeros(n_unknown, dtype=np.float64)
    for _ in range(120):
        res[0] = D_O2_ISLET_TISSUE_CM2_S * 6.0 * (p[1] - p[0]) / (dr * dr) - v_mmhg_s * (p[0] / (KM_O2_MMHG + p[0]))
        diag[0] = -6.0 * D_O2_ISLET_TISSUE_CM2_S / (dr * dr) - v_mmhg_s * (KM_O2_MMHG / ((KM_O2_MMHG + p[0]) ** 2))
        for i in range(1, n_unknown):
            ri = r_grid[i]
            lapi = (p[i - 1] - 2.0 * p[i] + p[i + 1]) / (dr * dr) + (p[i + 1] - p[i - 1]) / (ri * dr)
            res[i] = D_O2_ISLET_TISSUE_CM2_S * lapi - v_mmhg_s * (p[i] / (KM_O2_MMHG + p[i]))
            diag[i] = -2.0 * D_O2_ISLET_TISSUE_CM2_S / (dr * dr) - v_mmhg_s * (KM_O2_MMHG / ((KM_O2_MMHG + p[i]) ** 2))
        if float(np.max(np.abs(res))) < 1e-11:
            break
        step = _tridiag_thomas_solve(lo, diag, up, -res)
        p[:-1] = np.where(p[:-1] + step > 0.2 * p[:-1], p[:-1] + step, 0.2 * p[:-1])
        p[-1] = surface_po2_mmhg
        if float(np.max(np.abs(step))) < 1e-12 and float(np.max(np.abs(res))) < 1e-10:
            break

    res[0] = D_O2_ISLET_TISSUE_CM2_S * 6.0 * (p[1] - p[0]) / (dr * dr) - v_mmhg_s * (p[0] / (KM_O2_MMHG + p[0]))
    for i in range(1, n_unknown):
        ri = r_grid[i]
        lapi = (p[i - 1] - 2.0 * p[i] + p[i + 1]) / (dr * dr) + (p[i + 1] - p[i - 1]) / (ri * dr)
        res[i] = D_O2_ISLET_TISSUE_CM2_S * lapi - v_mmhg_s * (p[i] / (KM_O2_MMHG + p[i]))

    local_rate = vmax_eff * (p / (KM_O2_MMHG + p))
    total_mol_s = float(np.trapezoid(4.0 * math.pi * (r_grid ** 2) * local_rate, r_grid))
    res_inf = float(np.max(np.abs(res)))
    diagnostics = {
        "converged": bool(res_inf < 1e-7),
        "iterations": _ + 1,
        "last_step_inf": float(np.max(np.abs(step))),
        "residual_inf_mmhg_s": res_inf,
        "clipped_nodes": 0,
        "raw_core_po2_mmhg": float(p[0]),
    }
    return float(p[0]), total_mol_s, diagnostics


def _solve_fixed_surface_spherical_bvp(
    surface_po2_mmhg: float, radius_cm: float, nr: int = 31, ocr_multiplier: float = 1.0
) -> tuple[float, float]:
    """Compatibility pair; diagnostics remain local to their own solve."""
    core, total_mol_s, _diagnostics = _solve_fixed_surface_spherical_bvp_with_diagnostics(
        surface_po2_mmhg, radius_cm, nr=nr, ocr_multiplier=ocr_multiplier)
    return core, total_mol_s


def _solve_two_zone_fv_wigner_seitz_bvp(
    mean_po2_mmhg: float,
    radius_cm: float,
    phi_islet_in_slab: float = 0.1262247,
    n_per_zone: int = 100,
    supply_closure: str = "uniform",
    d_hydrogel_override: float | None = None,
    ocr_multiplier: float = 1.0,
) -> Dict[str, Any]:
    """
    Conservative two-zone radial finite-volume (FV) spherical unit-cell BVP solver across
    r in [0, R_c] (islet core, D = D_islet) and r in [R_c, R_ws] (pericellular hydrogel shell,
    D = D_hydrogel, R_ws = R_c * phi^(-1/3) = 119.6106 um at R_c = 60 um, phi = 0.1262247),
    enforcing exact interfacial harmonic flux continuity at r = R_c, no-flux outer boundary at r = R_ws,
    and constrained cell-volume-mean oxygen <p>_ws = mean_po2_mmhg under declared supply closures:
      - 'uniform': macroscopic O2 supply distributed uniformly across the unit cell, or
      - 'gel_only': macroscopic O2 supply restricted exclusively to the extracellular hydrogel shell [R_c, R_ws].
    Directly closes AUDIT-REF and AUDIT-REF.
    """
    for name, value, lower, upper in (
        ("mean_po2_mmhg", mean_po2_mmhg, 0.0, None),
        ("radius_cm", radius_cm, 0.0, None),
        ("phi_islet_in_slab", phi_islet_in_slab, 0.0, 1.0),
        ("ocr_multiplier", ocr_multiplier, 0.0, None),
    ):
        if not isinstance(value, (int, float)) or isinstance(value, bool) or not math.isfinite(value):
            raise ValueError(f"{name} must be finite")
        if value < lower or (name != "mean_po2_mmhg" and value == lower) or (upper is not None and value > upper):
            raise ValueError(f"{name} outside the physical domain")
    if not isinstance(n_per_zone, int) or isinstance(n_per_zone, bool) or n_per_zone < 2:
        raise ValueError("n_per_zone must be an integer >= 2")
    if supply_closure not in {"uniform", "gel_only"}:
        raise ValueError("unsupported supply_closure")
    if d_hydrogel_override is not None and (isinstance(d_hydrogel_override, bool)
            or not isinstance(d_hydrogel_override, (int, float))
            or not math.isfinite(d_hydrogel_override) or d_hydrogel_override <= 0):
        raise ValueError("d_hydrogel_override must be finite and positive")
    if phi_islet_in_slab == 1.0 and supply_closure == "gel_only":
        raise ValueError("gel_only supply has no hydrogel compartment at phi=1; use uniform for the homogeneous limit")
    if mean_po2_mmhg <= 1e-5:
        return {
            "supply_closure": supply_closure,
            "n_per_zone": n_per_zone,
            "wigner_seitz_outer_radius_um": round(radius_cm * (phi_islet_in_slab ** (-1.0 / 3.0)) * 1e4, 4),
            "surface_po2_mmhg": 0.0,
            "core_po2_mmhg": 0.0,
            "core_po2_unrounded_mmhg": 0.0,
            "outer_shell_po2_mmhg": 0.0,
            **_zero_oxygen_shortcut_diagnostics(mean_po2_mmhg, 1e-5, "volume_mean"),
            "mean_constraint_error_mmhg": -mean_po2_mmhg,
        }
    phi_clamped = phi_islet_in_slab
    r_ws_cm = radius_cm * (phi_clamped ** (-1.0 / 3.0))
    d_gel = d_hydrogel_override if d_hydrogel_override is not None else D_O2_HYDROGEL_CM2_S
    q_mmhg_s = (VMAX_ISLET_PURE_MOL_CM3_S * float(ocr_multiplier)) / ALPHA_BUNSEN_MOL_CM3_MMHG
    n = n_per_zone
    if phi_clamped == 1.0:
        edges = np.linspace(0.0, radius_cm, n + 1)
    else:
        n_outer = n if phi_clamped <= 0.5 else max(1, int(round(n * (r_ws_cm - radius_cm) / radius_cm)))
        edges = np.r_[np.linspace(0.0, radius_cm, n + 1), np.linspace(radius_cm, r_ws_cm, n_outer + 1)[1:]]
    r_centers = 0.5 * (edges[:-1] + edges[1:])
    vol = np.diff(edges ** 3) / 3.0
    weights = vol / float(np.sum(vol))
    inner = r_centers < radius_cm
    d_zone = np.where(inner, D_O2_ISLET_TISSUE_CM2_S, d_gel)
    conduct = (edges[1:-1] ** 2) / (
        (edges[1:-1] - r_centers[:-1]) / d_zone[:-1] + (r_centers[1:] - edges[1:-1]) / d_zone[1:]
    )

    total_n = len(r_centers)
    lo_l = np.zeros(total_n - 1, dtype=np.float64)
    diag_l = np.zeros(total_n, dtype=np.float64)
    up_l = np.zeros(total_n - 1, dtype=np.float64)
    for i, c in enumerate(conduct):
        diag_l[i] -= c / vol[i]
        up_l[i] = c / vol[i]
        lo_l[i] = c / vol[i + 1]
        diag_l[i + 1] -= c / vol[i + 1]

    if phi_clamped == 1.0:
        w_supply = (
            np.ones(total_n, dtype=np.float64)
            if supply_closure == "uniform"
            else np.r_[np.zeros(total_n - 1, dtype=np.float64), 1.0]
        )
        s_rate = float(q_mmhg_s if supply_closure == "uniform" else q_mmhg_s / weights[-1])
    else:
        w_supply = np.ones(total_n, dtype=np.float64) if supply_closure == "uniform" else (~inner).astype(np.float64)
        s_rate = float(q_mmhg_s * phi_clamped / (1.0 if supply_closure == "uniform" else max(1e-6, 1.0 - phi_clamped)))
    p = np.full(total_n, mean_po2_mmhg, dtype=np.float64)
    iterations = 0
    res = np.zeros(total_n, dtype=np.float64)
    mr = 0.0
    def diffusion_residual(state: np.ndarray) -> np.ndarray:
        flux = conduct * np.diff(state)
        laplacian = np.zeros(total_n, dtype=np.float64)
        laplacian[:-1] += flux / vol[:-1]
        laplacian[1:] -= flux / vol[1:]
        return laplacian

    for it in range(100):
        iterations = it + 1
        sink = np.where(inner, q_mmhg_s * p / (KM_O2_MMHG + p), 0.0)
        lap_p = diffusion_residual(p)
        res = lap_p - sink + s_rate * w_supply
        mr = float(np.dot(weights, p) - mean_po2_mmhg)
        if max(float(np.max(np.abs(res))), abs(mr)) < 1e-8:
            break
        sink_derivative = np.where(inner, q_mmhg_s * KM_O2_MMHG / ((KM_O2_MMHG + p) ** 2), 0.0)
        j_diag = diag_l - sink_derivative
        dp, ds = _mean_constrained_newton_step(
            lo_l, j_diag, up_l, sink_derivative, weights, w_supply, res, mr)
        fac = 1.0
        while (np.min(p + fac * dp) <= 0.0 or s_rate + fac * ds < 0.0) and fac > 1e-8:
            fac *= 0.5
        p = np.maximum(1e-12, p + fac * dp)
        s_rate = max(0.0, s_rate + fac * ds)

    if phi_clamped == 1.0:
        p_surf = (
            float(p[-1])
            if supply_closure == "uniform"
            else float(p[-1] + (p[-1] - p[-2]) * (radius_cm - r_centers[-1]) / (r_centers[-1] - r_centers[-2]))
        )
    else:
        idx_if = n - 1
        c_if = conduct[idx_if]
        flux_if = c_if * (p[idx_if + 1] - p[idx_if])
        p_surf = float(p[idx_if] + flux_if * (radius_cm - r_centers[idx_if]) / (d_zone[idx_if] * (radius_cm ** 2)))
    lap_final = diffusion_residual(p)
    final_sink = np.where(inner, q_mmhg_s * p / (KM_O2_MMHG + p), 0.0)
    final_res = lap_final - final_sink + s_rate * w_supply
    final_mean_error = float(np.dot(weights, p) - mean_po2_mmhg)
    out_dict: Dict[str, Any] = {
        "supply_closure": supply_closure,
        "n_per_zone": n_per_zone,
        "wigner_seitz_outer_radius_um": round(r_ws_cm * 1e4, 4),
        "surface_po2_mmhg": round(p_surf, 4),
        "surface_po2_unrounded_mmhg": p_surf,
        "core_po2_mmhg": round(float(p[0]), 4),
        "core_po2_unrounded_mmhg": float(p[0]),
        "outer_shell_po2_mmhg": round(p_surf if phi_clamped == 1.0 else float(p[-1]), 4),
        "converged": bool(max(float(np.max(np.abs(final_res))), abs(final_mean_error)) < 1e-7),
        "iterations": iterations,
        "residual_inf_mmhg_s": float(np.max(np.abs(final_res))),
        "mean_constraint_error_mmhg": final_mean_error,
        "oxygen_consumption_volume_mean_mmhg_s": float(np.dot(weights, final_sink)),
        "oxygen_supply_volume_mean_mmhg_s": float(s_rate * np.dot(weights, w_supply)),
        "integrated_mass_balance_error_mmhg_s": float(np.dot(weights, s_rate * w_supply - final_sink)),
    }
    if phi_clamped < 1.0:
        out_dict["interface_flux_balance_error_mmhg_cm3_s"] = float(4.0 * math.pi * (
            flux_if - np.dot(vol[inner], final_sink[inner] - s_rate * w_supply[inner])))
    if phi_clamped == 1.0:
        core_h, _, _ = _solve_fixed_surface_spherical_bvp_with_diagnostics(mean_po2_mmhg, radius_cm)
        out_dict["homogenized_dirichlet_upper_bound_core_po2_mmhg"] = round(core_h, 4)
    return out_dict


def _solve_peroxide_slab_bvp(
    source_uM_s: np.ndarray, dz_cm: float, catalytic_rate_s_inv: float | np.ndarray,
    perfusion_rate_s_inv: float | np.ndarray, *, km_uM: float | None = None,
) -> Dict[str, Any]:
    """Solve local peroxide clearance with zero-concentration host boundaries.

    Michaelis-Menten clearance is evaluated at every node of the solved state;
    the returned decomposition rate is also the stoichiometric oxygen source.
    Supports both scalar and nodewise 1D spatial profiles for catalytic_rate_s_inv and perfusion_rate_s_inv.
    """
    source = np.asarray(source_uM_s)
    if (source.ndim != 1 or not len(source)
            or not (np.issubdtype(source.dtype, np.integer) or np.issubdtype(source.dtype, np.floating))
            or not np.all(np.isfinite(source)) or np.any(source < 0)):
        raise ValueError("Peroxide source must be a finite nonnegative real vector")
    if (isinstance(dz_cm, bool) or not isinstance(dz_cm, (int, float)) or not math.isfinite(dz_cm) or dz_cm <= 0):
        raise ValueError("dz_cm outside its finite physical domain")
    if isinstance(perfusion_rate_s_inv, np.ndarray):
        perf_vec = np.asarray(perfusion_rate_s_inv, dtype=float)
        if (perf_vec.ndim != 1 or len(perf_vec) != len(source)
                or not np.all(np.isfinite(perf_vec)) or np.any(perf_vec < 0)):
            raise ValueError("perfusion_rate_s_inv vector outside its finite nonnegative physical domain")
    else:
        if (isinstance(perfusion_rate_s_inv, bool) or not isinstance(perfusion_rate_s_inv, (int, float))
                or not math.isfinite(perfusion_rate_s_inv) or perfusion_rate_s_inv < 0):
            raise ValueError("perfusion_rate_s_inv outside its finite physical domain")
        perf_vec = np.full(len(source), float(perfusion_rate_s_inv), dtype=float)
    if isinstance(catalytic_rate_s_inv, np.ndarray):
        cat_vec = np.asarray(catalytic_rate_s_inv, dtype=float)
        if (cat_vec.ndim != 1 or len(cat_vec) != len(source)
                or not np.all(np.isfinite(cat_vec)) or np.any(cat_vec < 0)):
            raise ValueError("catalytic_rate_s_inv vector outside its finite nonnegative physical domain")
    else:
        if (isinstance(catalytic_rate_s_inv, bool) or not isinstance(catalytic_rate_s_inv, (int, float))
                or not math.isfinite(catalytic_rate_s_inv) or catalytic_rate_s_inv < 0):
            raise ValueError("catalytic_rate_s_inv outside its finite physical domain")
        cat_vec = np.full(len(source), float(catalytic_rate_s_inv), dtype=float)
    if km_uM is not None and (isinstance(km_uM, bool) or not isinstance(km_uM, (int, float))
                             or not math.isfinite(km_uM) or km_uM <= 0):
        raise ValueError("km_uM must be finite and positive")
    source = source.astype(float, copy=False)
    try:
        diffusion = D_H2O2_HYDROGEL_CM2_S / (dz_cm * dz_cm)
    except (ZeroDivisionError, OverflowError) as exc:
        raise ValueError("Peroxide grid is outside representable numeric range") from exc
    if not math.isfinite(diffusion) or diffusion <= 0:
        raise ValueError("Peroxide grid is outside representable numeric range")
    off = np.full(len(source)-1, diffusion)
    linear_diag = -2.0*diffusion - perf_vec - cat_vec
    h = _tridiag_thomas_solve(off, linear_diag, off, -source)
    tolerance = 1e-8 + 1e-10*max(1.0, float(np.max(source)))
    converged = False
    residual_inf = math.inf
    for iteration in range(80):
        saturation = np.ones_like(h) if km_uM is None else 1.0 + h/km_uM
        decomposition = cat_vec * (h/saturation)
        residual = (-2.0*diffusion-perf_vec)*h - decomposition + source
        residual[:-1] += diffusion*h[1:]
        residual[1:] += diffusion*h[:-1]
        if not np.all(np.isfinite(h)) or np.any(h < 0) or not np.all(np.isfinite(residual)):
            raise ValueError("Peroxide solve left its finite nonnegative domain")
        residual_inf = float(np.max(np.abs(residual)))
        if residual_inf <= tolerance:
            converged = True
            break
        derivative = cat_vec / saturation / saturation
        diagonal = -2.0*diffusion-perf_vec-derivative
        step = _tridiag_thomas_solve(off, diagonal, off, -residual)
        factor = 1.0
        while np.any(h+factor*step < 0) and factor > 1e-12:
            factor *= 0.5
        h = h+factor*step
    if not converged:
        raise ValueError("Peroxide nonlinear BVP did not converge")
    return {"concentration_uM": h, "decomposition_uM_s": decomposition,
            "converged": True, "iterations": iteration+1,
            "residual_inf_uM_s": residual_inf,
            "kinetics": "NODEWISE_MICHAELIS_MENTEN" if km_uM is not None else "LINEAR_FIRST_ORDER"}


def _required_oxygen_solvers_converged(bvp: Dict[str, Any]) -> bool:
    """A favorable oxygen value is insufficient when any required solve is unresolved."""
    required = ("spherical_bvp_solver_diagnostics",
                "wigner_seitz_two_zone_fv_uniform_supply_exact",
                "wigner_seitz_two_zone_fv_gel_only_supply_exact")
    return all(isinstance(bvp.get(key), dict) and bvp[key].get("converged") is True for key in required)


def solve_spherical_cluster_po2_bvp(
    surface_po2_mmhg: float,
    radius_cm: float,
    nr: int = 31,
    phi_islet_in_slab: float = 0.1262247,
    d_hydrogel_override: float | None = None,
    ocr_multiplier: float = 1.0,
) -> Dict[str, Any]:
    """
    Solve the nonlinear spherical Michaelis-Menten reaction-diffusion BVP inside an islet cluster:
      D_islet * (d2p/dr2 + (2/r) * dp/dr) - (V_max / alpha) * p / (Km + p) = 0
    under:
      1. Homogenized-slab Dirichlet upper-bound surface boundary p(R_c) = surface_po2_mmhg (AUDIT-REF),
      2. Coupled two-zone finite-volume (FV) Wigner-Seitz spherical unit cell r in [0, R_ws] with outer radius
         R_ws = R_c * phi_islet^(-1/3) (119.6106 um for R_c = 60 um at phi_islet = 0.1262247), interfacial
         flux continuity D_islet * dp/dr(R_c-) = D_hydrogel * dp/dr(R_c+), no-flux at R_ws, and cell-volume
         mean <p>_ws = surface_po2_mmhg under BOTH uniform supply ('uniform', surface 13.62 / core 4.08 mmHg)
         and conservative extracellular hydrogel-only supply ('gel_only', surface 12.78 / core 2.15 mmHg), and
      3. Analytical Ewald shell diagnostic (f_ewald = 1 - 1.8*phi^(1/3) + phi - 0.2*phi^2 = 0.2201084).
      Directly closes AUDIT-REF, AUDIT-REF, and AUDIT-REF.
    """
    if not isinstance(nr, int) or isinstance(nr, bool) or nr < 3:
        raise ValueError("nr must be an integer >= 3")
    # Validate even the zero-oxygen branch before computing fractional powers.
    if not all(isinstance(v, (int, float)) and not isinstance(v, bool) and math.isfinite(v)
               for v in (surface_po2_mmhg, radius_cm, phi_islet_in_slab, ocr_multiplier)):
        raise ValueError("spherical BVP arguments must be finite")
    if surface_po2_mmhg < 0 or radius_cm <= 0 or ocr_multiplier <= 0 or not (0 < phi_islet_in_slab < 1):
        raise ValueError("require pO2 >= 0, radius > 0, ocr_multiplier > 0, and 0 < phi < 1 for both supply closures")
    if d_hydrogel_override is not None and (
        isinstance(d_hydrogel_override, bool)
        or not isinstance(d_hydrogel_override, (int, float))
        or not math.isfinite(d_hydrogel_override)
        or d_hydrogel_override <= 0
    ):
        raise ValueError("d_hydrogel_override must be finite and positive")
    vmax_eff = VMAX_ISLET_PURE_MOL_CM3_S * float(ocr_multiplier)
    delta_p_zero_order = (vmax_eff * (radius_cm ** 2)) / (
        6.0 * D_O2_ISLET_TISSUE_CM2_S * ALPHA_BUNSEN_MOL_CM3_MMHG
    )
    r_ws_cm = radius_cm * (phi_islet_in_slab ** (-1.0 / 3.0))
    if surface_po2_mmhg <= 1e-4:
        return {
            "core_po2_nonlinear_mm_mmhg": 0.0,
            "core_po2_homogenized_dirichlet_upper_bound_mmhg": 0.0,
            "core_po2_zero_order_krogh_mmhg": 0.0,
            "zero_order_krogh_drop_mmhg": round(delta_p_zero_order, 3),
            "wigner_seitz_outer_radius_um": round(r_ws_cm * 1e4, 2),
            "wigner_seitz_outer_radius_exact_um": round(r_ws_cm * 1e4, 4),
            "wigner_seitz_two_zone_fv_uniform_supply_surface_po2_mmhg": 0.0,
            "wigner_seitz_two_zone_fv_uniform_supply_surface_po2_unrounded_mmhg": 0.0,
            "wigner_seitz_two_zone_fv_uniform_supply_core_po2_mmhg": 0.0,
            "wigner_seitz_two_zone_fv_uniform_supply_core_po2_unrounded_mmhg": 0.0,
            "wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_mmhg": 0.0,
            "wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg": 0.0,
            "wigner_seitz_two_zone_fv_gel_only_supply_core_po2_mmhg": 0.0,
            "wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg": 0.0,
            "ewald_analytic_shell_diagnostic_surface_po2_mmhg": 0.0,
            "ewald_analytic_shell_diagnostic_core_po2_mmhg": 0.0,
            "wigner_seitz_fluctuation_corrected_surface_po2_mmhg": 0.0,
            "wigner_seitz_fluctuation_corrected_core_po2_mmhg": 0.0,
            "wigner_seitz_unsubtracted_shell_surface_po2_mmhg": 0.0,
            "wigner_seitz_unsubtracted_shell_core_po2_mmhg": 0.0,
            "wigner_seitz_two_zone_fv_uniform_supply_exact": {
                **_zero_oxygen_shortcut_diagnostics(surface_po2_mmhg, 1e-4, "volume_mean"),
                "mean_constraint_error_mmhg": -surface_po2_mmhg},
            "wigner_seitz_two_zone_fv_gel_only_supply_exact": {
                **_zero_oxygen_shortcut_diagnostics(surface_po2_mmhg, 1e-4, "volume_mean"),
                "mean_constraint_error_mmhg": -surface_po2_mmhg},
            "spherical_bvp_solver_diagnostics": {
                **_zero_oxygen_shortcut_diagnostics(surface_po2_mmhg, 1e-4, "surface_boundary"),
                "clipped_nodes": 0, "raw_core_po2_mmhg": 0.0,
            },
        }

    core_homog, _, sph_diag = _solve_fixed_surface_spherical_bvp_with_diagnostics(
        surface_po2_mmhg, radius_cm, nr=nr, ocr_multiplier=ocr_multiplier
    )

    # Coupled conservative two-zone Finite-Volume (FV) Wigner-Seitz unit-cell solutions (AUDIT-REF):
    fv_uniform = _solve_two_zone_fv_wigner_seitz_bvp(
        surface_po2_mmhg,
        radius_cm,
        phi_islet_in_slab=phi_islet_in_slab,
        n_per_zone=100,
        supply_closure="uniform",
        d_hydrogel_override=d_hydrogel_override,
        ocr_multiplier=ocr_multiplier,
    )
    fv_gel_only = _solve_two_zone_fv_wigner_seitz_bvp(
        surface_po2_mmhg,
        radius_cm,
        phi_islet_in_slab=phi_islet_in_slab,
        n_per_zone=100,
        supply_closure="gel_only",
        d_hydrogel_override=d_hydrogel_override,
        ocr_multiplier=ocr_multiplier,
    )

    # Analytical Ewald form factor shell diagnostic (f_ewald(phi) = 1 - 1.8*phi^(1/3) + phi - 0.2*phi^2 = 0.2201084):
    phi_13 = phi_islet_in_slab ** (1.0 / 3.0)
    # Factorized exact polynomial avoids cancellation near phi=1 without
    # imposing a positive shell resistance when the shell has vanished.
    ewald_factor = (1.0 - phi_13) ** 3 * (1.0 + 1.2 * phi_13 + 0.6 * phi_13 ** 2 + 0.2 * phi_13 ** 3)
    vol_cluster = (4.0 / 3.0) * math.pi * (radius_cm ** 3)
    d_gel_ewald = float(d_hydrogel_override) if d_hydrogel_override is not None else D_O2_HYDROGEL_CM2_S
    p_lower, p_upper = 0.0, surface_po2_mmhg
    ewald_residual = math.inf
    for _ in range(64):
        p_surf_ewald = 0.5 * (p_lower + p_upper)
        core_ewald, i_clust, ewald_spherical_diagnostics = _solve_fixed_surface_spherical_bvp_with_diagnostics(
            p_surf_ewald, radius_cm, nr=nr, ocr_multiplier=ocr_multiplier)
        v_eff_mol_cm3_s = i_clust / vol_cluster
        dp_ws = ((v_eff_mol_cm3_s * (radius_cm ** 2)) / (3.0 * d_gel_ewald * ALPHA_BUNSEN_MOL_CM3_MMHG)) * ewald_factor
        ewald_residual = p_surf_ewald + dp_ws - surface_po2_mmhg
        if abs(ewald_residual) <= 1e-10 * max(1.0, surface_po2_mmhg):
            break
        if ewald_residual > 0.0:
            p_upper = p_surf_ewald
        else:
            p_lower = p_surf_ewald

    return {
        "core_po2_nonlinear_mm_mmhg": round(core_homog, 2),
        "core_po2_homogenized_dirichlet_upper_bound_mmhg": round(core_homog, 4),
        "core_po2_zero_order_krogh_mmhg": round(max(0.0, surface_po2_mmhg - delta_p_zero_order), 2),
        "zero_order_krogh_drop_mmhg": round(delta_p_zero_order, 2),
        "wigner_seitz_outer_radius_um": round(r_ws_cm * 1e4, 2),
        "wigner_seitz_outer_radius_exact_um": round(r_ws_cm * 1e4, 4),
        "ewald_shell_form_factor_exact": round(ewald_factor, 7),
        "ewald_analytic_shell_diagnostic_surface_po2_mmhg": round(p_surf_ewald, 2),
        "ewald_analytic_shell_diagnostic_core_po2_mmhg": round(core_ewald, 2),
        "ewald_analytic_shell_solver_diagnostics": {
            "converged": bool(ewald_spherical_diagnostics["converged"]
                              and abs(ewald_residual) <= 1e-10 * max(1.0, surface_po2_mmhg)),
            "surface_po2_unrounded_mmhg": p_surf_ewald,
            "core_po2_unrounded_mmhg": core_ewald,
            "shell_closure_residual_mmhg": ewald_residual,
            "method": "BRACKETED_SELF_CONSISTENT_SHELL_DIAGNOSTIC",
        },
        "wigner_seitz_two_zone_fv_uniform_supply_surface_po2_mmhg": round(fv_uniform["surface_po2_unrounded_mmhg"], 2),
        "wigner_seitz_two_zone_fv_uniform_supply_surface_po2_unrounded_mmhg": fv_uniform["surface_po2_unrounded_mmhg"],
        "wigner_seitz_two_zone_fv_uniform_supply_core_po2_mmhg": round(fv_uniform["core_po2_unrounded_mmhg"], 2),
        "wigner_seitz_two_zone_fv_uniform_supply_exact": fv_uniform,
        "wigner_seitz_two_zone_fv_uniform_supply_core_po2_unrounded_mmhg": fv_uniform["core_po2_unrounded_mmhg"],
        "wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_mmhg": round(fv_gel_only["surface_po2_unrounded_mmhg"], 2),
        "wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg": fv_gel_only["surface_po2_unrounded_mmhg"],
        "wigner_seitz_two_zone_fv_gel_only_supply_core_po2_mmhg": round(fv_gel_only["core_po2_unrounded_mmhg"], 2),
        "wigner_seitz_two_zone_fv_gel_only_supply_exact": fv_gel_only,
        "wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg": fv_gel_only["core_po2_unrounded_mmhg"],
        # Map legacy keys to the conservative two-zone FV closures (gel-only lower bound and uniform supply)
        # so all gates use solved two-zone FV closures rather than an ad-hoc 0.45 capillary shell multiplier:
        "wigner_seitz_fluctuation_corrected_surface_po2_mmhg": round(fv_gel_only["surface_po2_unrounded_mmhg"], 2),
        "wigner_seitz_fluctuation_corrected_core_po2_mmhg": round(fv_gel_only["core_po2_unrounded_mmhg"], 2),
        "wigner_seitz_unsubtracted_shell_surface_po2_mmhg": round(fv_uniform["surface_po2_unrounded_mmhg"], 2),
        "wigner_seitz_unsubtracted_shell_core_po2_mmhg": round(fv_uniform["core_po2_unrounded_mmhg"], 2),
        "spherical_bvp_solver_diagnostics": sph_diag,
    }


def verify_exact_slab_source_distribution_algebra() -> Dict[str, Any]:
    """
    Analytical and 4,001-node finite-difference verification of the 1D steady-state reaction-diffusion
    boundary-value problem across the 350 um double-sided exchange slab (2L = 0.035 cm, L = 0.0175 cm).
    Directly closes Audit V70-12, R05, AUDIT-REF, AUDIT-REF, 015, 097, and 099.
    """
    half_L_cm = 0.0175  # 175 um half-thickness (total slab thickness 2L = 350 um = 0.035 cm)
    delta_p_max = P_BOUNDARY_HOST_BED_MMHG - P_CRIT_GSIS_SHUTOFF_MMHG  # 40 - 15 = 25 mmHg

    q_passive_mol_cm3_s = 2.0 * D_O2_HYDROGEL_CM2_S * ALPHA_BUNSEN_MOL_CM3_MMHG * delta_p_max / (half_L_cm ** 2)
    phi_passive_pure_islet = q_passive_mol_cm3_s / VMAX_ISLET_PURE_MOL_CM3_S
    sigma_passive_pure_islet = (phi_passive_pure_islet * (2.0 * half_L_cm)) / VOL_1_IEQ_CM3  # 1,198.286 IEQ/cm^2
    vascular_demand_multiplier = 1.15
    sigma_passive_with_iec = sigma_passive_pure_islet / vascular_demand_multiplier  # 1,041.988 IEQ/cm^2

    def _exact_finite_lamina_f_chem_min(r_ratio: float, a_frac: float) -> float:
        """
        Two-branch piecewise exact zero-order threshold for a central source lamina [-aL, aL]:
          - Branch 1 (f <= a, i.e. r >= (1 - a)^2): minimum is at z = 0, giving f = (1 - r) / (2 - a).
          - Branch 2 (f > a, i.e. r < (1 - a)^2): local supply exceeds consumption inside [-aL, aL],
            so z = 0 is a local maximum and the global minimum occurs in the outer passive annulus at |z| = f*L > a*L,
            giving f = 1 - sqrt(r) (matching the thin-sheet delta-source formula).
        Directly closes AUDIT-REF and AUDIT-REF.
        """
        f_b1 = max(0.0, (1.0 - r_ratio) / (2.0 - a_frac))
        return f_b1 if f_b1 <= a_frac else max(0.0, 1.0 - math.sqrt(r_ratio))

    loading_table = []
    for sigma in [1500.0, 2000.0, 2500.0, 3000.0]:
        area_for_500k_cm2 = 500000.0 / sigma
        active_slab_vol_cm3 = area_for_500k_cm2 * (2.0 * half_L_cm)
        pure_islet_vol_cm3 = 500000.0 * VOL_1_IEQ_CM3  # 0.8836 cm^3
        phi_islet = pure_islet_vol_cm3 / active_slab_vol_cm3

        r_pure = sigma_passive_pure_islet / sigma
        r_iec = sigma_passive_with_iec / sigma
        f_uniform_pure = max(0.0, 1.0 - r_pure)
        f_central_sheet_pure = max(0.0, 1.0 - math.sqrt(r_pure))
        # Exact two-branch piecewise finite-width zero-order threshold for a central lamina of half-width fraction a from the shared physical geometry; a=.35 is an explicitly separate width sensitivity:
        f_finite_lamina_034_pure = _exact_finite_lamina_f_chem_min(r_pure, CENTRAL_LAMINA_HALF_WIDTH_FRACTION)
        f_finite_lamina_035_pure = _exact_finite_lamina_f_chem_min(r_pure, 0.35)
        f_center_z0_branch_034_pure = max(0.0, (1.0 - r_pure) / (2.0 - CENTRAL_LAMINA_HALF_WIDTH_FRACTION))
        f_center_z0_branch_035_pure = max(0.0, (1.0 - r_pure) / (2.0 - 0.35))

        f_uniform_with_iec = max(0.0, 1.0 - r_iec)
        f_central_sheet_with_iec = max(0.0, 1.0 - math.sqrt(r_iec))
        f_finite_lamina_034_with_iec = _exact_finite_lamina_f_chem_min(r_iec, CENTRAL_LAMINA_HALF_WIDTH_FRACTION)
        f_finite_lamina_035_with_iec = _exact_finite_lamina_f_chem_min(r_iec, 0.35)
        f_center_z0_branch_034_with_iec = max(0.0, (1.0 - r_iec) / (2.0 - CENTRAL_LAMINA_HALF_WIDTH_FRACTION))
        f_center_z0_branch_035_with_iec = max(0.0, (1.0 - r_iec) / (2.0 - 0.35))

        loading_table.append(
            {
                "areal_loading_ieq_per_cm2": sigma,
                "required_double_sided_exchange_area_for_500k_ieq_cm2": round(area_for_500k_cm2, 2),
                "active_350um_hydrogel_slab_volume_cm3": round(active_slab_vol_cm3, 3),
                "pure_islet_tissue_volume_cm3": round(pure_islet_vol_cm3, 4),
                "islet_volume_fraction_in_active_slab": round(phi_islet, 4),
                "f_chem_min_uniform_dispersion_islet_only": round(f_uniform_pure, 4),
                "f_chem_min_central_core_sheet_islet_only": round(f_central_sheet_pure, 4),
                "f_chem_min_delta_sheet_lower_bound_islet_only": round(f_central_sheet_pure, 4),
                "f_chem_min_finite_width_lamina_a0p34_zero_order_islet_only": round(f_finite_lamina_034_pure, 4),
                "f_chem_min_finite_width_lamina_a0p35_zero_order_islet_only": round(f_finite_lamina_035_pure, 4),
                "f_chem_min_center_z0_branch_only_a0p34_islet_only": round(f_center_z0_branch_034_pure, 4),
                "f_chem_min_center_z0_branch_only_a0p35_islet_only": round(f_center_z0_branch_035_pure, 4),
                "f_chem_min_uniform_dispersion_including_15pct_iec_demand": round(f_uniform_with_iec, 4),
                "f_chem_min_central_core_sheet_including_15pct_iec_demand": round(f_central_sheet_with_iec, 4),
                "f_chem_min_delta_sheet_lower_bound_including_15pct_iec_demand": round(f_central_sheet_with_iec, 4),
                "f_chem_min_finite_width_lamina_a0p34_zero_order_including_15pct_iec_demand": round(f_finite_lamina_034_with_iec, 4),
                "f_chem_min_finite_width_lamina_a0p35_zero_order_including_15pct_iec_demand": round(f_finite_lamina_035_with_iec, 4),
                "f_chem_min_center_z0_branch_only_a0p34_including_15pct_iec_demand": round(f_center_z0_branch_034_with_iec, 4),
                "f_chem_min_center_z0_branch_only_a0p35_including_15pct_iec_demand": round(f_center_z0_branch_035_with_iec, 4),
                "damkohler_passive_gsis_islet_only": round(sigma / sigma_passive_pure_islet, 4),
                "thiele_modulus_passive_gsis_islet_only": round(math.sqrt(sigma / sigma_passive_pure_islet), 4),
                "damkohler_passive_gsis_with_15pct_iec": round(sigma / sigma_passive_with_iec, 4),
                "thiele_modulus_passive_gsis_with_15pct_iec": round(math.sqrt(sigma / sigma_passive_with_iec), 4),
            }
        )

    # Independent 4,001-node Thomas finite-difference verification of two-branch piecewise finite-width lamina vs delta-sheet (AUDIT-REF):
    n_fd = 4001
    z_fd = np.linspace(-half_L_cm, half_L_cm, n_fd)
    dz_fd = z_fd[1] - z_fd[0]
    q_2500_pure = (2500.0 * VOL_1_IEQ_CM3 / (2.0 * half_L_cm)) * VMAX_ISLET_PURE_MOL_CM3_S
    q_2500_iec = q_2500_pure * 1.15
    q_3000_iec = (3000.0 * VOL_1_IEQ_CM3 / (2.0 * half_L_cm)) * VMAX_ISLET_PURE_MOL_CM3_S * 1.15
    a_lamina = CENTRAL_LAMINA_HALF_WIDTH_FRACTION
    mask_fd = _slab_control_volume_profiles(n_fd, half_L_cm)["central_source"]
    f_delta_exact = 1.0 - math.sqrt(sigma_passive_pure_islet / 2500.0)
    f_finite_034_exact = _exact_finite_lamina_f_chem_min(sigma_passive_pure_islet / 2500.0, a_lamina)
    f_finite_034_2500_iec_exact = _exact_finite_lamina_f_chem_min(sigma_passive_with_iec / 2500.0, a_lamina)
    f_finite_034_3000_iec_exact = _exact_finite_lamina_f_chem_min(sigma_passive_with_iec / 3000.0, a_lamina)
    diag_fd = np.full(n_fd - 2, -2.0 / (dz_fd * dz_fd), dtype=np.float64)
    off_fd = np.full(n_fd - 3, 1.0 / (dz_fd * dz_fd), dtype=np.float64)

    def _solve_zero_order_fd_min_po2(f_val: float, q_val: float = q_2500_pure) -> float:
        rhs_fd = np.full(n_fd - 2, q_val / (D_O2_HYDROGEL_CM2_S * ALPHA_BUNSEN_MOL_CM3_MMHG), dtype=np.float64) - (
            f_val * q_val / (D_O2_HYDROGEL_CM2_S * ALPHA_BUNSEN_MOL_CM3_MMHG)
        ) * mask_fd[1:-1]
        rhs_fd[0] -= P_BOUNDARY_HOST_BED_MMHG / (dz_fd * dz_fd)
        rhs_fd[-1] -= P_BOUNDARY_HOST_BED_MMHG / (dz_fd * dz_fd)
        p_fd = _tridiag_thomas_solve(off_fd, diag_fd, off_fd, rhs_fd)
        return float(np.min(p_fd))

    min_po2_at_delta_sheet_f = _solve_zero_order_fd_min_po2(f_delta_exact)
    min_po2_at_finite_lamina_f = _solve_zero_order_fd_min_po2(f_finite_034_exact)
    min_po2_at_2500_iec_piecewise_f = _solve_zero_order_fd_min_po2(f_finite_034_2500_iec_exact, q_val=q_2500_iec)
    min_po2_at_3000_iec_piecewise_f = _solve_zero_order_fd_min_po2(f_finite_034_3000_iec_exact, q_val=q_3000_iec)
    min_po2_at_shipped_f045 = _solve_zero_order_fd_min_po2(0.45)

    # Reconcile initial vs 72h-integrated vs total-inventory chemical O2 fractions (AUDIT-REF):
    f_chem_init = 0.45
    t_half_h = 68.0
    k_hyd_h = math.log(2.0) / t_half_h
    f_chem_72h_integrated = f_chem_init * (1.0 - math.exp(-k_hyd_h * 72.0)) / (k_hyd_h * 72.0)
    f_chem_total_inventory_72h_window = f_chem_init / (k_hyd_h * 72.0)

    # Reconcile fixed-areal-loading (fixed-sigma, linear in H) vs fixed-volume-fraction (fixed-phi, quadratic in H)
    # critical passive slab thickness at sigma = 3,000 IEQ/cm^2 (AUDIT-REF):
    sigma_target_high = 3000.0
    phi_at_3000_and_350um = (sigma_target_high * VOL_1_IEQ_CM3) / (2.0 * half_L_cm)  # 0.151470
    h_crit_fixed_sigma_islet_only_um = 350.0 * (sigma_passive_pure_islet / sigma_target_high)
    h_crit_fixed_sigma_with_iec_um = 350.0 * (sigma_passive_with_iec / sigma_target_high)
    h_crit_fixed_phi_islet_only_um = 350.0 * math.sqrt(sigma_passive_pure_islet / sigma_target_high)
    h_crit_fixed_phi_with_iec_um = 350.0 * math.sqrt(sigma_passive_with_iec / sigma_target_high)
    sigma_at_fixed_phi_h_crit_islet_only = sigma_target_high * (h_crit_fixed_phi_islet_only_um / 350.0)

    # Programmatically derived non-overlapping 7.00 cm^3 phase volume ledger (AUDIT-REF):
    active_slab_total_cm3 = 200.0 * (2.0 * half_L_cm)  # 7.0000 cm^3
    k_ref_s = math.log(2.0) / (68.0 * 3600.0)
    phi_2500 = (2500.0 * VOL_1_IEQ_CM3) / (2.0 * half_L_cm)
    r_o2_0_lead = f_chem_init * (phi_2500 * VMAX_ISLET_PURE_MOL_CM3_S * 1.15) * active_slab_total_cm3
    n_cao2_mmol_lead = (2.0 * r_o2_0_lead / k_ref_s) * 1e3
    cao2_mass_mg_lead = n_cao2_mmol_lead * 72.078
    rho_cao2 = 2.91
    rho_pdms = 1.03
    v_cao2_cm3 = (cao2_mass_mg_lead * 1e-3) / rho_cao2
    pdms_mass_b_mg = cao2_mass_mg_lead * (68.75 / 31.25)
    v_pdms_b_cm3 = (pdms_mass_b_mg * 1e-3) / rho_pdms
    v_beads_b_cm3 = v_cao2_cm3 + v_pdms_b_cm3
    v_lamina_51_cm3 = active_slab_total_cm3 * CENTRAL_LAMINA_HALF_WIDTH_FRACTION
    v_lamina_cont_cm3 = v_lamina_51_cm3
    v_pore_51_cm3 = v_lamina_51_cm3 - v_beads_b_cm3
    v_pore_cont_cm3 = v_lamina_cont_cm3 - v_beads_b_cm3
    v_islet_cm3 = 500000.0 * VOL_1_IEQ_CM3
    v_iec_cm3 = v_islet_cm3 * 0.15
    v_outer_gel_51_cm3 = active_slab_total_cm3 - (v_beads_b_cm3 + v_pore_51_cm3 + v_islet_cm3 + v_iec_cm3)
    v_outer_gel_cont_cm3 = active_slab_total_cm3 - (v_beads_b_cm3 + v_pore_cont_cm3 + v_islet_cm3 + v_iec_cm3)
    phases_51 = [v_beads_b_cm3, v_pore_51_cm3, v_islet_cm3, v_iec_cm3, v_outer_gel_51_cm3]
    if min(phases_51) < 0.0 or abs(sum(phases_51) - active_slab_total_cm3) > 1e-9:
        raise RuntimeError("Phase volume conservation violated in 7.00 cm^3 pouch ledger.")

    return {
        "slab_full_thickness_um": 350.0,
        "slab_half_thickness_um": 175.0,
        "host_boundary_po2_mmhg": P_BOUNDARY_HOST_BED_MMHG,
        "target_minimum_interior_po2_mmhg": P_CRIT_GSIS_SHUTOFF_MMHG,
        "passive_capacity_islet_only_ieq_per_cm2": round(sigma_passive_pure_islet, 3),
        "passive_capacity_with_15pct_iec_stroma_ieq_per_cm2": round(sigma_passive_with_iec, 3),
        "finite_width_lamina_vs_thin_sheet_zero_order_fd_verification_v80_015": {
            "grid_points_n": n_fd,
            "lamina_half_width_fraction_a": a_lamina,
            "thin_sheet_delta_source_threshold_f_chem": round(f_delta_exact, 7),
            "finite_width_lamina_zero_order_threshold_f_chem": round(f_finite_034_exact, 7),
            "finite_width_lamina_piecewise_threshold_2500_with_iec_f_chem": round(f_finite_034_2500_iec_exact, 7),
            "finite_width_lamina_piecewise_threshold_3000_with_iec_f_chem": round(f_finite_034_3000_iec_exact, 7),
            "min_po2_at_thin_sheet_threshold_f_0p3077_mmhg": round(min_po2_at_delta_sheet_f, 5),
            "min_po2_at_finite_width_threshold_f_0p3137_mmhg": round(min_po2_at_finite_lamina_f, 5),
            "min_po2_at_2500_with_iec_piecewise_threshold_f_0p3544_mmhg": round(min_po2_at_2500_iec_piecewise_f, 5),
            "min_po2_at_3000_with_iec_piecewise_threshold_f_0p4107_mmhg": round(min_po2_at_3000_iec_piecewise_f, 5),
            "min_po2_at_shipped_lead_f_0p4500_mmhg": round(min_po2_at_shipped_f045, 5),
            "derivation_note": (
                "For zero-order consumption across [-L, L] with a central source lamina of half-width fraction a = 0.34, "
                "the exact two-branch piecewise zero-order threshold for min_{z} p(z) >= 15.0 mmHg is "
                "f_b1 = (1 - r)/(2 - a) when f_b1 <= a (r >= (1 - a)^2, minimum at z = 0; e.g. 2,500 pure -> f = 0.3136659) "
                "and f_b2 = 1 - sqrt(r) when f_b1 > a (r < (1 - a)^2, where z = 0 is a local maximum and the global minimum "
                "occurs in the outer passive annulus at |z| = f*L > a*L; e.g. 2,500+iEC -> f = 0.3544032, 3,000+iEC -> f = 0.4106534). "
                "Verified to 5 decimal places (15.00000 mmHg) against the 4,001-node FD BVP solver across all loading regimes."
            ),
        },
        "critical_passive_slab_thickness_reconciliation_at_3000_ieq_cm2_sol_v80_r2_10": {
            "fixed_areal_loading_sigma_3000_ieq_cm2_linear_scaling": {
                "scaling_law": "Delta_p = (V_max * sigma * V_IEQ * H) / (8 * D_O2 * alpha) -> H_crit_fixed_sigma = H_0 * (sigma_passive / sigma)",
                "h_crit_islet_only_um": round(h_crit_fixed_sigma_islet_only_um, 2),
                "h_crit_with_15pct_iec_um": round(h_crit_fixed_sigma_with_iec_um, 2),
                "resulting_islet_volume_fraction_at_h_crit_islet_only": round(
                    (sigma_target_high * VOL_1_IEQ_CM3) / (h_crit_fixed_sigma_islet_only_um * 1e-4), 4
                ),
            },
            "fixed_volume_fraction_phi_0p1515_quadratic_scaling": {
                "scaling_law": "Delta_p = (V_max * phi * H^2) / (8 * D_O2 * alpha) -> H_crit_fixed_phi = H_0 * sqrt(sigma_passive / sigma_0)",
                "reference_volume_fraction_phi": round(phi_at_3000_and_350um, 4),
                "h_crit_islet_only_um": round(h_crit_fixed_phi_islet_only_um, 2),
                "h_crit_with_15pct_iec_um": round(h_crit_fixed_phi_with_iec_um, 2),
                "corresponding_areal_loading_sigma_at_h_crit_ieq_cm2": round(sigma_at_fixed_phi_h_crit_islet_only, 1),
            },
        },
        "chemical_o2_fraction_definitions_reconciled_sol_v80_12": {
            "f_chem_initial_hour0_rate_fraction": round(f_chem_init, 4),
            "f_chem_72h_time_averaged_integrated_fraction": round(f_chem_72h_integrated, 6),
            "f_chem_total_inventory_to_72h_demand_ratio": round(f_chem_total_inventory_72h_window, 6),
            "cumulative_72h_pure_endocrine_o2_demand_mmol": round(
                (phi_2500 * VMAX_ISLET_PURE_MOL_CM3_S) * active_slab_total_cm3 * 72.0 * 3600.0 * 1e3, 4
            ),
            "cumulative_72h_iec_stroma_inclusive_1p15x_o2_demand_mmol": round(
                (phi_2500 * VMAX_ISLET_PURE_MOL_CM3_S * 1.15) * active_slab_total_cm3 * 72.0 * 3600.0 * 1e3, 4
            ),
            "loaded_cao2_inventory_mmol_at_2mol_per_mol_o2_and_1p15x_demand": round(n_cao2_mmol_lead, 4),
            "loaded_cao2_inventory_mass_mg_at_1p15x_demand": round(cao2_mass_mg_lead, 2),
            "pure_endocrine_1p00x_comparator_cao2_inventory_mmol": round(n_cao2_mmol_lead / 1.15, 4),
            "pure_endocrine_1p00x_comparator_cao2_mass_mg": round((n_cao2_mmol_lead / 1.15) * 72.078, 2),
            "reconciliation_note": (
                "At f_chem_initial = 0.45 and the unvalidated formulation-specific reference/target t_1/2 = 68 h (k_hyd = 0.010193 h^-1; used in 20 of 21 main PDE regimes while the uncoated CaO2 control uses 4 h; each distinct CaO2:PDMS wt% recipe, CaO2 crystal PSD, composite microbead PSD, catalase surface treatment, and pre-implant wetting state requires independent empirical t_1/2 + kinetic-law qualification under IIP-0010 / OQ-005 / DEC-088), the Hour-0 chemical O2 release rate "
                "supplies 45.0% of total graft+iEC metabolic demand (1.15x vascular/stromal demand multiplier on pure endocrine V_max = 3.40e-8 mol/(cm^3*s), "
                "giving 8.9547 mmol cumulative 72-h O2 demand vs 7.7867 mmol pure endocrine demand, and 2 * 0.613145 * 8.9547 = 10.9811 mmol = 791.49 mg CaO2 "
                "vs 9.5488 mmol = 688.25 mg on a pure-endocrine basis; exceeding both the 35.44% delta-sheet lower bound and "
                f"the {100*loading_table[2]['f_chem_min_finite_width_lamina_a0p34_zero_order_including_15pct_iec_demand']:.2f}% fixed-width zero-order threshold). Over the "
                "72-hour avascular bridge, exponential decay yields a 0-72h time-averaged chemical supply fraction of "
                f"{f_chem_72h_integrated:.4f} (31.88%), while the total loaded CaO2 inventory equals {f_chem_total_inventory_72h_window:.4f} "
                "(61.31%) of 72-hour cumulative graft+iEC O2 demand because progressive iEC vascular anastomosis (t_50 = 36.0 h "
                "in a 14-day pre-vascularized bed) takes over O2 delivery from Hour 24 onward."
            ),
        },
        "active_vs_structural_volume_reconciliation_v70_12": (
            "At 2,500 IEQ/cm^2 across 200 cm^2 exchange area (or 2,000 IEQ/cm^2 across 250 cm^2), the active 350 um "
            "oxygen-consuming hydrogel slab volume is exactly 200 * 0.035 = 7.00 cm^3 (or 250 * 0.035 = 8.75 cm^3), NOT 20 cm^3. "
            "Any external macroporous PTFE/silicone frame or inter-leaf vascularized host tissue channel (~11-13 cm^3) is outside "
            "the 350 um diffusion barrier and must not be used as the denominator for hydrogel CaO2 wt/vol loading."
        ),
        "non_overlapping_phase_volume_and_cad_ledger_7cm3_ultracode_v80_18": {
            "active_exchange_slab_total_volume_cm3": round(active_slab_total_cm3, 4),
            "cao2_initial_molar_inventory_mmol": round(n_cao2_mmol_lead, 3),
            "cao2_initial_mass_mg": round(cao2_mass_mg_lead, 1),
            "cao2_crystal_density_g_cm3": rho_cao2,
            "cao2_pure_solid_volume_cm3": round(v_cao2_cm3, 4),
            "pdms_cured_density_g_cm3": rho_pdms,
            "layout_option_a_25wt_pct_cao2_in_extended_polymer_scaffold": {
                "formulation": "25 wt% CaO2 : 75 wt% PDMS (1:3 wt/wt; 791.5 mg CaO2 + 2,374.5 mg PDMS = 3,166.0 mg composite)",
                "pdms_volume_cm3": round(2.3745 / rho_pdms, 4),
                "composite_solid_volume_cm3": round(v_cao2_cm3 + 2.3745 / rho_pdms, 4),
                "composite_fraction_of_7cm3_slab": round((v_cao2_cm3 + 2.3745 / rho_pdms) / active_slab_total_cm3, 4),
                "spatial_reconciliation": (
                    f"The 25 wt% alternative occupies {v_cao2_cm3 + 2.3745 / rho_pdms:.4f} cm^3, exceeding "
                    f"the model's fixed {100*CENTRAL_LAMINA_HALF_WIDTH_FRACTION:.2f}% central lamina "
                    f"({v_lamina_cont_cm3:.4f} cm^3). It is an unmodeled alternative requiring a new geometric "
                    "layout; it must not be interpreted as fitting the current confined Layout B source zone."
                ),
            },
            "layout_option_b_31wt_pct_cao2_confined_central_lamina_microbeads": {
                "formulation": f"31.25 wt% CaO2 : 68.75 wt% PDMS (1:2.2 wt/wt; {cao2_mass_mg_lead:.1f} mg CaO2 + {pdms_mass_b_mg:.1f} mg PDMS = {cao2_mass_mg_lead + pdms_mass_b_mg:.1f} mg composite microbeads)",
                "cao2_pure_solid_volume_cm3": round(v_cao2_cm3, 4),
                "pdms_volume_cm3": round(v_pdms_b_cm3, 4),
                "composite_microbead_solid_volume_cm3": round(v_beads_b_cm3, 4),
                "central_lamina_interstitial_hydrogel_and_catalase_pore_volume_cm3": round(v_pore_51_cm3, 4),
                "central_lamina_total_envelope_volume_cm3": round(v_lamina_51_cm3, 4),
                "central_lamina_continuous_34pct_envelope_volume_cm3": round(v_lamina_cont_cm3, 4),
                "central_lamina_continuous_34pct_interstitial_hydrogel_pore_volume_cm3": round(v_pore_cont_cm3, 4),
                "central_lamina_void_fraction_from_mass_and_density": v_pore_cont_cm3 / v_lamina_cont_cm3,
                "eps_0p42_inventory_retention_at_same_formulation_and_lamina": (v_lamina_cont_cm3 * (1.0 - 0.42)) / v_beads_b_cm3,
                "outer_band_thickness_um_each": half_L_cm * 1e4 * (1.0 - CENTRAL_LAMINA_HALF_WIDTH_FRACTION),
                "diameter_120um_full_outer_band_exclusion_feasible": bool(120. <= half_L_cm * 1e4 * (1.0 - CENTRAL_LAMINA_HALF_WIDTH_FRACTION)),
                "control_volume_geometry_reconciliation_preastra_a094": (
                    f"One physical source lamina |z| <= {175*CENTRAL_LAMINA_HALF_WIDTH_FRACTION:.2f} um "
                    f"spans {100*CENTRAL_LAMINA_HALF_WIDTH_FRACTION:.2f}% of the slab = {v_lamina_cont_cm3:.4f} cm^3. "
                    "Node control-volume overlap fractions integrate this same geometry on every mesh. "
                    f"Interstitial lamina pore volume is {v_pore_cont_cm3:.4f} cm^3 and outer cell-laden matrix "
                    f"volume is {v_outer_gel_cont_cm3:.4f} cm^3. Source normalization preserves the declared molar inventory."
                ),
                "central_lamina_half_width_fraction": CENTRAL_LAMINA_HALF_WIDTH_FRACTION,
                "pure_sc_islet_endocrine_tissue_volume_cm3": round(v_islet_cm3, 4),
                "co_seeded_iec_pericyte_vascular_stroma_volume_cm3": round(v_iec_cm3, 4),
                "outer_annular_cell_laden_peg_fibrin_hydrogel_matrix_volume_cm3": round(v_outer_gel_51_cm3, 4),
                "outer_annular_continuous_66pct_peg_fibrin_hydrogel_matrix_volume_cm3": round(v_outer_gel_cont_cm3, 4),
                "sum_of_all_non_overlapping_phases_cm3": round(sum(phases_51), 4),
                "sum_of_all_non_overlapping_phase_fractions": round(sum(phases_51) / active_slab_total_cm3, 4),
            },
            "effective_diffusivity_provenance_v80_110": {
                "d_o2_water_37c_cm2_s": 2.92e-5,
                "maxwell_mackie_meares_hydrogel_obstruction_factor": 0.322005,
                "d_o2_hydrogel_effective_cm2_s": D_O2_HYDROGEL_CM2_S,
                "derivation_note": (
                    "D_O2_HYDROGEL_CM2_S = 0.940254e-5 cm^2/s is the Maxwell-Garnett / Mackie-Meares effective diffusivity "
                    "of a 5 wt% PEG-4MAL/fibrin hydrogel at 37 C containing phi_islet = 0.126225 and 15% vascular stroma, "
                    "yielding sigma_passive_pure_islet = 1,198.286 IEQ/cm^2."
                ),
            },
            "catalase_localization_and_homogenization_qualification": (
                "The 1D reaction-diffusion BVP models k_decomp = 18.0 s^-1 and D_O2 = 0.940e-5 cm^2/s as homogenized effective "
                "continuum parameters across the hydrated hydrogel phase. Co-immobilizing Catalase on hydrophobic PDMS-CaO2 "
                "microbead surfaces requires wet-lab verification of retained specific activity, washout/inactivation half-life "
                "over 14 days, phase-dependent effective diffusivity, and local Ca2+/OH-/osmolality buffering."
            ),
            "cao2_crystal_particle_size_distribution_um": "unknown_pending_stage0_measurement",
            "pdms_cao2_composite_microbead_diameter_distribution_um": "unknown_pending_stage0_measurement",
            "cao2_solid_volume_fraction_in_cured_composite_by_formulation": {
                "layout_option_a_25wt_pct": round((0.25 / rho_cao2) / ((0.25 / rho_cao2) + (0.75 / rho_pdms)), 4),
                "layout_option_b_31p25wt_pct": round((0.3125 / rho_cao2) / ((0.3125 / rho_cao2) + (0.6875 / rho_pdms)), 4),
                "design_x_46p39wt_pct": round((0.463906 / rho_cao2) / ((0.463906 / rho_cao2) + (0.536094 / rho_pdms)), 4),
            },
            "formulation_transfer_and_percolation_qualification_note_iip_0010": (
                "At rho_CaO2 = 2.91 g/cm^3 and rho_PDMS = 1.03 g/cm^3, raising dry CaO2 loading from 25.00 wt% (10.55 vol% solid filler; Pedraza et al. 2012 PMID:22371586 macroscopic monolithic PDMS disk context) "
                "to 31.25 wt% (13.86 vol% in Layout B's 119-um lamina) and 46.39 wt% (23.45 vol% in Stage-0 Design X's 100-um lamina) substantially increases inorganic solid volume fraction inside cured PDMS microbeads, "
                "where hydrophilic filler clustering, particle-size distribution, microbead surface-to-volume ratio (Accolla et al. 2023 PMID:36971050; Ke et al. 2022 PMID:35743287), and co-immobilized hydrophilic catalase "
                "can alter water wicking, connected porosity, kinetic law (first-order vs reaction-controlled shrinking-core vs diffusion-controlled Ginstling-Brounshtein), and effective t_1/2. "
                "Accordingly, t_1/2 = 68.0 h is treated strictly as an unvalidated formulation-specific reference/target rather than a conserved material constant, without claiming a universal 16 vol% percolation cliff across polydisperse PDMS composites (IIP-0010 / OQ-005 / DEC-088)."
            ),
        },
        "selected_source_lamina_half_width_fraction": CENTRAL_LAMINA_HALF_WIDTH_FRACTION,
        "alternative_a0p35_fields_scope": (
            "Explicit unselected width sensitivity within part_a_exact_oxygen_boundary_value_and_volume_algebra "
            "(where the baseline CAD ledger and lead Layout B PDE use a = 0.34 [119.0 um], while dedicated off-grid Stage-0 Design X PDE scenarios in part_a_336h_spatial_reaction_diffusion_pouch_pde explicitly solve a = 100/350 = 0.285714 [100.0 um lamina, 125.0 um outer cell bands]; IIP-0009 / DEC-087)."
        ),
        "exact_boundary_value_loading_table": loading_table,
    }


def _validate_lamina_half_width_fraction(lamina_half_width_fraction: float | None) -> float:
    if lamina_half_width_fraction is None:
        return CENTRAL_LAMINA_HALF_WIDTH_FRACTION
    if (
        isinstance(lamina_half_width_fraction, (bool, np.bool_, complex, np.complexfloating))
        or not isinstance(lamina_half_width_fraction, (int, float, np.number))
        or not math.isfinite(float(lamina_half_width_fraction))
        or not (0.0 < float(lamina_half_width_fraction) < 1.0)
    ):
        raise ValueError("lamina_half_width_fraction must be a finite real number in (0, 1)")
    return float(lamina_half_width_fraction)


def _slab_control_volume_profiles(
    nz: int, half_L: float = 0.0175, lamina_half_width_fraction: float | None = None
) -> Dict[str, np.ndarray]:
    """Fixed physical lamina integrated over node-centered control volumes, including half boundary cells."""
    if not isinstance(nz, int) or isinstance(nz, bool) or nz < 5 or nz % 2 == 0:
        raise ValueError("nz must be an odd integer >= 5")
    if not math.isfinite(half_L) or half_L <= 0:
        raise ValueError("half_L must be finite and positive")
    a_frac = _validate_lamina_half_width_fraction(lamina_half_width_fraction)
    z = np.linspace(-half_L, half_L, nz)
    faces = np.r_[-half_L, 0.5 * (z[:-1] + z[1:]), half_L]
    widths = np.diff(faces)
    lamina_half = a_frac * half_L
    overlap = np.maximum(0.0, np.minimum(faces[1:], lamina_half) - np.maximum(faces[:-1], -lamina_half))
    mask = overlap / widths
    weighted_fraction = float(np.dot(mask, widths) / (2.0 * half_L))
    outer = 1.0 - mask
    return {"z": z, "faces": faces, "widths": widths, "central_mask": mask,
            "central_source": mask / weighted_fraction,
            "outer_demand": outer / float(np.dot(outer, widths) / (2.0 * half_L))}


def _ginstling_brounshtein_hydrolyzed_fraction(t_h: float, t_half_h: float = 68.0) -> float:
    """Solve 1 - (2/3)*alpha - (1 - alpha)^(2/3) = k_gb * t with k_gb calibrated at alpha(t_half_h) = 0.5 (AUDIT-REF)."""
    if t_h <= 0.0:
        return 0.0
    rhs_half = 1.0 - (2.0 / 3.0) * 0.5 - (0.5 ** (2.0 / 3.0))
    rhs_target = rhs_half * (t_h / t_half_h)
    if rhs_target >= 1.0 / 3.0:
        return 1.0
    lo, hi = 0.0, 1.0
    for _ in range(64):
        mid = 0.5 * (lo + hi)
        val = 1.0 - (2.0 / 3.0) * mid - ((1.0 - mid) ** (2.0 / 3.0))
        if val < rhs_target:
            lo = mid
        else:
            hi = mid
    return 0.5 * (lo + hi)


def _ginstling_brounshtein_piecewise_regularized_integral(alpha: float, eps_shell: float = 0.05) -> float:
    """Exact integral F_pw(alpha) = int_0^alpha (2/3)*max(eps_shell, (1 - u)^(-1/3) - 1) du (AUDIT-REF & AUDIT-REF)."""
    if alpha <= 0.0:
        return 0.0
    a_clamped = min(1.0, float(alpha))
    alpha_c = 1.0 - ((1.0 + eps_shell) ** -3.0)
    if a_clamped <= alpha_c:
        return (2.0 / 3.0) * eps_shell * a_clamped
    base_c = (2.0 / 3.0) * eps_shell * alpha_c
    f_classic_c = 1.0 - (2.0 / 3.0) * alpha_c - ((1.0 - alpha_c) ** (2.0 / 3.0))
    f_classic_a = 1.0 - (2.0 / 3.0) * a_clamped - ((max(0.0, 1.0 - a_clamped)) ** (2.0 / 3.0))
    return base_c + (f_classic_a - f_classic_c)


def _ginstling_brounshtein_piecewise_regularized_hydrolyzed_fraction(
    t_h: float, t_half_h: float = 68.0, eps_shell: float = 0.05
) -> float:
    """Solve F_pw(alpha) = F_pw(0.5) * (t / t_half_h) so d(alpha)/dt matches the eps_shell-clamped source with zero conservation error (AUDIT-REF)."""
    if t_h <= 0.0:
        return 0.0
    rhs_half = _ginstling_brounshtein_piecewise_regularized_integral(0.5, eps_shell)
    rhs_max = _ginstling_brounshtein_piecewise_regularized_integral(1.0, eps_shell)
    rhs_target = rhs_half * (t_h / t_half_h)
    if rhs_target >= rhs_max:
        return 1.0
    lo, hi = 0.0, 1.0
    for _ in range(64):
        mid = 0.5 * (lo + hi)
        if _ginstling_brounshtein_piecewise_regularized_integral(mid, eps_shell) < rhs_target:
            lo = mid
        else:
            hi = mid
    return 0.5 * (lo + hi)


def _slab_oxygen_face_diffusivities(
    z_grid: np.ndarray,
    lamina_d_o2_scale: float,
    lamina_half_width_fraction: float | None = None,
    d_o2_hydrogel_override_cm2_s: float | None = None,
) -> np.ndarray:
    """Exact series resistance between adjacent nodes across the sharp lamina.

    Source control-volume overlap fractions average a volumetric source; they
    must not be reused as nodal diffusivities and then averaged a second time.
    The flux between nodes instead uses the length integral of 1/D on that
    specific segment, including a material interface exactly on a grid node.
    """
    a_frac = _validate_lamina_half_width_fraction(lamina_half_width_fraction)
    spacing = np.diff(z_grid)
    lamina_half = a_frac * 0.5 * (z_grid[-1] - z_grid[0])
    overlap = np.maximum(0.0, np.minimum(z_grid[1:], lamina_half) - np.maximum(z_grid[:-1], -lamina_half))
    d_base = float(d_o2_hydrogel_override_cm2_s) if d_o2_hydrogel_override_cm2_s is not None else D_O2_HYDROGEL_CM2_S
    return d_base * spacing / (overlap / lamina_d_o2_scale + spacing - overlap)


def _run_single_pouch_pde_regime(
    regime_id: str,
    f_chem_initial: float,
    spatial_mode: str,
    cao2_half_life_h: float,
    catalase_present: bool,
    iec_max_perfusion_fraction: float,
    boundary_po2_mmhg: float = P_BOUNDARY_HOST_BED_MMHG,
    inosculation_t50_h: float = 36.0,
    demand_multiplier_extra: float = 1.0,
    release_kinetics_law: str = "first_order",
    nz_override: int | None = None,
    k_perf_max_s_override: float = 0.14,
    demand_spatial_mode: str = "uniform_conservative",
    lamina_d_o2_scale: float = 1.0,
    catalase_half_life_h: float = 168.0,
    acid_pocket_residence_time_s: float = 45.0,
    lamina_half_width_fraction: float | None = None,
    catalase_spatial_mode: str = "uniform_slab",
    catalase_k1_override_s_inv: float | None = None,
    d_o2_hydrogel_override_cm2_s: float | None = None,
    perfusion_spatial_mode: str = "uniform_slab",
    external_standoff_um: float = 0.0,
    gb_regularization_mode: str = "early_shell_clamped",
    areal_loading_ieq_cm2: float = 2500.0,
    cell_intrinsic_ocr_multiplier: float | None = None,
    cluster_endocrine_ocr_multiplier: float | None = None,
    prescribed_cluster_diameter_um: float = 120.0,
    zero_internal_vascular_state: bool = False,
    _include_hourly_slab_po2_vector: bool = False,
    _assess_numerical_gate: bool = True,
) -> Dict[str, Any]:
    # Reject malformed physical parameters before any zero-source branch or numerical integration.
    for name, value, low, high, strict_low in (
        ("f_chem_initial", f_chem_initial, 0., None, False),
        ("cao2_half_life_h", cao2_half_life_h, 0., None, True),
        ("iec_max_perfusion_fraction", iec_max_perfusion_fraction, 0., 1., False),
        ("boundary_po2_mmhg", boundary_po2_mmhg, 0., None, False),
        ("inosculation_t50_h", inosculation_t50_h, 0., None, False),
        ("demand_multiplier_extra", demand_multiplier_extra, 0., None, True),
        ("k_perf_max_s_override", k_perf_max_s_override, 0., None, False),
        ("lamina_d_o2_scale", lamina_d_o2_scale, 0., None, True),
        ("catalase_half_life_h", catalase_half_life_h, 0., None, True),
        ("acid_pocket_residence_time_s", acid_pocket_residence_time_s, 0., None, False),
        ("external_standoff_um", external_standoff_um, 0., None, False),
        ("areal_loading_ieq_cm2", areal_loading_ieq_cm2, 0., None, True),
        ("prescribed_cluster_diameter_um", prescribed_cluster_diameter_um, 0., None, True),
    ):
        if (isinstance(value, bool) or not isinstance(value, (int, float)) or not math.isfinite(value)
                or value < low or (strict_low and value == low) or (high is not None and value > high)):
            raise ValueError(f"{name} outside its finite physical domain")
    if cell_intrinsic_ocr_multiplier is not None and (
        isinstance(cell_intrinsic_ocr_multiplier, bool)
        or not isinstance(cell_intrinsic_ocr_multiplier, (int, float))
        or not math.isfinite(cell_intrinsic_ocr_multiplier)
        or cell_intrinsic_ocr_multiplier <= 0.0
    ):
        raise ValueError("cell_intrinsic_ocr_multiplier must be finite and positive")
    if cluster_endocrine_ocr_multiplier is not None and (
        isinstance(cluster_endocrine_ocr_multiplier, bool)
        or not isinstance(cluster_endocrine_ocr_multiplier, (int, float))
        or not math.isfinite(cluster_endocrine_ocr_multiplier)
        or cluster_endocrine_ocr_multiplier <= 0.0
    ):
        raise ValueError("cluster_endocrine_ocr_multiplier must be finite and positive")
    if d_o2_hydrogel_override_cm2_s is not None and (
        isinstance(d_o2_hydrogel_override_cm2_s, bool)
        or not isinstance(d_o2_hydrogel_override_cm2_s, (int, float))
        or not math.isfinite(d_o2_hydrogel_override_cm2_s)
        or d_o2_hydrogel_override_cm2_s <= 0.0
    ):
        raise ValueError("d_o2_hydrogel_override_cm2_s must be finite and positive")
    if catalase_k1_override_s_inv is not None and (
        isinstance(catalase_k1_override_s_inv, bool)
        or not isinstance(catalase_k1_override_s_inv, (int, float))
        or not math.isfinite(catalase_k1_override_s_inv)
        or catalase_k1_override_s_inv < 0.0
    ):
        raise ValueError("catalase_k1_override_s_inv must be a finite nonnegative number")
    if catalase_spatial_mode not in {"uniform_slab", "central_lamina_masked"}:
        raise ValueError("unsupported catalase_spatial_mode")
    if perfusion_spatial_mode not in {"uniform_slab", "outer_annulus_masked", "outer_annulus_masked_all_species"}:
        raise ValueError("unsupported perfusion_spatial_mode")
    if (
        not isinstance(catalase_present, bool)
        or not isinstance(zero_internal_vascular_state, bool)
        or not isinstance(_include_hourly_slab_po2_vector, bool)
        or not isinstance(_assess_numerical_gate, bool)
    ):
        raise ValueError("catalase_present, zero_internal_vascular_state, _include_hourly_slab_po2_vector, and _assess_numerical_gate must be booleans")
    if release_kinetics_law not in {"first_order", "shrinking_core", "ginstling_brounshtein"}:
        raise ValueError("unsupported release_kinetics_law")
    if gb_regularization_mode not in {"early_shell_clamped", "exact_piecewise_conserving"}:
        raise ValueError("unsupported gb_regularization_mode")
    a_frac = _validate_lamina_half_width_fraction(lamina_half_width_fraction)
    nz = nz_override if nz_override is not None else 51
    half_L = 0.0175  # cm
    geometry = _slab_control_volume_profiles(nz, half_L, lamina_half_width_fraction=a_frac)
    z_grid = geometry["z"]
    dz = z_grid[1] - z_grid[0]
    active_slab_vol_cm3 = 7.00  # 200 cm^2 * 0.035 cm

    phi_islet_ref_2500 = (2500.0 * VOL_1_IEQ_CM3) / (2.0 * half_L)  # 0.1262247
    if not math.isclose(float(areal_loading_ieq_cm2), 2500.0, rel_tol=1e-12):
        sigma_loading = float(areal_loading_ieq_cm2)
        if cell_intrinsic_ocr_multiplier is not None:
            effective_ocr_mult = float(cell_intrinsic_ocr_multiplier)
        elif math.isclose(float(demand_multiplier_extra), sigma_loading / 2500.0, rel_tol=1e-6):
            effective_ocr_mult = 1.0
        else:
            effective_ocr_mult = float(demand_multiplier_extra)
    elif cell_intrinsic_ocr_multiplier is not None:
        sigma_loading = float(areal_loading_ieq_cm2)
        effective_ocr_mult = float(cell_intrinsic_ocr_multiplier)
    elif float(demand_multiplier_extra) < 1.0 - 1e-12:
        # Sub-unity demand_multiplier_extra (e.g. 0.60x for 1,500 IEQ/cm^2 low-load) represents areal loading density derating at 1.0x intrinsic cellular OCR (R8-F01; DEC-064):
        sigma_loading = 2500.0 * float(demand_multiplier_extra)
        effective_ocr_mult = 1.0
    else:
        sigma_loading = 2500.0
        effective_ocr_mult = float(demand_multiplier_extra)
    vascular_demand_mult = 1.15 * effective_ocr_mult
    phi_islet = (sigma_loading * VOL_1_IEQ_CM3) / (2.0 * half_L)
    q_demand_full = phi_islet * VMAX_ISLET_PURE_MOL_CM3_S * vascular_demand_mult  # mol/(cm^3*s)
    v_demand_mmhg_s = q_demand_full / ALPHA_BUNSEN_MOL_CM3_MMHG

    if spatial_mode not in {"central", "uniform", "none"}:
        raise ValueError("unsupported spatial_mode")
    if demand_spatial_mode not in {"outer_annulus", "uniform_conservative"}:
        raise ValueError("unsupported demand_spatial_mode")
    if not math.isfinite(lamina_d_o2_scale) or lamina_d_o2_scale <= 0:
        raise ValueError("lamina_d_o2_scale must be finite and positive")
    central_mask = geometry["central_mask"]
    s_prof = (geometry["central_source"] if spatial_mode == "central" else
              (np.ones(nz) if spatial_mode == "uniform" else np.zeros(nz)))
    d_prof = geometry["outer_demand"] if demand_spatial_mode == "outer_annulus" else np.ones(nz)
    d_prof_int = d_prof[1:-1]
    cv_weights = geometry["widths"] / (2.0 * half_L)
    geometry_ledger = {
        "central_lamina_half_width_fraction": a_frac,
        "nz_nodes": nz,
        "lamina_volume_cm3": float(np.dot(central_mask, cv_weights) * active_slab_vol_cm3),
        "assigned_chemical_source_relative_integral": float(np.dot(s_prof, cv_weights)),
        "assigned_total_demand_relative_integral": float(np.dot(d_prof, cv_weights)),
        "integration_scope": "assigned continuum profiles; Dirichlet host boundaries exchange mass with the reservoir",
    }
    # Wigner-Seitz packing must use the region that actually contains the clusters.
    cell_region_fraction = 1.0 - a_frac if demand_spatial_mode == "outer_annulus" else 1.0
    local_phi_islet = phi_islet / cell_region_fraction
    geometry_ledger.update({
        "areal_loading_ieq_cm2": round(sigma_loading, 4),
        "cell_intrinsic_ocr_multiplier": round(effective_ocr_mult, 6),
        "global_islet_volume_fraction": phi_islet,
        "cell_containing_region_volume_fraction": cell_region_fraction,
        "local_islet_volume_fraction_for_unit_cell": local_phi_islet,
        "outer_band_thickness_um_each": half_L * 1e4 * (1.0 - a_frac),
        "diameter_120um_fits_wholly_in_outer_band": bool(120.0 <= half_L * 1e4 * (1.0 - a_frac)),
        "spatial_model_scope": "1D planar slab/outer bands; no explicit 3D annular ring or cluster-interface overlap",
    })

    # Conserve explicit molar CaO2 inventory n_CaO2(0) across regimes (AUDIT-REF & AUDIT-REF):
    k_ref_s = math.log(2.0) / (68.0 * 3600.0)
    r_o2_0_mol_s = f_chem_initial * (phi_islet_ref_2500 * VMAX_ISLET_PURE_MOL_CM3_S * 1.15) * active_slab_vol_cm3
    n_cao2_initial_mmol = (2.0 * r_o2_0_mol_s / k_ref_s) * 1e3  # mmol CaO2 in 7.00 cm^3 slab (10.981 mmol at f_chem=0.45)
    cao2_mass_initial_mg = n_cao2_initial_mmol * 72.078         # MW CaO2 = 72.078 g/mol (791.5 mg at f_chem=0.45)

    k_hyd_h = math.log(2.0) / cao2_half_life_h
    k_hyd_s = k_hyd_h / 3600.0
    t_eval_hours_report = {0.0, 2.0, 6.0, 12.0, 24.0, 48.0, 72.0, 96.0, 120.0, 168.0, 336.0}
    t_hourly_grid = [float(h) for h in range(337)]

    def perfusion_target(t_h: float) -> float:
        exponent = -(t_h - inosculation_t50_h) / 8.0
        # At exponents beyond log(float_max), the target is effectively zero;
        # preserve ordinary-path arithmetic without overflowing for a delayed control.
        return 0.0 if exponent > math.log(sys.float_info.max) else iec_max_perfusion_fraction / (1.0 + math.exp(exponent))

    def perfusion_ode(t_h: float, y: np.ndarray) -> np.ndarray:
        v_perf = y[0]
        v_target = perfusion_target(t_h)
        dv_dt = (v_target - v_perf) / 3.0
        return np.array([dv_dt])

    k_sc_h = 3.0 * (1.0 - (0.5 ** (1.0 / 3.0))) / cao2_half_life_h

    perfusion_y = (
        np.zeros(len(t_hourly_grid), dtype=np.float64)
        if zero_internal_vascular_state
        else rk4_integrate(perfusion_ode, (0.0, 336.0), np.array([0.01]), t_hourly_grid, dt_max=0.25)[0]
    )
    # The source is the derivative of these exact stocks. Resolving stock with
    # explicit RK4 can step through finite-time depletion or become unstable for
    # half-lives shorter than the fixed perfusion time step.
    sol_y_fo = np.vstack((n_cao2_initial_mmol * _cao2_inventory_fractions(
        np.asarray(t_hourly_grid), cao2_half_life_h, "first_order"), perfusion_y))
    sol_y_sc = np.vstack((n_cao2_initial_mmol * _cao2_inventory_fractions(
        np.asarray(t_hourly_grid), cao2_half_life_h, "shrinking_core"), perfusion_y))
    if release_kinetics_law == "ginstling_brounshtein":
        if gb_regularization_mode == "exact_piecewise_conserving":
            gb_rem_vec = np.array(
                [max(0.0, 1.0 - _ginstling_brounshtein_piecewise_regularized_hydrolyzed_fraction(float(t), cao2_half_life_h, 0.05)) for t in t_hourly_grid],
                dtype=np.float64,
            )
            sol_y = np.vstack((n_cao2_initial_mmol * gb_rem_vec, perfusion_y))
        else:
            sol_y = np.vstack((n_cao2_initial_mmol * _cao2_inventory_fractions(
                np.asarray(t_hourly_grid), cao2_half_life_h, "ginstling_brounshtein"), perfusion_y))
    elif release_kinetics_law == "shrinking_core":
        sol_y = sol_y_sc
    else:
        sol_y = sol_y_fo
    k_gb_h = (
        _ginstling_brounshtein_piecewise_regularized_integral(0.5, 0.05) / cao2_half_life_h
        if (release_kinetics_law == "ginstling_brounshtein" and gb_regularization_mode == "exact_piecewise_conserving")
        else (1.0 - (2.0 / 3.0) * 0.5 - (0.5 ** (2.0 / 3.0))) / cao2_half_life_h
    )

    # Spatially varying diffusivity profile D_O2(z) for Bruggeman central-lamina tortuosity tests (AUDIT-REF):
    d_o2_faces = _slab_oxygen_face_diffusivities(
        z_grid,
        lamina_d_o2_scale,
        lamina_half_width_fraction=a_frac,
        d_o2_hydrogel_override_cm2_s=d_o2_hydrogel_override_cm2_s,
    )
    standoff_cm = float(external_standoff_um) * 1e-4
    robin_boundary_factor = float(dz / (dz + standoff_cm)) if standoff_cm > 0.0 else 1.0

    time_series = []
    hourly_min_slab_po2_mmhg: list[float] = []
    min_po2_over_all_t = math.inf
    time_of_min_po2_h = 0.0
    max_h2o2_uM_over_all_t = 0.0
    max_h2o2_at_lamina_interface_uM_over_all_t = 0.0
    max_h2o2_at_lamina_interface_interp_uM_over_all_t = 0.0
    max_h2o2_uM_with_cat_decay_over_all_t = 0.0
    z_int_abs = np.abs(z_grid[1:-1])
    lamina_half_cm = a_frac * half_L
    lamina_if_int_idx = int(np.argmin(np.abs(z_int_abs - lamina_half_cm)))
    z_int_pos = z_grid[1:-1]
    max_ph_over_all_t = 7.40
    max_closed_pocket_ph_over_all_t = 7.40
    min_closed_pocket_acidic_ph_over_all_t = 7.40
    hour0_h2o2_to_o2_yield_fraction = 0.0
    f_viable_dynamic = 1.0  # Coupled 336h hypoxic/peroxide/pH dynamic tissue viability state (AUDIT-REF)
    n_int = nz - 2
    max_peroxide_residual_uM_s = 0.0
    max_peroxide_iterations = 0
    max_slab_residual_mmhg_s = 0.0
    slab_solvers_converged = True

    for idx, t_h in enumerate(t_hourly_grid):
        n_rem_mmol = max(0.0, float(sol_y[0, idx]))
        m_rem_frac = max(0.0, (n_rem_mmol / n_cao2_initial_mmol)) if n_cao2_initial_mmol > 0 else 0.0
        v_perf = float(sol_y[1, idx])
        k_perf_s = k_perf_max_s_override * v_perf

        if release_kinetics_law == "shrinking_core":
            o2_gen_mean_mol_cm3_s = (
                0.5
                * (k_sc_h / 3600.0)
                * (n_cao2_initial_mmol * 1e-3)
                * (max(0.0, m_rem_frac) ** (2.0 / 3.0))
                / active_slab_vol_cm3
            )
        elif release_kinetics_law == "ginstling_brounshtein":
            # In Ginstling-Brounshtein 3D diffusion-controlled shrinking-core kinetics,
            # d(alpha)/dt = (3/2) * k_gb / ((1 - alpha)^(-1/3) - 1), regularized by finite initial PDMS surface shell resistance eps_shell = 0.05 at t -> 0:
            denom_gb = max(0.05, (max(1e-9, m_rem_frac) ** (-1.0 / 3.0)) - 1.0) if m_rem_frac > 0.0 else math.inf
            rate_gb_s = (1.5 * (k_gb_h / 3600.0) / denom_gb) if math.isfinite(denom_gb) else 0.0
            o2_gen_mean_mol_cm3_s = 0.5 * rate_gb_s * (n_cao2_initial_mmol * 1e-3) / active_slab_vol_cm3
        else:
            o2_gen_mean_mol_cm3_s = 0.5 * k_hyd_s * (n_rem_mmol * 1e-3) / active_slab_vol_cm3

        # 1. Solve spatial reaction-diffusion BVP for H2O2(z) in uM FIRST:
        s_h2o2_uM_s = 2.0 * o2_gen_mean_mol_cm3_s * 1e9 * s_prof
        # Solve the declared local kinetic equation, including enzyme decay.
        # A single rate derived from a preliminary peak concentration does not
        # satisfy nodewise Michaelis-Menten clearance when substrate saturates.
        cat_active_frac = math.exp(-math.log(2.0) * t_h / catalase_half_life_h) if catalase_present else 1.0
        base_k1 = (float(catalase_k1_override_s_inv) if catalase_k1_override_s_inv is not None else 18.0) if catalase_present else 0.008
        if catalase_present and catalase_spatial_mode == "central_lamina_masked":
            k1_profile: float | np.ndarray = 0.008 + (base_k1 * cat_active_frac - 0.008) * central_mask[1:-1]
        else:
            k1_profile = base_k1 * cat_active_frac if catalase_present else 0.008
        k_perf_profile: float | np.ndarray = (
            k_perf_s * (1.0 - central_mask[1:-1])
            if perfusion_spatial_mode in {"outer_annulus_masked", "outer_annulus_masked_all_species"}
            else k_perf_s
        )
        peroxide = _solve_peroxide_slab_bvp(
            s_h2o2_uM_s[1:-1], float(dz),
            k1_profile,
            k_perf_profile, km_uM=25000.0 if catalase_present else None)
        h2o2_int_operative = peroxide["concentration_uM"]
        h2o2_peak_operative_uM = float(np.max(h2o2_int_operative))
        h2o2_if_operative_uM = float(h2o2_int_operative[lamina_if_int_idx])
        h2o2_if_interp_uM = float(np.interp(lamina_half_cm, z_int_pos, h2o2_int_operative))
        max_h2o2_uM_over_all_t = max(max_h2o2_uM_over_all_t, h2o2_peak_operative_uM)
        max_h2o2_at_lamina_interface_uM_over_all_t = max(max_h2o2_at_lamina_interface_uM_over_all_t, h2o2_if_operative_uM)
        max_h2o2_at_lamina_interface_interp_uM_over_all_t = max(max_h2o2_at_lamina_interface_interp_uM_over_all_t, h2o2_if_interp_uM)
        max_h2o2_uM_with_cat_decay_over_all_t = max(max_h2o2_uM_with_cat_decay_over_all_t, h2o2_peak_operative_uM)
        max_peroxide_residual_uM_s = max(max_peroxide_residual_uM_s, peroxide["residual_inf_uM_s"])
        max_peroxide_iterations = max(max_peroxide_iterations, peroxide["iterations"])

        # Same local decomposition reaction supplies exactly 0.5 mol O2 per mol H2O2.
        o2_local_source_int_mol_cm3_s = 0.5 * peroxide["decomposition_uM_s"] * 1e-9
        q_source_int_mmhg_s = o2_local_source_int_mol_cm3_s / ALPHA_BUNSEN_MOL_CM3_MMHG
        if idx == 0:
            theo_int = float(np.trapezoid(o2_gen_mean_mol_cm3_s * s_prof[1:-1], z_grid[1:-1]))
            actual_int = float(np.trapezoid(o2_local_source_int_mol_cm3_s, z_grid[1:-1]))
            hour0_h2o2_to_o2_yield_fraction = (actual_int / theo_int) if theo_int > 1e-18 else 0.0

        # 2. Solve spatial reaction-diffusion BVP for pO2(z) driven by coupled H2O2 disproportionation O2 source:
        p = np.full(nz, boundary_po2_mmhg, dtype=np.float64)
        d_left = (d_o2_faces[:-1] / (dz * dz)).copy()
        d_right = (d_o2_faces[1:] / (dz * dz)).copy()
        if standoff_cm > 0.0:
            d_left[0] *= robin_boundary_factor
            d_right[-1] *= robin_boundary_factor
        k_perf_o2: float | np.ndarray = k_perf_profile
        for _ in range(80):
            p[0] = boundary_po2_mmhg
            p[-1] = boundary_po2_mmhg
            diff_term = d_left * (p[:-2] - p[1:-1]) + d_right * (p[2:] - p[1:-1])
            p_int = p[1:-1]
            cons = v_demand_mmhg_s * d_prof_int * (p_int / (KM_O2_MMHG + p_int))
            res = diff_term - cons + q_source_int_mmhg_s + k_perf_o2 * (boundary_po2_mmhg - p_int)
            jac_diag = (
                -(d_left + d_right)
                - v_demand_mmhg_s * d_prof_int * (KM_O2_MMHG / ((KM_O2_MMHG + p_int) ** 2))
                - k_perf_o2
            )
            mat = (
                np.diag(jac_diag)
                + np.diag(d_right[:-1], 1)
                + np.diag(d_left[1:], -1)
            )
            step = np.linalg.solve(mat, -res)
            damping = 0.8
            while np.any(p[1:-1] + damping * step < 0.0) and damping > 1e-12:
                damping *= 0.5
            p[1:-1] = np.maximum(0.0, p[1:-1] + damping * step)
            if float(np.max(np.abs(step))) < 1e-6:
                break

        final_slab_residual = (d_left * (p[:-2] - p[1:-1]) + d_right * (p[2:] - p[1:-1])
            - v_demand_mmhg_s * d_prof_int * (p[1:-1] / (KM_O2_MMHG + p[1:-1]))
            + q_source_int_mmhg_s + k_perf_o2 * (boundary_po2_mmhg - p[1:-1]))
        if standoff_cm > 0.0:
            p[0] = robin_boundary_factor * boundary_po2_mmhg + (1.0 - robin_boundary_factor) * p[1]
            p[-1] = robin_boundary_factor * boundary_po2_mmhg + (1.0 - robin_boundary_factor) * p[-2]
        slab_residual = float(np.max(np.abs(final_slab_residual)))
        finite_slab = bool(np.all(np.isfinite(p)) and np.all(p >= 0.0) and math.isfinite(slab_residual))
        if not finite_slab:
            raise ValueError("Slab oxygen BVP left its finite nonnegative domain")
        max_slab_residual_mmhg_s = max(max_slab_residual_mmhg_s, slab_residual)
        slab_solvers_converged = slab_solvers_converged and slab_residual < 1e-6

        min_p = float(np.min(p))
        hourly_min_slab_po2_mmhg.append(min_p)
        center_p = float(p[nz // 2])
        if min_p < min_po2_over_all_t:
            min_po2_over_all_t = min_p
            time_of_min_po2_h = t_h

        # 3. Coupled Henderson-Hasselbalch CO2/HCO3-/HEPES interstitial pH BVP & Closed-Pocket Acidic/Alkaline Bounds (AUDIT-REF):
        oh_source_mM_s = 4.0 * o2_gen_mean_mol_cm3_s * 1e6 * s_prof
        d_oh_eff = 1.5e-5  # Effective OH-/HCO3- counter-diffusion coefficient (cm^2/s)
        oh_diag = np.full(n_int, -2.0 * d_oh_eff / (dz * dz)) - k_perf_profile
        oh_mat = (
            np.diag(oh_diag)
            + np.diag(np.full(n_int - 1, d_oh_eff / (dz * dz)), 1)
            + np.diag(np.full(n_int - 1, d_oh_eff / (dz * dz)), -1)
        )
        oh_accum_mM = np.linalg.solve(oh_mat, -oh_source_mM_s[1:-1])
        peak_oh_mM = float(np.max(np.maximum(0.0, oh_accum_mM)))
        delta_ph = peak_oh_mM / BETA_BUF_MM_PER_PH
        if peak_oh_mM > 0.35 * BETA_BUF_MM_PER_PH:
            excess_mM = peak_oh_mM - 0.35 * BETA_BUF_MM_PER_PH
            delta_ph += 1.45 * math.log1p(excess_mM)
        local_ph = min(12.45, 7.40 + delta_ph)
        max_ph_over_all_t = max(max_ph_over_all_t, local_ph)

        # Closed-pocket alkaline breakthrough bound (unresupplied CO2 + CaO2 OH- accumulation over tau_res = 180 s):
        unbuffered_pocket_oh_mM = peak_oh_mM * (1.0 + (2.8 if cao2_half_life_h <= 10.0 else 0.25))
        hh_ratio_alk = (24.0 + 0.5 * unbuffered_pocket_oh_mM) / max(0.05, 1.2 - 0.12 * unbuffered_pocket_oh_mM)
        closed_pocket_alk_ph = min(11.24, max(local_ph, 6.10 + math.log10(max(1.0, hh_ratio_alk))))
        max_closed_pocket_ph_over_all_t = max(max_closed_pocket_ph_over_all_t, closed_pocket_alk_ph)

        # Closed-pocket metabolic CO2/lactate acidification bound over tau_pocket = acid_pocket_residence_time_s stagnant boundary-layer residence time (AUDIT-REF):
        # Aerobic respiration (RQ = 1.0) generates CO2 at q_demand_full * (min_p / (KM + min_p)) plus Pasteur glycolytic lactic acid when min_p < 15 mmHg:
        tau_pocket_s = acid_pocket_residence_time_s
        co2_prod_mM = (q_demand_full * (min_p / (KM_O2_MMHG + min_p)) * 1e6) * tau_pocket_s * (1.0 - 0.65 * v_perf)
        pasteur_lac_mM = (6.50 * max(0.0, (15.0 - min_p) / 15.0)) if min_p < 15.0 else 0.0
        hco3_eff_mM = max(4.0, 24.0 - pasteur_lac_mM + 0.15 * peak_oh_mM)
        h2co3_eff_mM = 1.20 + co2_prod_mM
        closed_pocket_acidic_ph = 6.10 + math.log10(hco3_eff_mM / h2co3_eff_mM)
        min_closed_pocket_acidic_ph_over_all_t = min(min_closed_pocket_acidic_ph_over_all_t, closed_pocket_acidic_ph)

        # Dynamic step integration of hypoxic/peroxide/pH viability loss over actual interval dt_h (for idx > 0; AUDIT-REF):
        if idx > 0:
            dt_h = t_hourly_grid[idx] - t_hourly_grid[idx - 1]
            k_hypox_h = 0.018 * max(0.0, (15.0 - min_p) / 10.0) if min_p < 15.0 else 0.0
            k_perox_h = 0.025 * max(0.0, (h2o2_peak_operative_uM - 5.0) / 25.0) if h2o2_peak_operative_uM > 5.0 else 0.0
            k_alk_h = 0.040 * max(0.0, (local_ph - 7.60) / 0.25) if local_ph > 7.60 else 0.0
            k_acid_h = 0.030 * max(0.0, (7.20 - closed_pocket_acidic_ph) / 0.20) if closed_pocket_acidic_ph < 7.20 else 0.0
            f_viable_dynamic = max(0.0, f_viable_dynamic * math.exp(-(k_hypox_h + k_perox_h + k_alk_h + k_acid_h) * dt_h))

        if t_h in t_eval_hours_report:
            time_series.append(
                {
                    "time_hours": t_h,
                    "cao2_molar_inventory_remaining_mmol": round(n_rem_mmol, 4),
                    "cao2_solid_inventory_remaining_fraction": round(m_rem_frac, 4),
                    "iec_vascular_anastomosis_fraction": round(v_perf, 4),
                    "center_z0_po2_mmhg": round(center_p, 2),
                    "min_slab_po2_mmhg": round(min_p, 2),
                    "peak_interstitial_h2o2_uM": round(h2o2_peak_operative_uM, 3),
                    "peak_interstitial_ph": round(local_ph, 3),
                    "min_closed_pocket_acidic_ph": round(closed_pocket_acidic_ph, 3),
                    "coupled_dynamic_viable_tissue_fraction": round(f_viable_dynamic, 4),
                }
            )

    # Solve nonlinear spherical Michaelis-Menten BVP inside R = 60 um (120 um), R = 50 um (100 um DX-b), R = 40 um (80 um), and R = 150 um (300 um) clusters
    cluster_bvp_ocr_mult = float(cluster_endocrine_ocr_multiplier) if cluster_endocrine_ocr_multiplier is not None else effective_ocr_mult
    bvp_r60 = solve_spherical_cluster_po2_bvp(
        min_po2_over_all_t,
        0.0060,
        phi_islet_in_slab=local_phi_islet,
        d_hydrogel_override=d_o2_hydrogel_override_cm2_s,
        ocr_multiplier=cluster_bvp_ocr_mult,
    )
    bvp_r50_100um = solve_spherical_cluster_po2_bvp(
        min_po2_over_all_t,
        0.0050,
        phi_islet_in_slab=local_phi_islet,
        d_hydrogel_override=d_o2_hydrogel_override_cm2_s,
        ocr_multiplier=cluster_bvp_ocr_mult,
    )
    bvp_r40_80um = solve_spherical_cluster_po2_bvp(
        min_po2_over_all_t,
        0.0040,
        phi_islet_in_slab=local_phi_islet,
        d_hydrogel_override=d_o2_hydrogel_override_cm2_s,
        ocr_multiplier=cluster_bvp_ocr_mult,
    )
    if math.isclose(float(prescribed_cluster_diameter_um), 120.0, rel_tol=1e-9):
        bvp_prescribed = bvp_r60
    elif math.isclose(float(prescribed_cluster_diameter_um), 100.0, rel_tol=1e-9):
        bvp_prescribed = bvp_r50_100um
    elif math.isclose(float(prescribed_cluster_diameter_um), 80.0, rel_tol=1e-9):
        bvp_prescribed = bvp_r40_80um
    else:
        bvp_prescribed = solve_spherical_cluster_po2_bvp(
            min_po2_over_all_t,
            float(prescribed_cluster_diameter_um) * 1e-4 * 0.5,
            phi_islet_in_slab=local_phi_islet,
            d_hydrogel_override=d_o2_hydrogel_override_cm2_s,
            ocr_multiplier=cluster_bvp_ocr_mult,
        )
    bvp_r60_slab_only_unscaled = (
        solve_spherical_cluster_po2_bvp(
            min_po2_over_all_t,
            0.0060,
            phi_islet_in_slab=local_phi_islet,
            d_hydrogel_override=d_o2_hydrogel_override_cm2_s,
            ocr_multiplier=1.0,
        )
        if abs(cluster_bvp_ocr_mult - 1.0) > 1e-12
        else bvp_r60
    )
    bvp_r60_ocr_propagated = bvp_r60
    bvp_r150 = solve_spherical_cluster_po2_bvp(
        min_po2_over_all_t,
        0.0150,
        phi_islet_in_slab=local_phi_islet,
        d_hydrogel_override=d_o2_hydrogel_override_cm2_s,
        ocr_multiplier=cluster_bvp_ocr_mult,
    )

    rem_36_sc = max(0.0, float(sol_y_sc[0, 36]) / n_cao2_initial_mmol) if n_cao2_initial_mmol > 0 else 0.0
    rem_72_sc = max(0.0, float(sol_y_sc[0, 72]) / n_cao2_initial_mmol) if n_cao2_initial_mmol > 0 else 0.0
    rem_168_sc = max(0.0, float(sol_y_sc[0, 168]) / n_cao2_initial_mmol) if n_cao2_initial_mmol > 0 else 0.0
    rem_240_sc = max(0.0, float(sol_y_sc[0, 240]) / n_cao2_initial_mmol) if n_cao2_initial_mmol > 0 else 0.0
    rem_336_sc = max(0.0, float(sol_y_sc[0, -1]) / n_cao2_initial_mmol) if n_cao2_initial_mmol > 0 else 0.0
    gb_72 = _ginstling_brounshtein_hydrolyzed_fraction(72.0, cao2_half_life_h) if n_cao2_initial_mmol > 0 else 0.0
    gb_168 = _ginstling_brounshtein_hydrolyzed_fraction(168.0, cao2_half_life_h) if n_cao2_initial_mmol > 0 else 0.0
    gb_240 = _ginstling_brounshtein_hydrolyzed_fraction(240.0, cao2_half_life_h) if n_cao2_initial_mmol > 0 else 0.0
    gb_336 = _ginstling_brounshtein_hydrolyzed_fraction(336.0, cao2_half_life_h) if n_cao2_initial_mmol > 0 else 0.0
    t_full_sc_h = cao2_half_life_h / (1.0 - (0.5 ** (1.0 / 3.0))) if n_cao2_initial_mmol > 0 else 0.0

    result = {
        "regime_id": regime_id,
        "areal_loading_ieq_cm2": round(sigma_loading, 4),
        "cell_intrinsic_ocr_multiplier": round(effective_ocr_mult, 6),
        "cluster_endocrine_ocr_multiplier": round(cluster_bvp_ocr_mult, 6),
        "prescribed_cluster_diameter_um": round(float(prescribed_cluster_diameter_um), 2),
        "spatial_control_volume_ledger": geometry_ledger,
        "min_slab_po2_unrounded_mmhg": min_po2_over_all_t,
        "release_kinetics_law": release_kinetics_law,
        "primary_oxygen_gate_supply_closure": "uniform",
        "conservative_oxygen_qualification_supply_closure": "gel_only",
        "demand_spatial_mode": demand_spatial_mode,
        "f_chem_initial": f_chem_initial,
        "spatial_distribution_mode": spatial_mode,
        "cao2_hydrolysis_half_life_hours": cao2_half_life_h,
        "cao2_initial_molar_inventory_mmol": round(n_cao2_initial_mmol, 3),
        "cao2_initial_mass_mg_in_7cm3_slab": round(cao2_mass_initial_mg, 1),
        "catalase_coformulated": catalase_present,
        "hour0_h2o2_to_o2_disproportionation_yield_fraction": round(hour0_h2o2_to_o2_yield_fraction, 4),
        "catalase_michaelis_menten_and_inactivation_audit_v80_022": {
            "km_catalase_uM": 25000.0,
            "nonlinear_kinetics_solver": "NODEWISE_NEWTON_RESIDUAL_VERIFIED",
            "max_residual_uM_s": max_peroxide_residual_uM_s,
            "max_solver_iterations": max_peroxide_iterations,
            "assumed_enzyme_inactivation_half_life_hours": catalase_half_life_h,
            "max_interstitial_h2o2_with_mm_and_168h_decay_uM": round(max_h2o2_uM_with_cat_decay_over_all_t, 3),
            "passes_5uM_peroxide_gate_under_enzyme_decay": bool(max_h2o2_uM_with_cat_decay_over_all_t <= 5.0),
        },
        "shrinking_core_2_3_remaining_fraction_at_36h_and_72h": {
            "remaining_fraction_36h_first_order": round(math.exp(-k_hyd_h * 36.0), 4) if n_cao2_initial_mmol > 0 else 0.0,
            "remaining_fraction_36h_shrinking_core": round(rem_36_sc, 4),
            "remaining_fraction_72h_first_order": round(math.exp(-k_hyd_h * 72.0), 4) if n_cao2_initial_mmol > 0 else 0.0,
            "remaining_fraction_72h_shrinking_core": round(rem_72_sc, 4),
            "hydrolyzed_fraction_72h_first_order": round(1.0 - math.exp(-k_hyd_h * 72.0), 6) if n_cao2_initial_mmol > 0 else 0.0,
            "hydrolyzed_fraction_72h_shrinking_core": round(1.0 - rem_72_sc, 6) if n_cao2_initial_mmol > 0 else 0.0,
            "hydrolyzed_fraction_72h_diffusion_controlled_ginstling_brounshtein_t12_68h": round(gb_72, 6),
            "remaining_fraction_168h_first_order": round(math.exp(-k_hyd_h * 168.0), 4) if n_cao2_initial_mmol > 0 else 0.0,
            "remaining_fraction_168h_shrinking_core": round(rem_168_sc, 4),
            "hydrolyzed_fraction_168h_diffusion_controlled_ginstling_brounshtein_t12_68h": round(gb_168, 6),
            "remaining_fraction_240h_first_order": round(math.exp(-k_hyd_h * 240.0), 4) if n_cao2_initial_mmol > 0 else 0.0,
            "remaining_fraction_240h_shrinking_core": round(rem_240_sc, 4),
            "hydrolyzed_fraction_240h_diffusion_controlled_ginstling_brounshtein_t12_68h": round(gb_240, 6),
            "remaining_fraction_336h_first_order": round(math.exp(-k_hyd_h * 336.0), 4) if n_cao2_initial_mmol > 0 else 0.0,
            "remaining_fraction_336h_shrinking_core": round(rem_336_sc, 4),
            "hydrolyzed_fraction_336h_first_order": round(1.0 - math.exp(-k_hyd_h * 336.0), 6) if n_cao2_initial_mmol > 0 else 0.0,
            "hydrolyzed_fraction_336h_shrinking_core": round(1.0 - rem_336_sc, 6) if n_cao2_initial_mmol > 0 else 0.0,
            "hydrolyzed_fraction_336h_diffusion_controlled_ginstling_brounshtein_t12_68h": round(gb_336, 4),
            "hydrolyzed_fraction_336h_diffusion_controlled_ginstling_brounshtein_t12_68h_exact": round(gb_336, 6),
            "reaction_shrinking_core_full_depletion_time_hours": round(t_full_sc_h, 2),
            "kinetic_law_discrimination_note_argon_r2": (
                "At t = 72 h under a unified half-life t_1/2 = 68.0 h, first-order (52.00% [51.9977%] hydrolyzed), "
                "reaction-controlled shrinking-core (52.26% [52.2585%] hydrolyzed), and diffusion-controlled "
                "Ginstling-Brounshtein shrinking-core (51.22% [51.2217%] hydrolyzed; note 51.61% corresponds to "
                "uncalibrated t_1/2 = 66.52 h) differ by 1.04 pp (1.0368 pp; 0.65 pp under uncalibrated t_1/2 = 66.52 h); "
                "extending the Stage-0 coupon assay across 168 h, 240 h, and 336 h resolves the three laws (at 336 h and "
                "unified t_1/2 = 68.0 h: 96.74% [96.7438%] hydrolyzed [first-order], 100.0% hydrolyzed at t_full = 329.62 h "
                "[reaction-controlled shrinking-core], and 89.58% [89.5808%] hydrolyzed [diffusion-controlled "
                "Ginstling-Brounshtein]; whereas uncalibrated t_1/2 ~ 81.8-88 h yields 94.2% vs 82.1%; AUDIT-REF & AUDIT-REF)."
            ),
        },
        "buffer_capacity_mM_per_pH_unit": BETA_BUF_MM_PER_PH,
        "hourly_grid_extremum_evaluation_points": len(t_hourly_grid),
        "time_of_min_slab_po2_hours": time_of_min_po2_h,
        "min_slab_po2_across_14_days_mmhg": round(min_po2_over_all_t, 2),
        "min_120um_cluster_core_po2_mmhg": bvp_r60["core_po2_nonlinear_mm_mmhg"],
        "min_120um_cluster_core_po2_unrounded_mmhg": bvp_r60["spherical_bvp_solver_diagnostics"]["raw_core_po2_mmhg"],
        "min_120um_cluster_core_po2_zero_order_krogh_mmhg": bvp_r60["core_po2_zero_order_krogh_mmhg"],
        "wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001": {
            "wigner_seitz_outer_radius_um": bvp_r60["wigner_seitz_outer_radius_um"],
            "wigner_seitz_outer_radius_exact_um": bvp_r60["wigner_seitz_outer_radius_exact_um"],
            "two_zone_fv_uniform_supply_surface_po2_mmhg": bvp_r60["wigner_seitz_two_zone_fv_uniform_supply_surface_po2_mmhg"],
            "two_zone_fv_uniform_supply_surface_po2_unrounded_mmhg": bvp_r60["wigner_seitz_two_zone_fv_uniform_supply_surface_po2_unrounded_mmhg"],
            "two_zone_fv_uniform_supply_120um_core_po2_mmhg": bvp_r60["wigner_seitz_two_zone_fv_uniform_supply_core_po2_mmhg"],
            "two_zone_fv_uniform_supply_120um_core_po2_unrounded_mmhg": bvp_r60["wigner_seitz_two_zone_fv_uniform_supply_core_po2_unrounded_mmhg"],
            "two_zone_fv_gel_only_supply_surface_po2_mmhg": bvp_r60["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_mmhg"],
            "two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg": bvp_r60["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"],
            "two_zone_fv_gel_only_supply_120um_core_po2_mmhg": bvp_r60["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_mmhg"],
            "two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg": bvp_r60["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"],
            "cluster_surface_po2_below_15mmHg_gsis_threshold_uniform": bool(
                bvp_r60["wigner_seitz_two_zone_fv_uniform_supply_surface_po2_unrounded_mmhg"] < 15.0
            ),
            "cluster_surface_po2_below_15mmHg_gsis_threshold_gel_only": bool(
                bvp_r60["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"] < 15.0
            ),
            "ewald_analytic_shell_diagnostic_surface_po2_mmhg": bvp_r60["ewald_analytic_shell_diagnostic_surface_po2_mmhg"],
            "ewald_analytic_shell_diagnostic_core_po2_mmhg": bvp_r60["ewald_analytic_shell_diagnostic_core_po2_mmhg"],
            "fluctuation_corrected_cluster_surface_po2_mmhg": bvp_r60["wigner_seitz_fluctuation_corrected_surface_po2_mmhg"],
            "fluctuation_corrected_120um_core_po2_mmhg": bvp_r60["wigner_seitz_fluctuation_corrected_core_po2_mmhg"],
            "unsubtracted_shell_cluster_surface_po2_mmhg": bvp_r60["wigner_seitz_unsubtracted_shell_surface_po2_mmhg"],
            "unsubtracted_shell_120um_core_po2_mmhg": bvp_r60["wigner_seitz_unsubtracted_shell_core_po2_mmhg"],
            "passes_2p0mmHg_core_gate_under_two_zone_fv_uniform_supply": bool(
                bvp_r60["wigner_seitz_two_zone_fv_uniform_supply_core_po2_unrounded_mmhg"] >= 2.0
            ),
            "passes_2p0mmHg_core_gate_under_two_zone_fv_gel_only_supply": bool(
                bvp_r60["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"] >= 2.0
            ),
            "passes_2p0mmHg_core_gate_under_wigner_seitz_shell": bool(
                bvp_r60["wigner_seitz_two_zone_fv_uniform_supply_core_po2_unrounded_mmhg"] >= 2.0
            ),
            "spherical_bvp_solver_diagnostics": bvp_r60["spherical_bvp_solver_diagnostics"],
        },
        "wigner_seitz_100um_dxb_cluster_pericellular_shell_audit_dec064": {
            "wigner_seitz_outer_radius_um": bvp_r50_100um["wigner_seitz_outer_radius_um"],
            "wigner_seitz_outer_radius_exact_um": bvp_r50_100um["wigner_seitz_outer_radius_exact_um"],
            "two_zone_fv_gel_only_supply_surface_po2_mmhg": bvp_r50_100um["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_mmhg"],
            "two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg": bvp_r50_100um["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"],
            "two_zone_fv_gel_only_supply_100um_core_po2_mmhg": bvp_r50_100um["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_mmhg"],
            "two_zone_fv_gel_only_supply_100um_core_po2_unrounded_mmhg": bvp_r50_100um["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"],
            "passes_2p0mmHg_core_gate_under_two_zone_fv_gel_only_supply": bool(
                bvp_r50_100um["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"] >= 2.0
            ),
            "passes_15mmHg_surface_gsis_gate_under_two_zone_fv_gel_only_supply": bool(
                bvp_r50_100um["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"] >= 15.0
            ),
        },
        "wigner_seitz_80um_cluster_pericellular_shell_audit_dec064": {
            "wigner_seitz_outer_radius_um": bvp_r40_80um["wigner_seitz_outer_radius_um"],
            "wigner_seitz_outer_radius_exact_um": bvp_r40_80um["wigner_seitz_outer_radius_exact_um"],
            "two_zone_fv_gel_only_supply_surface_po2_mmhg": bvp_r40_80um["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_mmhg"],
            "two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg": bvp_r40_80um["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"],
            "two_zone_fv_gel_only_supply_80um_core_po2_mmhg": bvp_r40_80um["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_mmhg"],
            "two_zone_fv_gel_only_supply_80um_core_po2_unrounded_mmhg": bvp_r40_80um["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"],
            "passes_2p0mmHg_core_gate_under_two_zone_fv_gel_only_supply": bool(
                bvp_r40_80um["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"] >= 2.0
            ),
            "passes_15mmHg_surface_gsis_gate_under_two_zone_fv_gel_only_supply": bool(
                bvp_r40_80um["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"] >= 15.0
            ),
        },
        "wigner_seitz_prescribed_cluster_pericellular_shell_audit_dec064": {
            "prescribed_cluster_diameter_um": round(float(prescribed_cluster_diameter_um), 2),
            "wigner_seitz_outer_radius_um": bvp_prescribed["wigner_seitz_outer_radius_um"],
            "wigner_seitz_outer_radius_exact_um": bvp_prescribed["wigner_seitz_outer_radius_exact_um"],
            "two_zone_fv_gel_only_supply_surface_po2_mmhg": bvp_prescribed["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_mmhg"],
            "two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg": bvp_prescribed["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"],
            "two_zone_fv_gel_only_supply_core_po2_mmhg": bvp_prescribed["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_mmhg"],
            "two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg": bvp_prescribed["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"],
            "passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate": bool(
                slab_solvers_converged
                and _required_oxygen_solvers_converged(bvp_prescribed)
                and min_po2_over_all_t >= 15.0
                and bvp_prescribed["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"] >= 2.0
                and max_h2o2_uM_with_cat_decay_over_all_t <= 5.0
                and max_ph_over_all_t <= 7.60
                and min_closed_pocket_acidic_ph_over_all_t >= 7.20
            ),
            "passes_cluster_surface_15mmHg_full_first_phase_gsis_gate_gel_only": bool(
                slab_solvers_converged
                and _required_oxygen_solvers_converged(bvp_prescribed)
                and bvp_prescribed["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"] >= 15.0
            ),
        },
        "min_300um_cluster_core_po2_mmhg": bvp_r150["core_po2_nonlinear_mm_mmhg"],
        "min_300um_cluster_core_po2_zero_order_krogh_mmhg": bvp_r150["core_po2_zero_order_krogh_mmhg"],
        "spherical_300um_bvp_solver_diagnostics": bvp_r150["spherical_bvp_solver_diagnostics"],
        "max_interstitial_h2o2_uM": round(max_h2o2_uM_over_all_t, 3),
        "max_interstitial_h2o2_unrounded_uM": max_h2o2_uM_over_all_t,
        "max_interstitial_h2o2_at_lamina_interface_uM": round(max_h2o2_at_lamina_interface_uM_over_all_t, 2),
        "max_interstitial_h2o2_at_lamina_interface_unrounded_uM": max_h2o2_at_lamina_interface_uM_over_all_t,
        "max_interstitial_h2o2_at_lamina_interface_nearest_node_um": round(float(z_int_abs[lamina_if_int_idx]) * 1e4, 2),
        "max_interstitial_h2o2_at_lamina_interface_interpolated_uM": round(max_h2o2_at_lamina_interface_interp_uM_over_all_t, 2),
        "max_interstitial_h2o2_at_lamina_interface_interpolated_unrounded_uM": max_h2o2_at_lamina_interface_interp_uM_over_all_t,
        "two_scale_ocr_propagated_120um_wigner_seitz_audit_astra_s3": {
            "areal_loading_ieq_cm2": round(sigma_loading, 4),
            "local_phi_islet_for_wigner_seitz": round(local_phi_islet, 7),
            "demand_multiplier_extra_applied_to_radial_bvp": round(float(effective_ocr_mult), 6),
            "two_zone_fv_gel_only_supply_surface_po2_mmhg": bvp_r60_ocr_propagated["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_mmhg"],
            "two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg": bvp_r60_ocr_propagated["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"],
            "two_zone_fv_gel_only_supply_120um_core_po2_mmhg": bvp_r60_ocr_propagated["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_mmhg"],
            "two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg": bvp_r60_ocr_propagated["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"],
            "slab_only_unscaled_radial_bvp_comparator": {
                "two_zone_fv_gel_only_supply_surface_po2_mmhg": bvp_r60_slab_only_unscaled["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_mmhg"],
                "two_zone_fv_gel_only_supply_120um_core_po2_mmhg": bvp_r60_slab_only_unscaled["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_mmhg"],
            },
        },
        "max_interstitial_ph": round(max_ph_over_all_t, 3),
        "max_interstitial_ph_unrounded": max_ph_over_all_t,
        "closed_pocket_unresupplied_co2_max_ph_v80_021": round(max_closed_pocket_ph_over_all_t, 3),
        "closed_pocket_metabolic_acidification_min_ph_v80_095": round(min_closed_pocket_acidic_ph_over_all_t, 3),
        "closed_pocket_metabolic_acidification_min_ph_unrounded": min_closed_pocket_acidic_ph_over_all_t,
        "coupled_dynamic_14d_viable_endocrine_fraction_v80_066": round(f_viable_dynamic, 4),
        "coupled_dynamic_14d_viable_endocrine_fraction_unrounded": f_viable_dynamic,
        "slab_oxygen_solver_diagnostics": {"converged": slab_solvers_converged,
                                             "max_residual_inf_mmhg_s": max_slab_residual_mmhg_s},
        "required_120um_oxygen_solvers_converged": slab_solvers_converged and _required_oxygen_solvers_converged(bvp_r60),
        "passes_all_oxygen_peroxide_and_ph_gates": bool(
            slab_solvers_converged and _required_oxygen_solvers_converged(bvp_r60)
            and min_po2_over_all_t >= 15.0
            and bvp_r60["spherical_bvp_solver_diagnostics"]["raw_core_po2_mmhg"] >= 2.0
            and bvp_r60["wigner_seitz_two_zone_fv_uniform_supply_core_po2_unrounded_mmhg"] >= 2.0
            and max_h2o2_uM_over_all_t <= 5.0
            and max_h2o2_uM_with_cat_decay_over_all_t <= 5.0
            and max_ph_over_all_t <= 7.60
            and min_closed_pocket_acidic_ph_over_all_t >= 7.20
        ),
        "strict_nonoxygen_gates_passed": bool(
            max_h2o2_uM_with_cat_decay_over_all_t <= 5.0
            and max_ph_over_all_t <= 7.60
            and min_closed_pocket_acidic_ph_over_all_t >= 7.20
        ),
        "passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate": bool(
            slab_solvers_converged and _required_oxygen_solvers_converged(bvp_r60)
            and min_po2_over_all_t >= 15.0
            and bvp_r60["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"] >= 2.0
            and max_h2o2_uM_with_cat_decay_over_all_t <= 5.0
            and max_ph_over_all_t <= 7.60
            and min_closed_pocket_acidic_ph_over_all_t >= 7.20
        ),
        "passes_cluster_surface_15mmHg_full_first_phase_gsis_gate_uniform": bool(
            slab_solvers_converged and _required_oxygen_solvers_converged(bvp_r60)
            and bvp_r60["wigner_seitz_two_zone_fv_uniform_supply_surface_po2_unrounded_mmhg"] >= 15.0
        ),
        "passes_cluster_surface_15mmHg_full_first_phase_gsis_gate_gel_only": bool(
            slab_solvers_converged and _required_oxygen_solvers_converged(bvp_r60)
            and bvp_r60["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"] >= 15.0
        ),
        "trajectory_0h_to_336h": time_series,
    }
    if _include_hourly_slab_po2_vector:
        result["hourly_min_slab_po2_unrounded_mmhg"] = hourly_min_slab_po2_mmhg

    core_raw = bvp_r60["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"]
    assessment = {"status": ("NUMERICAL_SOLVER_UNRESOLVED" if not result["required_120um_oxygen_solvers_converged"] else
                             "FAILED_PHYSICAL_GATE" if not result["passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate"] else "MARGIN_SCREENED_NOT_REFINEMENT_CERTIFIED"),
                  "raw_core_margin_over_2mmHg": core_raw - 2.0,
                  "refinement_applied": False}
    # A near-threshold pass is never certified from rounded/coarse values. The 201/401 mesh
    # difference is a numerical allowance, not a proof of continuum accuracy or physical validity.
    if _assess_numerical_gate and (abs(core_raw - 2.0) <= 0.5 or abs(min_po2_over_all_t - 15.0) <= 0.5):
        refs = [_run_single_pouch_pde_regime(
            regime_id, f_chem_initial, spatial_mode, cao2_half_life_h, catalase_present,
            iec_max_perfusion_fraction, boundary_po2_mmhg=boundary_po2_mmhg,
            inosculation_t50_h=inosculation_t50_h, demand_multiplier_extra=demand_multiplier_extra,
            release_kinetics_law=release_kinetics_law, gb_regularization_mode=gb_regularization_mode, nz_override=n,
            k_perf_max_s_override=k_perf_max_s_override, demand_spatial_mode=demand_spatial_mode,
            lamina_d_o2_scale=lamina_d_o2_scale, catalase_half_life_h=catalase_half_life_h,
            acid_pocket_residence_time_s=acid_pocket_residence_time_s,
            lamina_half_width_fraction=a_frac,
            catalase_spatial_mode=catalase_spatial_mode,
            catalase_k1_override_s_inv=catalase_k1_override_s_inv,
            d_o2_hydrogel_override_cm2_s=d_o2_hydrogel_override_cm2_s,
            perfusion_spatial_mode=perfusion_spatial_mode,
            external_standoff_um=external_standoff_um,
            areal_loading_ieq_cm2=sigma_loading,
            cell_intrinsic_ocr_multiplier=effective_ocr_mult,
            prescribed_cluster_diameter_um=prescribed_cluster_diameter_um,
            zero_internal_vascular_state=zero_internal_vascular_state,
            _assess_numerical_gate=False)
            for n in (201, 401)]
        def raw_core(r):
            return r["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg"]
        fine = refs[-1]
        estimate = max(abs(raw_core(refs[1]) - raw_core(refs[0])), 1e-6)
        core_lo, core_hi = raw_core(fine)-estimate, raw_core(fine)+estimate
        slab_error = max(abs(refs[1]["min_slab_po2_unrounded_mmhg"] - refs[0]["min_slab_po2_unrounded_mmhg"]), 1e-6)
        slab_lo = fine["min_slab_po2_unrounded_mmhg"] - slab_error
        if not all(ref["required_120um_oxygen_solvers_converged"] for ref in refs):
            status = "NUMERICAL_SOLVER_UNRESOLVED"
        elif not fine["strict_nonoxygen_gates_passed"]:
            status = "FAILED_PHYSICAL_GATE"
        elif core_lo >= 2.0 and slab_lo >= 15.0:
            status = "PASS_WITH_REFINEMENT_ALLOWANCE"
        elif core_hi < 2.0 or fine["min_slab_po2_unrounded_mmhg"] + slab_error < 15.0:
            status = "FAIL_WITH_REFINEMENT_ALLOWANCE"
        else:
            status = "NUMERICALLY_UNRESOLVED"
        result["passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate"] = status == "PASS_WITH_REFINEMENT_ALLOWANCE"
        assessment = {"status": status, "refinement_applied": True,
                      "reference_mesh_nodes": [201, 401], "reference_401_core_unrounded_mmhg": raw_core(fine),
                      "estimated_core_discretization_error_mmhg": estimate,
                      "reference_core_interval_mmhg": [core_lo, core_hi],
                      "reference_slab_lower_allowance_mmhg": slab_lo,
                      "raw_core_margin_over_2mmHg": raw_core(fine)-2.0,
                      "qualification": "201/401 mesh difference allowance; not empirical validation or a rigorous continuum error bound"}
    result["strict_gel_only_numerical_gate_assessment"] = assessment
    result["physical_layout_qualification"] = {
        "status": "PREREGISTERED_PENDING",
        "exact_120um_outer_band_geometry_feasible": (
            geometry_ledger["diameter_120um_fits_wholly_in_outer_band"]
            if demand_spatial_mode == "outer_annulus" else None),
        "qualified_exact_product": False,
        "note": "Numerical oxygen/chemistry gates do not qualify material packing, finite-cluster placement, perfusion, or exact-product function.",
    }
    return result


def _realized_half_plateau_perfusion_time_hours(target_midpoint_t50_h: float, iec_max_perfusion_fraction: float = 0.97) -> float:
    """Compute the realized time (hours) when v_perf(t) reaches 0.5 * iec_max_perfusion_fraction under the 3h lag ODE."""
    if iec_max_perfusion_fraction <= 0.0:
        return math.nan
    t_dense = [0.05 * i for i in range(int(336.0 / 0.05) + 1)]

    def _target(t_h: float) -> float:
        exponent = -(t_h - target_midpoint_t50_h) / 8.0
        return 0.0 if exponent > math.log(sys.float_info.max) else iec_max_perfusion_fraction / (1.0 + math.exp(exponent))

    def _ode(t_h: float, y: np.ndarray) -> np.ndarray:
        return np.array([(_target(t_h) - y[0]) / 3.0])

    v_vec = rk4_integrate(_ode, (0.0, 336.0), np.array([0.01]), t_dense, dt_max=0.05)[0]
    half_target = 0.5 * iec_max_perfusion_fraction
    idx = int(np.searchsorted(v_vec, half_target))
    if 0 < idx < len(t_dense):
        v0, v1 = float(v_vec[idx - 1]), float(v_vec[idx])
        t0, t1 = float(t_dense[idx - 1]), float(t_dense[idx])
        return t0 + (half_target - v0) * (t1 - t0) / max(1e-15, v1 - v0)
    return float(t_dense[-1])


def _build_formulation_specific_cao2_half_life_sensitivity_iip_0010() -> Dict[str, Any]:
    """Build the IIP-0010 fixed-inventory two-sided CaO2 half-life x kinetic-law x formulation sensitivity grid."""
    half_lives_h = [24.0, 34.0, 48.0, 68.0, 87.0, 110.0, 130.0]
    laws = ["first_order", "shrinking_core", "ginstling_brounshtein"]
    timings_t50_h = [36.0, 60.0]
    formulations = [
        {
            "formulation_id": "LAYOUT_B_31P25WT_119UM_LAMINA_DESIGNS_A_AND_B",
            "cao2_wt_pct": 31.25,
            "cao2_solid_vol_pct": 13.86,
            "lamina_thickness_um": 119.0,
            "outer_band_thickness_each_um": 115.5,
            "lamina_half_width_fraction": CENTRAL_LAMINA_HALF_WIDTH_FRACTION,
            "catalase_spatial_mode": "uniform_slab",
            "catalase_k1_override_s_inv": None,
        },
        {
            "formulation_id": "STAGE0_DESIGN_X_46P39WT_100UM_LAMINA_LOCALIZED_CATALASE",
            "cao2_wt_pct": 46.39,
            "cao2_solid_vol_pct": 23.45,
            "lamina_thickness_um": 100.0,
            "outer_band_thickness_each_um": 125.0,
            "lamina_half_width_fraction": 100.0 / 350.0,
            "catalase_spatial_mode": "central_lamina_masked",
            "catalase_k1_override_s_inv": 18.0 * 0.42,
        },
    ]
    phi_slab_2500 = (2500.0 * VOL_1_IEQ_CM3) / 0.0350
    rows: list[Dict[str, Any]] = []
    passing_windows: list[Dict[str, Any]] = []

    for form in formulations:
        a_frac = float(form["lamina_half_width_fraction"])
        local_phi = phi_slab_2500 / (1.0 - a_frac)
        for law in laws:
            for t50_h in timings_t50_h:
                passing_hl: list[float] = []
                for hl_h in half_lives_h:
                    r = _run_single_pouch_pde_regime(
                        f"IIP0010_{form['formulation_id']}_{law.upper()}_T50_{int(t50_h)}H_HL_{int(hl_h)}H",
                        0.45,
                        "central",
                        hl_h,
                        True,
                        0.97,
                        inosculation_t50_h=t50_h,
                        release_kinetics_law=law,
                        nz_override=51,
                        demand_spatial_mode="outer_annulus",
                        lamina_d_o2_scale=0.42 ** 1.5,
                        lamina_half_width_fraction=a_frac,
                        catalase_spatial_mode=str(form["catalase_spatial_mode"]),
                        catalase_k1_override_s_inv=form["catalase_k1_override_s_inv"],
                        _assess_numerical_gate=False,
                    )
                    min_slab = float(r["min_slab_po2_unrounded_mmhg"])
                    ws120 = r["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]
                    surf120 = float(ws120["two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"])
                    core120 = float(ws120["two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg"])
                    bvp100 = solve_spherical_cluster_po2_bvp(min_slab, 0.0050, phi_islet_in_slab=local_phi)
                    surf100 = float(bvp100["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"])
                    core100 = float(bvp100["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"])
                    max_h2o2 = float(r["max_interstitial_h2o2_unrounded_uM"])
                    max_ph = float(r["max_interstitial_ph_unrounded"])
                    passes_100um = bool(surf100 >= 15.0 and core100 >= 2.0 and max_h2o2 <= 5.0 and max_ph <= 7.50)
                    if passes_100um:
                        passing_hl.append(hl_h)
                    rows.append({
                        "formulation_id": form["formulation_id"],
                        "cao2_wt_pct": form["cao2_wt_pct"],
                        "cao2_solid_vol_pct": form["cao2_solid_vol_pct"],
                        "lamina_thickness_um": form["lamina_thickness_um"],
                        "release_kinetics_law": law,
                        "inosculation_t50_h": t50_h,
                        "cao2_half_life_h": hl_h,
                        "fixed_cao2_inventory_mmol": round(float(r["cao2_initial_molar_inventory_mmol"]), 4),
                        "fixed_cao2_inventory_mg": round(float(r["cao2_initial_mass_mg_in_7cm3_slab"]), 2),
                        "min_slab_po2_mmhg": round(min_slab, 3),
                        "time_of_min_slab_po2_hours": r["time_of_min_slab_po2_hours"],
                        "gel_only_120um_surface_po2_mmhg": round(surf120, 3),
                        "gel_only_120um_core_po2_mmhg": round(core120, 3),
                        "gel_only_100um_surface_po2_mmhg": round(surf100, 3),
                        "gel_only_100um_core_po2_mmhg": round(core100, 3),
                        "max_interstitial_h2o2_uM": round(max_h2o2, 3),
                        "max_interstitial_ph": round(max_ph, 3),
                        "passes_100um_15mmHg_surface_2mmHg_core_5uM_h2o2_gate": passes_100um,
                    })
                passing_windows.append({
                    "formulation_id": form["formulation_id"],
                    "cao2_wt_pct": form["cao2_wt_pct"],
                    "cao2_solid_vol_pct": form["cao2_solid_vol_pct"],
                    "release_kinetics_law": law,
                    "inosculation_t50_h": t50_h,
                    "passing_half_lives_h_for_100um_clusters": passing_hl,
                    "min_passing_half_life_on_grid_h": min(passing_hl) if passing_hl else None,
                    "max_passing_half_life_on_grid_h": max(passing_hl) if passing_hl else None,
                })

    return {
        "iip_id": "IIP-0010",
        "decision_id": "DEC-088",
        "open_question_id": "OQ-005",
        "credit": "giufra (GitHub @frafra013; https://github.com/openislet/openislet/issues/10)",
        "parameter_status_of_68h": "unvalidated_formulation_specific_reference_target_not_conserved_across_wt_pct_or_microbead_psd",
        "fixed_inventory_constraint": "Conserves n_CaO2(0) = 10.9811 mmol (791.49 mg in 7.00 cm^3 active slab) across all half-lives, laws, and formulations so shorter t_1/2 raises early H2O2 flux and accelerates pre-anastomosis depletion whereas longer t_1/2 reduces Hour-0 O2 flux.",
        "particle_and_microbead_psd_status": {
            "cao2_crystal_particle_size_distribution_um": "unknown_pending_stage0_measurement",
            "pdms_cao2_composite_microbead_diameter_distribution_um": "unknown_pending_stage0_measurement",
            "primary_literature_anchors": [
                "Pedraza et al. 2012 PNAS PMID:22371586 (25 wt% CaO2 monolithic PDMS disk)",
                "Accolla et al. 2023 Adv Healthc Mater PMID:36971050 (microscale OxySite PDMS-CaO2 microbeads)",
                "Ke et al. 2022 Int J Mol Sci PMID:35743287 (tunable CaO2 microparticle oxygen release)",
            ],
        },
        "half_life_grid_hours": half_lives_h,
        "passing_half_life_windows_by_formulation_law_and_t50": passing_windows,
        "grid_rows": rows,
    }


def _build_joint_vascular_timing_and_exchange_sensitivity_iip_0002() -> Dict[str, Any]:
    """Build the IIP-0002 joint vascular timing-by-exchange sensitivity grid and provenance audit."""
    phi_lead = (2500.0 * VOL_1_IEQ_CM3) / 0.0350  # 0.1262247

    def _bisect_slab_po2_for_cluster_threshold(key: str, threshold_mmhg: float) -> float:
        lo, hi = 0.0, 40.0
        for _ in range(44):
            mid = 0.5 * (lo + hi)
            val = float(solve_spherical_cluster_po2_bvp(mid, 0.0060, phi_islet_in_slab=phi_lead)[key])
            if val < threshold_mmhg:
                lo = mid
            else:
                hi = mid
        return 0.5 * (lo + hi)

    slab_po2_crit_gel_surf_15mmhg = _bisect_slab_po2_for_cluster_threshold(
        "wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg", 15.0
    )
    slab_po2_crit_gel_core_2p0mmhg = _bisect_slab_po2_for_cluster_threshold(
        "wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg", 2.0
    )
    slab_po2_crit_gel_core_0p5mmhg = _bisect_slab_po2_for_cluster_threshold(
        "wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg", 0.5
    )

    bvp_cache: dict[float, Dict[str, Any]] = {}

    def _cached_r60_bvp(p_slab_mmhg: float) -> Dict[str, Any]:
        key = round(float(p_slab_mmhg), 8)
        if key not in bvp_cache:
            bvp_cache[key] = solve_spherical_cluster_po2_bvp(float(p_slab_mmhg), 0.0060, phi_islet_in_slab=phi_lead)
        return bvp_cache[key]

    timings_t50_h = [36.0, 40.0, 44.0, 48.0, 52.0, 56.0, 60.0, 96.0, 168.0]
    kp_values = [0.0944, 0.1100, 0.1400, 0.1800]
    release_laws = ["first_order", "shrinking_core"]
    realized_t50_map = {t50: _realized_half_plateau_perfusion_time_hours(t50, 0.97) for t50 in timings_t50_h}
    sample_hours_export = [0, 2, 6, 12, 24, 48, 72, 96, 120, 168, 336]

    def _summarize_regime_row(
        r: Dict[str, Any],
        *,
        law: str,
        t50_h: float | None,
        kp: float,
        timing_scope: str,
        include_cluster_trajectory: bool,
    ) -> Dict[str, Any]:
        ws = r["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]
        hourly_slab = r.get("hourly_min_slab_po2_unrounded_mmhg")
        has_hourly_slab = isinstance(hourly_slab, list) and len(hourly_slab) > 0
        min_slab_raw = float(r["min_slab_po2_unrounded_mmhg"])
        gel_surf_raw = float(ws["two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"])
        gel_core_raw = float(ws["two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg"])
        uni_surf_raw = float(ws["two_zone_fv_uniform_supply_surface_po2_unrounded_mmhg"])
        uni_core_raw = float(
            ws.get(
                "two_zone_fv_uniform_supply_120um_core_po2_unrounded_mmhg",
                ws["two_zone_fv_uniform_supply_120um_core_po2_mmhg"],
            )
        )
        dir_core_raw = float(r["min_120um_cluster_core_po2_unrounded_mmhg"])
        converged = bool(r["required_120um_oxygen_solvers_converged"])
        row: Dict[str, Any] = {
            "regime_id": r["regime_id"],
            "release_kinetics_law": law,
            "timing_scope": timing_scope,
            "target_curve_midpoint_t50_h": t50_h,
            "realized_half_plateau_perfusion_time_h": (
                round(realized_t50_map[t50_h], 4) if t50_h is not None else None
            ),
            "realized_minus_target_midpoint_lag_h": (
                round(realized_t50_map[t50_h] - t50_h, 4) if t50_h is not None else None
            ),
            "coupled_internal_vascular_exchange_kp_s_inv": kp,
            "iec_max_perfusion_fraction": 0.0 if kp == 0.0 else 0.97,
            "zero_internal_vascular_state_enforced": bool(kp == 0.0),
            "cell_intrinsic_ocr_multiplier_gy004_consistent": 1.0,
            "vascular_stromal_demand_overhead_multiplier": 1.15,
            "time_of_min_slab_po2_hours": r["time_of_min_slab_po2_hours"],
            "min_slab_po2_mmhg": round(min_slab_raw, 3),
            "min_slab_po2_unrounded_mmhg": min_slab_raw,
            "gel_only_120um_surface_po2_mmhg": round(gel_surf_raw, 3),
            "gel_only_120um_surface_po2_unrounded_mmhg": gel_surf_raw,
            "gel_only_120um_core_po2_mmhg": round(gel_core_raw, 3),
            "gel_only_120um_core_po2_unrounded_mmhg": gel_core_raw,
            "uniform_120um_surface_po2_mmhg": round(uni_surf_raw, 3),
            "uniform_120um_surface_po2_unrounded_mmhg": uni_surf_raw,
            "uniform_120um_core_po2_mmhg": round(uni_core_raw, 3),
            "uniform_120um_core_po2_unrounded_mmhg": uni_core_raw,
            "dirichlet_upper_bound_120um_core_po2_mmhg": round(dir_core_raw, 3),
            "dirichlet_upper_bound_120um_core_po2_unrounded_mmhg": dir_core_raw,
            "max_interstitial_h2o2_uM": r["max_interstitial_h2o2_uM"],
            "max_interstitial_h2o2_unrounded_uM": r["max_interstitial_h2o2_unrounded_uM"],
            "max_interstitial_ph": r["max_interstitial_ph"],
            "max_interstitial_ph_unrounded": r["max_interstitial_ph_unrounded"],
            "min_closed_pocket_acidic_ph": r["closed_pocket_metabolic_acidification_min_ph_v80_095"],
            "min_closed_pocket_acidic_ph_unrounded": r.get(
                "closed_pocket_metabolic_acidification_min_ph_unrounded",
                r["closed_pocket_metabolic_acidification_min_ph_v80_095"],
            ),
            "coupled_dynamic_14d_viable_endocrine_fraction": r["coupled_dynamic_14d_viable_endocrine_fraction_v80_066"],
            "coupled_dynamic_14d_viable_endocrine_fraction_unrounded": r["coupled_dynamic_14d_viable_endocrine_fraction_unrounded"],
            "hours_below_15mmHg_slab_gate": (
                int(sum(1 for p_h in hourly_slab if p_h < 15.0)) if has_hourly_slab else None
            ),
            "hours_below_15mmHg_gel_only_surface_gate": (
                int(sum(1 for p_h in hourly_slab if p_h < slab_po2_crit_gel_surf_15mmhg)) if has_hourly_slab else None
            ),
            "hours_below_2p0mmHg_gel_only_core_gate": (
                int(sum(1 for p_h in hourly_slab if p_h < slab_po2_crit_gel_core_2p0mmhg)) if has_hourly_slab else None
            ),
            "hours_below_0p5mmHg_gel_only_core_gate": (
                int(sum(1 for p_h in hourly_slab if p_h < slab_po2_crit_gel_core_0p5mmhg)) if has_hourly_slab else None
            ),
            "required_120um_oxygen_solvers_converged": converged,
            "passes_15mmHg_slab_po2_gate": bool(converged and min_slab_raw >= 15.0),
            "passes_15mmHg_gel_only_cluster_surface_gsis_gate": bool(converged and gel_surf_raw >= 15.0),
            "passes_strict_2p0mmHg_gel_only_120um_core_gate": bool(
                converged and min_slab_raw >= 15.0 and gel_core_raw >= 2.0 and r["strict_nonoxygen_gates_passed"]
            ),
            "passes_2p0mmHg_uniform_120um_core_gate": bool(
                converged and min_slab_raw >= 15.0 and uni_core_raw >= 2.0 and r["strict_nonoxygen_gates_passed"]
            ),
            "passes_0p5mmHg_gel_only_anoxic_necrosis_core_gate": bool(converged and gel_core_raw >= 0.5),
        }
        if include_cluster_trajectory and has_hourly_slab:
            min_h_int = max(0, min(len(hourly_slab) - 1, int(round(float(r["time_of_min_slab_po2_hours"])))))
            hours_to_sample = sorted(set(sample_hours_export + [min_h_int]))
            traj_samples = []
            for h_idx in hours_to_sample:
                if 0 <= h_idx < len(hourly_slab):
                    p_h = float(hourly_slab[h_idx])
                    bvp_h = _cached_r60_bvp(p_h)
                    traj_samples.append(
                        {
                            "time_hours": float(h_idx),
                            "min_slab_po2_unrounded_mmhg": p_h,
                            "gel_only_120um_surface_po2_unrounded_mmhg": float(
                                bvp_h["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"]
                            ),
                            "gel_only_120um_core_po2_unrounded_mmhg": float(
                                bvp_h["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"]
                            ),
                            "uniform_120um_surface_po2_unrounded_mmhg": float(
                                bvp_h["wigner_seitz_two_zone_fv_uniform_supply_surface_po2_unrounded_mmhg"]
                            ),
                            "uniform_120um_core_po2_unrounded_mmhg": float(
                                bvp_h["wigner_seitz_two_zone_fv_uniform_supply_core_po2_unrounded_mmhg"]
                            ),
                        }
                    )
            row["unrounded_trajectory_samples"] = traj_samples
        return row

    joint_grid_rows: list[Dict[str, Any]] = []
    near_threshold_refinement_rows: list[Dict[str, Any]] = []
    for law in release_laws:
        for t50_h in timings_t50_h:
            scope = (
                "hypothetical_extreme_delay_stress_test"
                if t50_h in {96.0, 168.0}
                else ("primary_2x2_endpoint" if t50_h in {36.0, 60.0} else "intermediate_4h_step_gate_flip_resolution")
            )
            for kp in kp_values:
                r_cell = _run_single_pouch_pde_regime(
                    regime_id=f"IIP0002_{law.upper()}_T50_{int(t50_h)}H_KP_{kp:.4f}",
                    f_chem_initial=0.45,
                    spatial_mode="central",
                    cao2_half_life_h=68.0,
                    catalase_present=True,
                    iec_max_perfusion_fraction=0.97,
                    boundary_po2_mmhg=40.0,
                    inosculation_t50_h=t50_h,
                    demand_multiplier_extra=1.0,
                    release_kinetics_law=law,
                    k_perf_max_s_override=kp,
                    _include_hourly_slab_po2_vector=True,
                    _assess_numerical_gate=False,
                )
                row_summary = _summarize_regime_row(
                    r_cell,
                    law=law,
                    t50_h=t50_h,
                    kp=kp,
                    timing_scope=scope,
                    include_cluster_trajectory=(t50_h in {36.0, 60.0} or math.isclose(kp, 0.14, rel_tol=1e-9)),
                )
                joint_grid_rows.append(row_summary)

                # Grid-refinement check (Nz = 51, 101, 201) for any cell within 0.15 mmHg of 15.0 mmHg slab or 2.0/0.5 mmHg core gates:
                slab_val = row_summary["min_slab_po2_unrounded_mmhg"]
                gel_core_val = row_summary["gel_only_120um_core_po2_unrounded_mmhg"]
                uni_core_val = row_summary["uniform_120um_core_po2_unrounded_mmhg"]
                if (
                    abs(slab_val - 15.0) <= 0.15
                    or abs(gel_core_val - 2.0) <= 0.15
                    or abs(gel_core_val - 0.5) <= 0.10
                    or abs(uni_core_val - 2.0) <= 0.15
                ):
                    mesh_receipts = {}
                    for nz_ref in (51, 101, 201):
                        r_ref = (
                            r_cell
                            if nz_ref == 51
                            else _run_single_pouch_pde_regime(
                                regime_id=f"IIP0002_REF_{law.upper()}_T50_{int(t50_h)}H_KP_{kp:.4f}_NZ{nz_ref}",
                                f_chem_initial=0.45,
                                spatial_mode="central",
                                cao2_half_life_h=68.0,
                                catalase_present=True,
                                iec_max_perfusion_fraction=0.97,
                                boundary_po2_mmhg=40.0,
                                inosculation_t50_h=t50_h,
                                demand_multiplier_extra=1.0,
                                release_kinetics_law=law,
                                nz_override=nz_ref,
                                k_perf_max_s_override=kp,
                                _assess_numerical_gate=False,
                            )
                        )
                        ws_ref = r_ref["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]
                        mesh_receipts[f"nz_{nz_ref}"] = {
                            "nz_nodes": nz_ref,
                            "dz_um": round(350.0 / (nz_ref - 1), 4),
                            "min_slab_po2_unrounded_mmhg": float(r_ref["min_slab_po2_unrounded_mmhg"]),
                            "gel_only_120um_surface_po2_unrounded_mmhg": float(
                                ws_ref["two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"]
                            ),
                            "gel_only_120um_core_po2_unrounded_mmhg": float(
                                ws_ref["two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg"]
                            ),
                            "uniform_120um_core_po2_unrounded_mmhg": float(
                                ws_ref["two_zone_fv_uniform_supply_120um_core_po2_unrounded_mmhg"]
                            ),
                            "passes_15mmHg_slab_po2_gate": bool(
                                r_ref["required_120um_oxygen_solvers_converged"] and r_ref["min_slab_po2_unrounded_mmhg"] >= 15.0
                            ),
                            "passes_strict_2p0mmHg_gel_only_120um_core_gate": bool(
                                r_ref["required_120um_oxygen_solvers_converged"]
                                and r_ref["min_slab_po2_unrounded_mmhg"] >= 15.0
                                and ws_ref["two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg"] >= 2.0
                                and r_ref["strict_nonoxygen_gates_passed"]
                            ),
                        }
                    near_threshold_refinement_rows.append(
                        {
                            "release_kinetics_law": law,
                            "target_curve_midpoint_t50_h": t50_h,
                            "coupled_internal_vascular_exchange_kp_s_inv": kp,
                            "within_0p10mmHg_of_gate": bool(
                                abs(slab_val - 15.0) <= 0.10
                                or abs(gel_core_val - 2.0) <= 0.10
                                or abs(gel_core_val - 0.5) <= 0.10
                                or abs(uni_core_val - 2.0) <= 0.10
                            ),
                            "mesh_refinement_nz_51_101_201": mesh_receipts,
                            "gate_stability_across_51_101_201": bool(
                                len({m["passes_15mmHg_slab_po2_gate"] for m in mesh_receipts.values()}) == 1
                                and len({m["passes_strict_2p0mmHg_gel_only_120um_core_gate"] for m in mesh_receipts.values()}) == 1
                            ),
                        }
                    )

    # Exact zero-vessel lower bound (v_perf(t) == 0 identically, k_p = 0) vs legacy v_perf(0) = 0.01 decay control:
    zero_vessel_controls: Dict[str, Any] = {}
    for law in release_laws:
        r_zero_exact = _run_single_pouch_pde_regime(
            regime_id=f"IIP0002_{law.upper()}_EXACT_ZERO_VESSEL_BOUND_KP_0",
            f_chem_initial=0.45,
            spatial_mode="central",
            cao2_half_life_h=68.0,
            catalase_present=True,
            iec_max_perfusion_fraction=0.0,
            boundary_po2_mmhg=40.0,
            inosculation_t50_h=36.0,
            demand_multiplier_extra=1.0,
            release_kinetics_law=law,
            k_perf_max_s_override=0.0,
            zero_internal_vascular_state=True,
            _include_hourly_slab_po2_vector=True,
            _assess_numerical_gate=False,
        )
        r_zero_legacy_v0_0p01 = _run_single_pouch_pde_regime(
            regime_id=f"IIP0002_{law.upper()}_LEGACY_V0_0P01_KP_0",
            f_chem_initial=0.45,
            spatial_mode="central",
            cao2_half_life_h=68.0,
            catalase_present=True,
            iec_max_perfusion_fraction=0.0,
            boundary_po2_mmhg=40.0,
            inosculation_t50_h=36.0,
            demand_multiplier_extra=1.0,
            release_kinetics_law=law,
            k_perf_max_s_override=0.0,
            zero_internal_vascular_state=False,
            _include_hourly_slab_po2_vector=True,
            _assess_numerical_gate=False,
        )
        exact_row = _summarize_regime_row(
            r_zero_exact,
            law=law,
            t50_h=None,
            kp=0.0,
            timing_scope="exact_zero_vessel_lower_bound",
            include_cluster_trajectory=True,
        )
        joint_grid_rows.append(exact_row)
        r_zero_legacy_min_ph = r_zero_legacy_v0_0p01.get(
            "closed_pocket_metabolic_acidification_min_ph_unrounded",
            r_zero_legacy_v0_0p01["closed_pocket_metabolic_acidification_min_ph_v80_095"],
        )
        r_zero_exact_min_ph = r_zero_exact.get(
            "closed_pocket_metabolic_acidification_min_ph_unrounded",
            r_zero_exact["closed_pocket_metabolic_acidification_min_ph_v80_095"],
        )
        zero_vessel_controls[law] = {
            "exact_zero_internal_vascular_exchange_vperf_identically_zero": exact_row,
            "legacy_kp0_with_vperf0_0p01_decay_comparator": {
                "min_slab_po2_unrounded_mmhg": r_zero_legacy_v0_0p01["min_slab_po2_unrounded_mmhg"],
                "min_closed_pocket_acidic_ph_unrounded": r_zero_legacy_min_ph,
                "hour0_closed_pocket_acidic_ph_difference_from_exact_vperf0": round(
                    abs(
                        r_zero_exact["trajectory_0h_to_336h"][0]["min_closed_pocket_acidic_ph"]
                        - r_zero_legacy_v0_0p01["trajectory_0h_to_336h"][0]["min_closed_pocket_acidic_ph"]
                    ),
                    6,
                ),
                "global_336h_min_acidic_ph_difference_from_exact_vperf0": abs(
                    r_zero_exact_min_ph - r_zero_legacy_min_ph
                ),
            },
        }

    def _find_row(law: str, t50_h: float, kp: float) -> Dict[str, Any]:
        return next(
            r
            for r in joint_grid_rows
            if r["release_kinetics_law"] == law
            and r["target_curve_midpoint_t50_h"] is not None
            and math.isclose(float(r["target_curve_midpoint_t50_h"]), t50_h, rel_tol=1e-9)
            and math.isclose(float(r["coupled_internal_vascular_exchange_kp_s_inv"]), kp, rel_tol=1e-9)
        )

    fo_36_014 = _find_row("first_order", 36.0, 0.1400)
    sc_36_014 = _find_row("shrinking_core", 36.0, 0.1400)
    fo_40_014 = _find_row("first_order", 40.0, 0.1400)
    sc_40_014 = _find_row("shrinking_core", 40.0, 0.1400)
    fo_56_014 = _find_row("first_order", 56.0, 0.1400)
    sc_56_014 = _find_row("shrinking_core", 56.0, 0.1400)
    fo_60_014 = _find_row("first_order", 60.0, 0.1400)
    sc_60_014 = _find_row("shrinking_core", 60.0, 0.1400)
    fo_36_00944 = _find_row("first_order", 36.0, 0.0944)
    zv_fo_exact = zero_vessel_controls["first_order"]["exact_zero_internal_vascular_exchange_vperf_identically_zero"]
    zv_sc_exact = zero_vessel_controls["shrinking_core"]["exact_zero_internal_vascular_exchange_vperf_identically_zero"]
    diff_36_slab = fo_36_014["min_slab_po2_unrounded_mmhg"] - sc_36_014["min_slab_po2_unrounded_mmhg"]
    diff_60_slab = fo_60_014["min_slab_po2_unrounded_mmhg"] - sc_60_014["min_slab_po2_unrounded_mmhg"]

    return {
        "proposal_id": "IIP-0002",
        "title": "Test delayed and reduced vascular oxygen support together",
        "layer": "Layer 4",
        "test_gate": "Test 5",
        "open_question_id": "OQ-005",
        "open_question_title": "Does the oxygen supply hold up under pessimistic assumptions?",
        "status": "accepted_in_open_draft",
        "credit": (
            "Marissa Famularo (ORCID 0009-0001-8032-2215, GitHub @MarissaFamularo), IIP-0002, "
            "https://github.com/OpenIslet/openislet/issues/2. AI tools as she reported them: ChatGPT, GPT-6 Astra Pro "
            "(self-reported, never verified)."
        ),
        "exploratory_engineering_scope_note": (
            "Exploratory engineering sensitivity grid characterizing the combined early-window interaction of vascular "
            "inosculation timing and internal vascular exchange across both CaO2 release laws. "
            "Neither cited paper calibrates the chosen timing values, oxygen-transfer coefficients, or their joint distribution. "
            "Grid corners are exploratory model-dependence stress settings, not experimentally calibrated worst cases or clinical probabilities."
        ),
        "timing_axis_specification": {
            "timing_axis_label": "target_curve_midpoint_t50_h",
            "target_logistic_curve_equation": "v_target(t) = v_max / (1 + exp(-(t - t50) / 8.0)), v_max = 0.97",
            "lag_ode_equation": "dv_perf/dt = (v_target(t) - v_perf(t)) / 3.0, v_perf(0) = 0.01 (or v_perf(t) == 0 in exact zero-vessel bound)",
            "realized_half_plateau_definition": "Time t (hours) at which realized v_perf(t) reaches 0.5 * v_max = 0.485",
            "realized_minus_target_midpoint_lag_hours": round(realized_t50_map[36.0] - 36.0, 4),
            "target_to_realized_half_plateau_hours_map": {
                f"{int(t50)}h": round(realized_t50_map[t50], 4) for t50 in timings_t50_h
            },
            "hypothetical_stress_test_midpoints_hours": [96.0, 168.0],
        },
        "coupled_vascular_exchange_axis_disclosure": {
            "capacity_axis_label": "coupled_internal_vascular_exchange_coefficient_kp_s_inv",
            "effective_time_dependent_rate": "k_perf_s(t) = k_p * v_perf(t)",
            "coupled_processes_controlled_by_kp": [
                "Internal vascular O2 exchange: +k_perf_s(t) * (P_boundary - p(z, t)) in the slab O2 reaction-diffusion BVP (acts as an O2 source when local p < P_boundary = 40 mmHg, and as an O2 sink wherever local chemical O2 release raises p > 40 mmHg)",
                "Interstitial H2O2 vascular washout: -k_perf_s(t) * [H2O2](z, t) in _solve_peroxide_slab_bvp (removing H2O2 before catalase disproportionation reduces local chemical O2 generation)",
                "Interstitial OH- / alkaline species clearance: -k_perf_s(t) * [OH-](z, t) in the Henderson-Hasselbalch pH BVP",
            ],
            "interpretation_note": (
                "Because k_perf_s(t) = k_p * v_perf(t) simultaneously governs O2 exchange, H2O2 washout (which reduces catalase-mediated "
                "chemical O2 yield), and OH- clearance, and becomes an O2 sink wherever local pO2 exceeds the 40 mmHg host boundary, "
                "k_p is reported as a coupled internal vascular-exchange parameter rather than a pure oxygen-delivery coefficient."
            ),
        },
        "design_geometry_and_gy004_oxygen_demand_scope": {
            "reference_architecture_evaluated": "LEAD_CENTRAL_LAMINA_PDMS_CAO2_F045_PLUS_CATALASE (350 um total slab thickness, 119 um central lamina [a = 0.34], uniform conservative cellular demand, 120 um cluster diameter [R = 60 um], 2,500 IEQ/cm^2 across 200 cm^2 [7.00 cm^3], D_O2,gel = 9.40254e-6 cm^2/s)",
            "cao2_inventory_preserved_across_release_laws": {
                "f_chem_initial": 0.45,
                "cao2_initial_molar_inventory_mmol": 10.981,
                "cao2_initial_mass_mg_in_7cm3_slab": 791.5,
                "cao2_hydrolysis_half_life_hours": 68.0,
            },
            "gy004_oxygen_consumption_consistency": {
                "graveyard_entry": "GY-004 (RNLS knockout excluded from lead backbone due to ~1.18x basal OCR elevation)",
                "cell_intrinsic_ocr_multiplier_all_rows": 1.0,
                "vmax_islet_pure_mol_cm3_s": VMAX_ISLET_PURE_MOL_CM3_S,
                "iec_stromal_metabolic_overhead_multiplier": 1.15,
                "cross_design_transferability_caveat": (
                    "All rows hold intrinsic cellular oxygen demand fixed at 1.0x baseline V_max (RNLS-WT, consistent with GY-004) "
                    "plus the 1.15x vascular/stromal demand factor in the 350 um / 119 um-lamina / 120 um-cluster uniform-demand reference slab. "
                    "Numerical outputs do not automatically transfer to Design A Layout B (outer_annulus demand), Design B (GY-004 RNLS-KO 1.18x OCR comparator), "
                    "or Design X (100 um thinned central lamina with 80-100 um micro-islet diameter cap)."
                ),
            },
        },
        "release_law_direction_flip_and_gate_brackets_at_kp_0p14": {
            "direction_flip_explanation": (
                "Under matched initial CaO2 inventory (10.981 mmol, 791.5 mg) and 68.0 h half-time, reaction-controlled shrinking-core "
                "(m/m0)^(2/3) release is lower than first-order release around the early 13-18 h trough when t50 = 36 h "
                f"(min slab pO2 {fo_36_014['min_slab_po2_mmhg']:.3f} mmHg [FO, t={fo_36_014['time_of_min_slab_po2_hours']:.0f} h, gel-only core {fo_36_014['gel_only_120um_core_po2_mmhg']:.3f} mmHg] "
                f"vs {sc_36_014['min_slab_po2_mmhg']:.3f} mmHg [SC, t={sc_36_014['time_of_min_slab_po2_hours']:.0f} h, gel-only core {sc_36_014['gel_only_120um_core_po2_mmhg']:.3f} mmHg]), "
                "but retains slightly higher mid-trajectory chemical O2 release around the 36-39 h trough when inosculation is delayed to t50 = 60 h "
                f"(min slab pO2 {fo_60_014['min_slab_po2_mmhg']:.3f} mmHg [FO, t={fo_60_014['time_of_min_slab_po2_hours']:.0f} h, gel-only core {fo_60_014['gel_only_120um_core_po2_mmhg']:.3f} mmHg] "
                f"vs {sc_60_014['min_slab_po2_mmhg']:.3f} mmHg [SC, t={sc_60_014['time_of_min_slab_po2_hours']:.0f} h, gel-only core {sc_60_014['gel_only_120um_core_po2_mmhg']:.3f} mmHg]), "
                f"flipping the sign of (first_order - shrinking_core) between 36 h ({diff_36_slab:+.3f} mmHg slab) and 60 h ({diff_60_slab:+.3f} mmHg slab)."
            ),
            "strict_2p0mmHg_gel_only_core_gate_flip_at_kp_0p14": {
                "first_order_flips_between_t50_hours": [36.0, 40.0],
                "first_order_t50_36h_gel_only_core_unrounded_mmhg": fo_36_014["gel_only_120um_core_po2_unrounded_mmhg"],
                "first_order_t50_40h_gel_only_core_unrounded_mmhg": fo_40_014["gel_only_120um_core_po2_unrounded_mmhg"],
                "shrinking_core_already_below_2p0mmHg_at_t50_36h": True,
                "shrinking_core_t50_36h_gel_only_core_unrounded_mmhg": sc_36_014["gel_only_120um_core_po2_unrounded_mmhg"],
                "shrinking_core_t50_40h_gel_only_core_unrounded_mmhg": sc_40_014["gel_only_120um_core_po2_unrounded_mmhg"],
            },
            "slab_15mmHg_gate_flip_at_kp_0p14": {
                "first_order_flips_between_t50_hours": [56.0, 60.0],
                "first_order_t50_56h_min_slab_unrounded_mmhg": fo_56_014["min_slab_po2_unrounded_mmhg"],
                "first_order_t50_60h_min_slab_unrounded_mmhg": fo_60_014["min_slab_po2_unrounded_mmhg"],
                "shrinking_core_flips_between_t50_hours": [56.0, 60.0],
                "shrinking_core_t50_56h_min_slab_unrounded_mmhg": sc_56_014["min_slab_po2_unrounded_mmhg"],
                "shrinking_core_t50_60h_min_slab_unrounded_mmhg": sc_60_014["min_slab_po2_unrounded_mmhg"],
            },
            "near_threshold_36h_kp_0p0944_unrounded_check": {
                "target_curve_midpoint_t50_h": 36.0,
                "coupled_internal_vascular_exchange_kp_s_inv": 0.0944,
                "nz51_min_slab_po2_unrounded_mmhg": fo_36_00944["min_slab_po2_unrounded_mmhg"],
                "shortfall_below_15mmHg_at_nz51_mmhg": round(15.0 - fo_36_00944["min_slab_po2_unrounded_mmhg"], 6),
                "passes_15mmHg_slab_po2_gate": fo_36_00944["passes_15mmHg_slab_po2_gate"],
            },
        },
        "prior_repository_corner_tests_and_zero_vessel_bound_context": {
            "novelty_boundary_statement": (
                "The zero-vessel case (k_p = 0, v_perf(t) == 0) is presented as an analytical/numerical lower bound "
                f"({zv_fo_exact['min_slab_po2_unrounded_mmhg']:.6f} mmHg [{zv_fo_exact['min_slab_po2_mmhg']:.3f} mmHg] minimum slab pO2 at "
                f"{zv_fo_exact['time_of_min_slab_po2_hours']:.0f} h under first-order release, "
                f"{zv_sc_exact['min_slab_po2_unrounded_mmhg']:.6f} mmHg [{zv_sc_exact['min_slab_po2_mmhg']:.3f} mmHg] at "
                f"{zv_sc_exact['time_of_min_slab_po2_hours']:.0f} h under shrinking-core release after finite-time CaO2 depletion at 329.62 h, "
                f"with gel-only cluster cores {zv_sc_exact['gel_only_120um_core_po2_unrounded_mmhg']:.6f}-{zv_fo_exact['gel_only_120um_core_po2_unrounded_mmhg']:.6f} mmHg "
                f"[0.000 mmHg] and uniform cores {zv_sc_exact['uniform_120um_core_po2_unrounded_mmhg']:.6f}-{zv_fo_exact['uniform_120um_core_po2_unrounded_mmhg']:.6f} mmHg), "
                "not as a newly introduced control. Earlier partial corner tests already existed in the repository; the specific addition of "
                "IIP-0002 is the systematic early transient timing-by-exchange crossing on the lead reference slab across both release laws."
            ),
            "existing_repository_partial_coverage_cited": [
                {
                    "location": "part_a_336h_spatial_reaction_diffusion_pouch_pde.design_x_100um_lamina_transport_qualification_v80_018.chronic_zero_source_and_mineralization_extension_muse_r3.physical_outer_annulus_masked_chronic_zero_source_audit_argon_r4.joint_chronic_source_free_areal_loading_capsule_ocr_envelope_sol61_r4.avascular_capsule_vascular_dropout_kperf_0_at_d_cap_50um",
                    "description": "Chronic post-CaO2 zero-source Design X capsule-dropout corner at k_perf = 0 s^-1 and d_cap = 50 um (delta_z_eq = 150 um), yielding min_slab_po2 = 0.0783 mmHg and 100-um/80-um cluster cores of 8.65e-6 / 7.50e-5 mmHg.",
                },
                {
                    "location": "part_a_336h_spatial_reaction_diffusion_pouch_pde.design_x_100um_lamina_transport_qualification_v80_018.vascular_inosculation_target_t50_hours",
                    "description": "Design Z pre-vascularized ribbon target midpoint t50 = 24.0 h (and Stage-0 Gate Z-04 microfluidic anastomosis target t50 <= 24-36 h).",
                },
                {
                    "location": "part_a_336h_spatial_reaction_diffusion_pouch_pde.lead_regime_4_scenario_sensitivity_table_sol_v80_12 & vascular_perfusion_conductance_sensitivity_v80_014",
                    "description": "Separate one-at-a-time lead-slab sensitivity sweeps for delayed inosculation (t50 = 60 h at k_p = 0.14 s^-1) and reduced k_p (0.0944-0.1800 s^-1 at t50 = 36 h).",
                },
            ],
            "exact_zero_vessel_bound_controls": zero_vessel_controls,
        },
        "parameter_source_and_provenance_table": [
            {
                "parameter": "target_curve_midpoint_t50_h",
                "values_tested": "36, 40, 44, 48, 52, 56, 60 h (plus hypothetical 96, 168 h)",
                "role_in_model": "Logistic target-curve inflection time t50 in v_target(t) = v_max / (1 + exp(-(t - t50)/8.0)); realized half-plateau v_perf(t) = 0.485 occurs 2.9426 h later due to the 3.0 h first-order lag ODE.",
                "source_and_provenance": (
                    "Exploratory engineering sensitivity grid brackets. Shepherd et al. 2004 (Arterioscler Thromb Vasc Biol 24(5):898-904, PMID:14988090) "
                    "demonstrates that microvessel-fragment constructs implanted in SCID mice can form perfused host connections "
                    "early in engraftment, and Altalhi et al. 2019 (Cell Mol Bioeng 12(5):443-454, PMID:31719926 / PMC6816716 Fig. 6) "
                    "shows reduced and delayed perfused vessel density in microvessel-fragment constructs in collagen hydrogels implanted subcutaneously "
                    "in streptozotocin-diabetic donor+recipient mice relative to non-diabetic controls "
                    "(confounded by simultaneous donor and recipient diabetic status). Neither cited paper calibrates the chosen timing values, "
                    "oxygen-transfer coefficients, or their joint distribution."
                ),
            },
            {
                "parameter": "coupled_internal_vascular_exchange_kp_s_inv",
                "values_tested": "0.0944, 0.1100, 0.1400, 0.1800 s^-1 (plus 0.0 s^-1 zero-vessel bound)",
                "role_in_model": "Maximum internal vascular exchange rate constant multiplying v_perf(t) across O2 exchange, H2O2 washout, and OH- clearance.",
                "source_and_provenance": (
                    "Layer 4 continuum Krogh-type internal capillary exchange prior (nominal 0.14 s^-1, chronic capsule-attenuated 0.1358 s^-1, "
                    "lower sensitivity brackets 0.1100 and 0.0944 s^-1, upper bracket 0.1800 s^-1; DEC-002 / AUDIT-REF). "
                    "Neither cited paper calibrates the chosen timing values, oxygen-transfer coefficients, or their joint distribution."
                ),
            },
            {
                "parameter": "release_kinetics_law",
                "values_tested": "first_order vs shrinking_core ((m/m0)^(2/3))",
                "role_in_model": "Governs solid CaO2 hydrolysis rate at fixed initial inventory (10.981 mmol / 791.5 mg CaO2 in 7.00 cm^3) and matched t_1/2 = 68.0 h.",
                "source_and_provenance": "Layer 4 Stage-0 Gate P05 (DIFF-0) dual kinetic-law qualification bracket (DEC-002 / DEC-078).",
            },
            {
                "parameter": "vmax_islet_pure_mol_cm3_s & cell_intrinsic_ocr_multiplier",
                "values_tested": "3.4e-8 mol/(cm^3*s) * 1.0x intrinsic OCR * 1.15x vascular/stromal overhead",
                "role_in_model": "Michaelis-Menten cellular O2 demand in the 350 um slab and 120 um spherical Wigner-Seitz cluster BVP.",
                "source_and_provenance": "Canonical human islet OCR prior with GY-004 consistency (RNLS-WT 1.0x baseline OCR retained across all lead-design rows).",
            },
        ],
        "near_threshold_grid_refinement_audit_nz_51_101_201": near_threshold_refinement_rows,
        "joint_grid_rows": joint_grid_rows,
    }


def solve_336h_spatial_pouch_pde() -> Dict[str, Any]:
    """
    Solve the coupled 1D spatial reaction-diffusion PDE system across z in [-175 um, +175 um]
    (51 spatial grid points) and t in [0, 336 hours (14 days)] plus the 4-scenario physiological
    sensitivity table under both first-order and shrinking-core (m/m0)^(2/3) release laws
    (closing AUDIT-REF, AUDIT-REF, AUDIT-REF, and AUDIT-REF).
    """
    regimes_spec = [
        ("PASSIVE_NO_CAO2_CONTROL", 0.0, "none", 68.0, True, 0.97),
        ("UNDERDOSED_CENTRAL_CAO2_F020_V70_12_TEST", 0.20, "central", 68.0, True, 0.97),
        ("LEAD_CENTRAL_LAMINA_PDMS_CAO2_F045_PLUS_CATALASE", 0.45, "central", 68.0, True, 0.97),
        ("PDMS_CAO2_F045_NO_CATALASE_ISOLATED_PEROXIDE_CONTROL", 0.45, "central", 68.0, False, 0.97),
        ("RAW_UNCOATED_CAO2_NO_CATALASE_CHEMICAL_TOXICITY", 0.45, "uniform", 4.0, False, 0.97),
        ("FULL_LENGTH_CD47_WT_IEC_ANGIOGENESIS_IMPAIRED", 0.45, "central", 68.0, True, 0.28),
    ]
    results = [_run_single_pouch_pde_regime(*spec) for spec in regimes_spec]

    # 4-Scenario Sensitivity Analysis on the Lead Pouch Architecture under BOTH first-order and
    # coupled shrinking-core (m/m0)^(2/3) hydrolysis laws (AUDIT-REF & AUDIT-REF):
    sensitivity_scenarios = [
        ("nominal_40mmHg_t50_36h", 40.0, 36.0, 1.0),
        ("boundary_po2_30mmHg_lower_vascularized_bed", 30.0, 36.0, 1.0),
        ("delayed_inosculation_midpoint_t50_60h", 40.0, 60.0, 1.0),
        ("elevated_metabolic_demand_plus_25pct", 40.0, 36.0, 1.25),
    ]
    sensitivity_table = []
    shrinking_core_coupled_regimes = []
    for s_name, p_bound, t50_h, dem_mult in sensitivity_scenarios:
        r_sens_fo = _run_single_pouch_pde_regime(
            regime_id=f"SENSITIVITY_{s_name.upper()}_FIRST_ORDER",
            f_chem_initial=0.45,
            spatial_mode="central",
            cao2_half_life_h=68.0,
            catalase_present=True,
            iec_max_perfusion_fraction=0.97,
            boundary_po2_mmhg=p_bound,
            inosculation_t50_h=t50_h,
            demand_multiplier_extra=dem_mult,
            release_kinetics_law="first_order",
        )
        r_sens_sc = _run_single_pouch_pde_regime(
            regime_id=f"SENSITIVITY_{s_name.upper()}_SHRINKING_CORE",
            f_chem_initial=0.45,
            spatial_mode="central",
            cao2_half_life_h=68.0,
            catalase_present=True,
            iec_max_perfusion_fraction=0.97,
            boundary_po2_mmhg=p_bound,
            inosculation_t50_h=t50_h,
            demand_multiplier_extra=dem_mult,
            release_kinetics_law="shrinking_core",
        )
        shrinking_core_coupled_regimes.append(r_sens_sc)
        sensitivity_table.append(
            {
                "scenario_id": s_name,
                "boundary_po2_mmhg": p_bound,
                "inosculation_t50_hours": t50_h,
                "demand_multiplier": dem_mult,
                "time_of_min_slab_po2_hours": r_sens_fo["time_of_min_slab_po2_hours"],
                "min_slab_po2_mmhg": r_sens_fo["min_slab_po2_across_14_days_mmhg"],
                "min_120um_cluster_core_po2_mmhg": r_sens_fo["min_120um_cluster_core_po2_mmhg"],
                "two_zone_fv_uniform_supply_core_po2_mmhg": r_sens_fo["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"][
                    "two_zone_fv_uniform_supply_120um_core_po2_mmhg"
                ],
                "two_zone_fv_uniform_supply_core_po2_unrounded_mmhg": r_sens_fo["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"][
                    "two_zone_fv_uniform_supply_120um_core_po2_unrounded_mmhg"
                ],
                "two_zone_fv_gel_only_supply_core_po2_mmhg": r_sens_fo["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"][
                    "two_zone_fv_gel_only_supply_120um_core_po2_mmhg"
                ],
                "two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg": r_sens_fo["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"][
                    "two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg"
                ],
                "passes_15mmHg_gsis_gate_at_2500_ieq_cm2": bool(r_sens_fo["required_120um_oxygen_solvers_converged"] and r_sens_fo["min_slab_po2_unrounded_mmhg"] >= 15.0),
                "passes_0p5mmHg_anoxic_necrosis_gate": bool(r_sens_fo["required_120um_oxygen_solvers_converged"] and r_sens_fo["min_120um_cluster_core_po2_unrounded_mmhg"] >= 0.5),
                "passes_2p0mmHg_combined_core_safety_gate": bool(r_sens_fo["required_120um_oxygen_solvers_converged"] and r_sens_fo["min_120um_cluster_core_po2_unrounded_mmhg"] >= 2.0),
                "passes_0p5mmHg_two_zone_uniform_core_gate": bool(
                    r_sens_fo["required_120um_oxygen_solvers_converged"]
                    and r_sens_fo["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_uniform_supply_120um_core_po2_unrounded_mmhg"] >= 0.5
                ),
                "passes_2p0mmHg_two_zone_uniform_core_gate": bool(
                    r_sens_fo["required_120um_oxygen_solvers_converged"]
                    and r_sens_fo["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_uniform_supply_120um_core_po2_unrounded_mmhg"] >= 2.0
                ),
                "passes_0p5mmHg_two_zone_fv_gel_only_gate": bool(
                    r_sens_fo["required_120um_oxygen_solvers_converged"]
                    and r_sens_fo["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg"] >= 0.5
                ),
                "passes_2p0mmHg_two_zone_fv_gel_only_gate": r_sens_fo["passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate"],
                "core_gate_basis_note": (
                    "passes_0p5mmHg_anoxic_necrosis_gate and passes_2p0mmHg_combined_core_safety_gate evaluate the optimistic Dirichlet boundary screen "
                    "(min_120um_cluster_core_po2_mmhg, p(R) = p_slab without pericellular shell depletion), whereas passes_2p0mmHg_two_zone_fv_gel_only_gate "
                    "and passes_0p5mmHg_two_zone_fv_gel_only_gate evaluate the operative conservative unrounded Wigner-Seitz two-zone gel-only pericellular-shell core pO2 (DEC-078; IIP-0025; DEC-104)."
                ),
                "shrinking_core_coupled_bvp_ultracode_v80_09": {
                    "time_of_min_slab_po2_hours": r_sens_sc["time_of_min_slab_po2_hours"],
                    "min_slab_po2_mmhg": r_sens_sc["min_slab_po2_across_14_days_mmhg"],
                    "min_120um_cluster_core_po2_mmhg": r_sens_sc["min_120um_cluster_core_po2_mmhg"],
                    "two_zone_fv_uniform_supply_core_po2_mmhg": r_sens_sc[
                        "wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"
                    ]["two_zone_fv_uniform_supply_120um_core_po2_mmhg"],
                    "two_zone_fv_uniform_supply_core_po2_unrounded_mmhg": r_sens_sc[
                        "wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"
                    ]["two_zone_fv_uniform_supply_120um_core_po2_unrounded_mmhg"],
                    "two_zone_fv_gel_only_supply_core_po2_mmhg": r_sens_sc[
                        "wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"
                    ]["two_zone_fv_gel_only_supply_120um_core_po2_mmhg"],
                    "two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg": r_sens_sc[
                        "wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"
                    ]["two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg"],
                    "max_interstitial_h2o2_uM": r_sens_sc["max_interstitial_h2o2_uM"],
                    "max_interstitial_ph": r_sens_sc["max_interstitial_ph"],
                    "passes_15mmHg_gsis_gate_at_2500_ieq_cm2": bool(r_sens_sc["required_120um_oxygen_solvers_converged"] and r_sens_sc["min_slab_po2_unrounded_mmhg"] >= 15.0),
                    "passes_0p5mmHg_anoxic_necrosis_gate": bool(r_sens_sc["required_120um_oxygen_solvers_converged"] and r_sens_sc["min_120um_cluster_core_po2_unrounded_mmhg"] >= 0.5),
                    "passes_all_oxygen_peroxide_and_ph_gates": r_sens_sc["passes_all_oxygen_peroxide_and_ph_gates"],
                    "passes_0p5mmHg_two_zone_uniform_core_gate": bool(
                        r_sens_sc["required_120um_oxygen_solvers_converged"]
                        and r_sens_sc["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_uniform_supply_120um_core_po2_unrounded_mmhg"] >= 0.5
                    ),
                    "passes_2p0mmHg_two_zone_uniform_core_gate": bool(
                        r_sens_sc["required_120um_oxygen_solvers_converged"]
                        and r_sens_sc["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_uniform_supply_120um_core_po2_unrounded_mmhg"] >= 2.0
                    ),
                    "passes_0p5mmHg_two_zone_fv_gel_only_gate": bool(
                        r_sens_sc["required_120um_oxygen_solvers_converged"]
                        and r_sens_sc["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg"] >= 0.5
                    ),
                    "passes_2p0mmHg_two_zone_fv_gel_only_gate": r_sens_sc["passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate"],
                },
            }
        )

    bvp_r60_ref = solve_spherical_cluster_po2_bvp(16.8, 0.0060)
    bvp_r150_ref = solve_spherical_cluster_po2_bvp(16.8, 0.0150)

    # Actual PDE execution for Bruggeman central-lamina diffusivity torture-test under outer-annular CAD Layout B (AUDIT-REF & AUDIT-REF):
    r_annular_nom = _run_single_pouch_pde_regime(
        "LAYOUT_B_ANNULAR_ISLET_DEMAND_NOMINAL", 0.45, "central", 68.0, True, 0.97, demand_spatial_mode="outer_annulus"
    )
    r_brug_042 = _run_single_pouch_pde_regime(
        "BRUGGEMAN_EPS_0P42_MACROPOROUS",
        0.45,
        "central",
        68.0,
        True,
        0.97,
        demand_spatial_mode="outer_annulus",
        lamina_d_o2_scale=0.42 ** 1.5,
    )
    r_brug_01754 = _run_single_pouch_pde_regime(
        "BRUGGEMAN_EPS_0P1754_DENSE",
        0.45,
        "central",
        68.0,
        True,
        0.97,
        demand_spatial_mode="outer_annulus",
        lamina_d_o2_scale=0.1754 ** 1.5,
    )
    cad = verify_exact_slab_source_distribution_algebra()["non_overlapping_phase_volume_and_cad_ledger_7cm3_ultracode_v80_18"]["layout_option_b_31wt_pct_cao2_confined_central_lamina_microbeads"]
    retained_inventory = cad["eps_0p42_inventory_retention_at_same_formulation_and_lamina"]
    r_brug_042_mass_conserving = _run_single_pouch_pde_regime(
        "BRUGGEMAN_EPS_0P42_REDUCED_INVENTORY_SAME_FORMULATION", 0.45 * retained_inventory,
        "central", 68.0, True, 0.97, demand_spatial_mode="outer_annulus", lamina_d_o2_scale=0.42 ** 1.5,
    )

    def packing_screen(regime: Dict[str, Any], *, inventory_fits: bool) -> Dict[str, Any]:
        return {
            "inventory_fits_declared_porosity_at_fixed_formulation": inventory_fits,
            "computed_gel_only_core_po2_mmhg": regime["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg"],
            "spatial_control_volume_ledger": regime["spatial_control_volume_ledger"],
            "qualified_exact_product": False,
            "scope": "TRANSPORT_SENSITIVITY_ONLY; 120um clusters exceed each 115.5um outer band, and material/diffusivity/enzymatic release remain unmeasured",
        }
    bruggeman_torture_test = {
        "outer_annulus_layout_b_unobstructed_d_ratio_1p0": {
            "central_lamina_porosity_eps": 1.0000,
            "bruggeman_diffusivity_ratio_eps_1p5": 1.0000,
            "min_slab_po2_across_14_days_mmhg": r_annular_nom["min_slab_po2_across_14_days_mmhg"],
            "min_120um_cluster_core_po2_mmhg": r_annular_nom["min_120um_cluster_core_po2_mmhg"],
            "passes_all_oxygen_peroxide_and_ph_gates": r_annular_nom["passes_all_oxygen_peroxide_and_ph_gates"],
        },
        "macroporous_interconnected_microbead_packing_eps_0p42": {
            **packing_screen(r_brug_042, inventory_fits=False),
            "central_lamina_porosity_eps": 0.4200,
            "bruggeman_diffusivity_ratio_eps_1p5": round(0.42 ** 1.5, 4),
            "min_slab_po2_across_14_days_mmhg": r_brug_042["min_slab_po2_across_14_days_mmhg"],
            "min_120um_cluster_core_po2_mmhg": r_brug_042["min_120um_cluster_core_po2_mmhg"],
            "passes_all_oxygen_peroxide_and_ph_gates": r_brug_042["passes_all_oxygen_peroxide_and_ph_gates"],
        },
        "dense_unchannelized_microbead_packing_eps_0p1754": {
            **packing_screen(r_brug_01754, inventory_fits=True),
            "central_lamina_porosity_eps": 0.1754,
            "bruggeman_diffusivity_ratio_eps_1p5": round(0.1754 ** 1.5, 4),
            "min_slab_po2_across_14_days_mmhg": r_brug_01754["min_slab_po2_across_14_days_mmhg"],
            "min_120um_cluster_core_po2_mmhg": r_brug_01754["min_120um_cluster_core_po2_mmhg"],
            "passes_all_oxygen_peroxide_and_ph_gates": r_brug_01754["passes_all_oxygen_peroxide_and_ph_gates"],
        },
        "eps_0p42_mass_conserving_same_formulation_reduced_inventory": {
            **packing_screen(r_brug_042_mass_conserving, inventory_fits=True),
            "central_lamina_porosity_eps": 0.42,
            "cao2_inventory_fraction_of_lead": retained_inventory,
            "f_chem_initial": 0.45 * retained_inventory,
            "cao2_initial_mass_mg": r_brug_042_mass_conserving["cao2_initial_mass_mg_in_7cm3_slab"],
            "min_slab_po2_across_14_days_mmhg": r_brug_042_mass_conserving["min_slab_po2_across_14_days_mmhg"],
            "passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate": r_brug_042_mass_conserving["passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate"],
        },
        "packing_reconciliation": {
            "mass_density_porosity": cad["central_lamina_void_fraction_from_mass_and_density"],
            "eps_0p42_at_unchanged_inventory_status": "INCOMPATIBLE_WITH_FIXED_31P25_WEIGHT_PERCENT_FORMULATION_AND_2P38_CM3_LAMINA",
            "required_next_step": "Select and measure a feasible bead formulation/volume/porosity and cluster placement before treating a transport sensitivity as a product architecture.",
        },
        "physical_mechanism_note": (
            "Computed directly via harmonic-mean variable-diffusivity finite-volume operators nabla.(D(z) nabla p) in "
            "_run_single_pouch_pde_regime: placing endocrine/stromal demand in the outer 66% annulus (CAD Layout B) raises "
            f"unobstructed minimum slab pO2 from {results[2]['min_slab_po2_across_14_days_mmhg']} mmHg (conservative uniform-demand lower bound) "
            f"to {r_annular_nom['min_slab_po2_across_14_days_mmhg']} mmHg, and applying Bruggeman tortuosity (D_lamina = D_0 * eps^1.5) "
            f"inside the central source lamina yields {r_brug_042['min_slab_po2_across_14_days_mmhg']} mmHg (eps = 0.42) and "
            f"{r_brug_01754['min_slab_po2_across_14_days_mmhg']} mmHg (eps = 0.1754); the adjacent computed gate fields determine conditional pass/fail."
        ),
    }

    grid_convergence = []
    grid_cases = [
        ("nominal", 0.45, {}), ("near_threshold_f0447", 0.447, {}),
        ("boundary30", 0.45, {"boundary_po2_mmhg": 30.0}),
        ("delayed_t50_60h", 0.45, {"inosculation_t50_h": 60.0}),
        ("demand_plus25pct", 0.45, {"demand_multiplier_extra": 1.25}),
        ("tortuosity_eps042", 0.45, {"demand_spatial_mode": "outer_annulus", "lamina_d_o2_scale": 0.42 ** 1.5}),
    ]
    for case_id, f_value, case_kwargs in grid_cases:
        for nz_test in (51, 101, 201, 401):
            r_g = _run_single_pouch_pde_regime(f"GRID_{case_id}_{nz_test}", f_value, "central", 68.0, True, 0.97,
                                              nz_override=nz_test, _assess_numerical_gate=False, **case_kwargs)
            grid_convergence.append({
                "scenario_id": case_id, "f_chem_initial": f_value, "nz_nodes": nz_test,
                "dz_um": 350.0 / (nz_test - 1),
                "min_slab_po2_mmhg": r_g["min_slab_po2_unrounded_mmhg"],
                "time_of_min_slab_po2_hours": r_g["time_of_min_slab_po2_hours"],
                "two_zone_fv_gel_only_core_po2_mmhg": r_g["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg"],
                "spatial_control_volume_ledger": r_g["spatial_control_volume_ledger"],
            })
    perfusion_sensitivity = []
    for k_p in [0.0944, 0.1100, 0.1400, 0.1800]:
        r_p = _run_single_pouch_pde_regime(f"PERF_K_{k_p:.4f}", 0.45, "central", 68.0, True, 0.97, k_perf_max_s_override=k_p)
        ws_p = r_p["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]
        perfusion_sensitivity.append(
            {
                "k_perf_max_s_inv": k_p,
                "min_slab_po2_mmhg": r_p["min_slab_po2_across_14_days_mmhg"],
                "min_slab_po2_unrounded_mmhg": r_p["min_slab_po2_unrounded_mmhg"],
                "time_of_min_slab_po2_hours": r_p["time_of_min_slab_po2_hours"],
                "two_zone_fv_gel_only_surface_po2_unrounded_mmhg": ws_p["two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"],
                "two_zone_fv_gel_only_120um_core_po2_unrounded_mmhg": ws_p["two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg"],
                "two_zone_fv_uniform_120um_core_po2_unrounded_mmhg": ws_p.get(
                    "two_zone_fv_uniform_supply_120um_core_po2_unrounded_mmhg",
                    ws_p["two_zone_fv_uniform_supply_120um_core_po2_mmhg"],
                ),
                "passes_15mmHg_gsis_gate": bool(r_p["required_120um_oxygen_solvers_converged"] and r_p["min_slab_po2_unrounded_mmhg"] >= 15.0),
                "passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate": r_p["passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate"],
            }
        )
    joint_vascular_iip_0002 = _build_joint_vascular_timing_and_exchange_sensitivity_iip_0002()
    formulation_cao2_sensitivity_iip_0010 = _build_formulation_specific_cao2_half_life_sensitivity_iip_0010()

    # Design X 100 um thinned central lamina (a = 100/350 = 0.285714, outer bands 125 um each >= 120 um cluster diameter,
    # 46.3906 wt% dry CaO2 in PDMS at porosity eps = 0.42; closes DEC-014 AUDIT-REF, L4-13, Audit C2, Audit FRESH-PHY-007):
    a_design_x = 100.0 / 350.0
    dx_fo_201 = _run_single_pouch_pde_regime(
        "DESIGN_X_100UM_LAMINA_EPS042_FO_201",
        0.45,
        "central",
        68.0,
        True,
        0.97,
        release_kinetics_law="first_order",
        nz_override=201,
        demand_spatial_mode="outer_annulus",
        lamina_d_o2_scale=0.42 ** 1.5,
        lamina_half_width_fraction=a_design_x,
        _assess_numerical_gate=False,
    )
    dx_sc_201 = _run_single_pouch_pde_regime(
        "DESIGN_X_100UM_LAMINA_EPS042_SC_201",
        0.45,
        "central",
        68.0,
        True,
        0.97,
        release_kinetics_law="shrinking_core",
        nz_override=201,
        demand_spatial_mode="outer_annulus",
        lamina_d_o2_scale=0.42 ** 1.5,
        lamina_half_width_fraction=a_design_x,
        _assess_numerical_gate=False,
    )
    dx_fo_51 = _run_single_pouch_pde_regime(
        "DESIGN_X_100UM_LAMINA_EPS042_FO_51",
        0.45,
        "central",
        68.0,
        True,
        0.97,
        release_kinetics_law="first_order",
        nz_override=51,
        demand_spatial_mode="outer_annulus",
        lamina_d_o2_scale=0.42 ** 1.5,
        lamina_half_width_fraction=a_design_x,
        _assess_numerical_gate=False,
    )
    dx_fo_201_loc_cat = _run_single_pouch_pde_regime(
        "DESIGN_X_100UM_LAMINA_EPS042_FO_201_LOCALIZED_CATALASE",
        0.45,
        "central",
        68.0,
        True,
        0.97,
        release_kinetics_law="first_order",
        nz_override=201,
        demand_spatial_mode="outer_annulus",
        lamina_d_o2_scale=0.42 ** 1.5,
        lamina_half_width_fraction=a_design_x,
        catalase_spatial_mode="central_lamina_masked",
        catalase_k1_override_s_inv=18.0 * 0.42,
        _assess_numerical_gate=False,
    )
    dx_gb_201 = _run_single_pouch_pde_regime(
        "DESIGN_X_100UM_LAMINA_EPS042_GB_201_LOCALIZED_CATALASE",
        0.45,
        "central",
        68.0,
        True,
        0.97,
        release_kinetics_law="ginstling_brounshtein",
        nz_override=201,
        demand_spatial_mode="outer_annulus",
        lamina_d_o2_scale=0.42 ** 1.5,
        lamina_half_width_fraction=a_design_x,
        catalase_spatial_mode="central_lamina_masked",
        catalase_k1_override_s_inv=18.0 * 0.42,
        _assess_numerical_gate=False,
    )
    dx_gb_201_conserving = _run_single_pouch_pde_regime(
        "DESIGN_X_100UM_LAMINA_EPS042_GB_201_PIECEWISE_CONSERVING",
        0.45,
        "central",
        68.0,
        True,
        0.97,
        release_kinetics_law="ginstling_brounshtein",
        gb_regularization_mode="exact_piecewise_conserving",
        nz_override=201,
        demand_spatial_mode="outer_annulus",
        lamina_d_o2_scale=0.42 ** 1.5,
        lamina_half_width_fraction=a_design_x,
        catalase_spatial_mode="central_lamina_masked",
        catalase_k1_override_s_inv=18.0 * 0.42,
        _assess_numerical_gate=False,
    )
    # Runtime derivation of Design X 46.3906 wt% CaO2 in PDMS from exact unrounded molar inventory (AUDIT-REF):
    k_ref_s_dx = math.log(2.0) / (68.0 * 3600.0)
    phi_islet_dx = (2500.0 * VOL_1_IEQ_CM3) / 0.035
    local_phi_dx = phi_islet_dx / (1.0 - a_design_x)
    local_phi_bp_a = phi_islet_dx / (1.0 - CENTRAL_LAMINA_HALF_WIDTH_FRACTION)

    def _solve_chronic_zero_source_bvp_live(
        p_b_mmhg: float,
        delta_z_eq_um: float,
        demand_mult_total: float,
        a_frac_val: float = a_design_x,
        k_perf_eff_s: float = 0.14,
        d_o2_eff_cm2_s: float = 1.50e-5,
        nz_val: int = 201,
    ) -> float:
        half_L_val = 0.0175
        geom_c = _slab_control_volume_profiles(nz_val, half_L_val, lamina_half_width_fraction=a_frac_val)
        z_c = geom_c["z"]
        dz_c = float(z_c[1] - z_c[0])
        phi_base_2500 = (2500.0 * VOL_1_IEQ_CM3) / (2.0 * half_L_val)
        q_dem = phi_base_2500 * VMAX_ISLET_PURE_MOL_CM3_S * 1.15 * demand_mult_total
        v_dem_mmhg_s = q_dem / ALPHA_BUNSEN_MOL_CM3_MMHG
        d_prof_int_c = geom_c["outer_demand"][1:-1]
        k_perf_prof_c = k_perf_eff_s * (1.0 - geom_c["central_mask"][1:-1])
        d_faces_c = _slab_oxygen_face_diffusivities(
            z_c, 0.42 ** 1.5, lamina_half_width_fraction=a_frac_val, d_o2_hydrogel_override_cm2_s=d_o2_eff_cm2_s
        )
        standoff_cm_c = float(delta_z_eq_um) * 1e-4
        robin_fac_c = float(dz_c / (dz_c + standoff_cm_c)) if standoff_cm_c > 0.0 else 1.0
        p_c = np.full(nz_val, p_b_mmhg, dtype=np.float64)
        d_left_c = (d_faces_c[:-1] / (dz_c * dz_c)).copy()
        d_right_c = (d_faces_c[1:] / (dz_c * dz_c)).copy()
        if standoff_cm_c > 0.0:
            d_left_c[0] *= robin_fac_c
            d_right_c[-1] *= robin_fac_c
        for _ in range(80):
            p_c[0] = p_b_mmhg
            p_c[-1] = p_b_mmhg
            p_int_c = p_c[1:-1]
            diff_c = d_left_c * (p_c[:-2] - p_int_c) + d_right_c * (p_c[2:] - p_int_c)
            cons_c = v_dem_mmhg_s * d_prof_int_c * (p_int_c / (KM_O2_MMHG + p_int_c))
            res_c = diff_c - cons_c + k_perf_prof_c * (p_b_mmhg - p_int_c)
            jac_c = -(d_left_c + d_right_c) - v_dem_mmhg_s * d_prof_int_c * (KM_O2_MMHG / ((KM_O2_MMHG + p_int_c) ** 2)) - k_perf_prof_c
            mat_c = np.diag(jac_c) + np.diag(d_right_c[:-1], 1) + np.diag(d_left_c[1:], -1)
            step_c = np.linalg.solve(mat_c, -res_c)
            damping_c = 0.8
            while np.any(p_int_c + damping_c * step_c < 0.0) and damping_c > 1e-12:
                damping_c *= 0.5
            p_c[1:-1] = np.maximum(0.0, p_int_c + damping_c * step_c)
            if float(np.max(np.abs(step_c))) < 1e-8:
                break
        if standoff_cm_c > 0.0:
            p_c[0] = robin_fac_c * p_b_mmhg + (1.0 - robin_fac_c) * p_c[1]
            p_c[-1] = robin_fac_c * p_b_mmhg + (1.0 - robin_fac_c) * p_c[-2]
        return float(np.min(p_c))

    def _bvp_gel_surf_core(p_slab: float, r_cm: float, phi_val: float, d_gel: float | None = None) -> list[float]:
        bvp_res = solve_spherical_cluster_po2_bvp(p_slab, r_cm, phi_islet_in_slab=phi_val, d_hydrogel_override=d_gel)
        return [
            round(float(bvp_res["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"]), 2),
            round(float(bvp_res["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"]), 2),
        ]

    def _bvp_gel_surf_core_4dec(
        p_slab: float, r_cm: float, phi_val: float, d_gel: float = 1.50e-5, ocr_mult: float = 1.0
    ) -> list[float]:
        bvp_res = solve_spherical_cluster_po2_bvp(
            p_slab, r_cm, phi_islet_in_slab=phi_val, d_hydrogel_override=d_gel, ocr_multiplier=ocr_mult
        )
        return [
            round(float(bvp_res["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"]), 4),
            round(float(bvp_res["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"]), 4),
        ]

    chr_2500_pb35_ocr1000_dx_k14 = round(_solve_chronic_zero_source_bvp_live(35.0, 45.0, 1.000, a_design_x, 0.14), 4)
    chr_2500_pb35_ocr1097_dx_k14 = round(_solve_chronic_zero_source_bvp_live(35.0, 45.0, 1.097, a_design_x, 0.14), 4)
    chr_2500_pb35_ocr1000_a034_k14 = round(_solve_chronic_zero_source_bvp_live(35.0, 45.0, 1.000, CENTRAL_LAMINA_HALF_WIDTH_FRACTION, 0.14), 4)
    chr_2500_pb35_ocr1097_a034_k14 = round(_solve_chronic_zero_source_bvp_live(35.0, 45.0, 1.097, CENTRAL_LAMINA_HALF_WIDTH_FRACTION, 0.14), 4)
    chr_2500_pb35_ocr1000_a034_k97 = round(_solve_chronic_zero_source_bvp_live(35.0, 45.0, 1.000, CENTRAL_LAMINA_HALF_WIDTH_FRACTION, 0.14 * 0.97), 4)
    chr_2500_pb35_ocr1097_a034_k97 = round(_solve_chronic_zero_source_bvp_live(35.0, 45.0, 1.097, CENTRAL_LAMINA_HALF_WIDTH_FRACTION, 0.14 * 0.97), 4)
    chr_2500_pb25_st100_dx_k14 = round(_solve_chronic_zero_source_bvp_live(25.0, 100.0, 1.000, a_design_x, 0.14), 4)
    chr_1500_pb35_ocr1097_dx_k14 = _solve_chronic_zero_source_bvp_live(35.0, 45.0, 0.60 * 1.097, a_design_x, 0.14)
    chr_1500_pb32p5_ocr1097_dx_k14 = _solve_chronic_zero_source_bvp_live(32.5, 45.0, 0.60 * 1.097, a_design_x, 0.14)
    chr_1500_pb30p0_ocr1097_dx_k14 = _solve_chronic_zero_source_bvp_live(30.0, 45.0, 0.60 * 1.097, a_design_x, 0.14)
    chr_1500_pb35_ocr1500_dx_k14 = _solve_chronic_zero_source_bvp_live(35.0, 45.0, 0.60 * 1.500, a_design_x, 0.14)
    chr_1500_pb35_surf_core_phi_dil = _bvp_gel_surf_core_4dec(chr_1500_pb35_ocr1097_dx_k14, 0.0050, local_phi_dx * 0.60, 1.50e-5, 1.097)
    chr_1500_pb35_surf_core_phi_base = _bvp_gel_surf_core_4dec(chr_1500_pb35_ocr1097_dx_k14, 0.0050, local_phi_dx, 1.50e-5, 1.097)
    chr_1500_pb32p5_surf_core_phi_base = _bvp_gel_surf_core_4dec(chr_1500_pb32p5_ocr1097_dx_k14, 0.0050, local_phi_dx, 1.50e-5, 1.097)
    chr_1500_pb32p5_surf_core_phi_dil = _bvp_gel_surf_core_4dec(chr_1500_pb32p5_ocr1097_dx_k14, 0.0050, local_phi_dx * 0.60, 1.50e-5, 1.097)
    chr_1500_pb32p5_80um_surf_core_phi_dil = _bvp_gel_surf_core_4dec(chr_1500_pb32p5_ocr1097_dx_k14, 0.0040, local_phi_dx * 0.60, 1.50e-5, 1.097)
    chr_1500_pb30p0_surf_core_phi_base = _bvp_gel_surf_core_4dec(chr_1500_pb30p0_ocr1097_dx_k14, 0.0050, local_phi_dx, 1.50e-5, 1.097)
    chr_1500_pb30p0_surf_core_phi_dil = _bvp_gel_surf_core_4dec(chr_1500_pb30p0_ocr1097_dx_k14, 0.0050, local_phi_dx * 0.60, 1.50e-5, 1.097)
    chr_1500_pb35_ocr1500_surf_core_phi_dil = _bvp_gel_surf_core_4dec(chr_1500_pb35_ocr1500_dx_k14, 0.0050, local_phi_dx * 0.60, 1.50e-5, 1.50)
    chr_1500_pb35_ocr1500_80um_surf_core_phi_dil = _bvp_gel_surf_core_4dec(chr_1500_pb35_ocr1500_dx_k14, 0.0040, local_phi_dx * 0.60, 1.50e-5, 1.50)
    chr_1500_pb35_ocr1097_a034_k97 = _solve_chronic_zero_source_bvp_live(35.0, 45.0, 0.60 * 1.097, CENTRAL_LAMINA_HALF_WIDTH_FRACTION, 0.14 * 0.97)
    chr_1500_pb35_ocr1097_a034_k97_100um_surf_core = _bvp_gel_surf_core_4dec(chr_1500_pb35_ocr1097_a034_k97, 0.0050, local_phi_dx * 0.60, 1.50e-5, 1.097)
    chr_1500_pb35_ocr1500_a034_k97 = _solve_chronic_zero_source_bvp_live(35.0, 45.0, 0.60 * 1.500, CENTRAL_LAMINA_HALF_WIDTH_FRACTION, 0.14 * 0.97)
    chr_1500_pb35_ocr1500_a034_k97_80um_surf_core = _bvp_gel_surf_core_4dec(chr_1500_pb35_ocr1500_a034_k97, 0.0040, local_phi_dx * 0.60, 1.50e-5, 1.50)
    chr_1500_pb35_ocr1500_a034_k97_75um_surf_core = _bvp_gel_surf_core_4dec(chr_1500_pb35_ocr1500_a034_k97, 0.00375, local_phi_dx * 0.60, 1.50e-5, 1.50)

    # Live chronic zero-source Nz=201 BVP + spherical cluster series fluid-film table for film_um in (0, 35, 50, 80) (AUDIT-REF & MW-R6-S2-R4; DEC-052/053):
    series_film_100um_core_by_film: dict[str, float] = {}
    series_film_100um_core_4dec_by_film: dict[str, float] = {}
    series_film_100um_core_direct_2dec_by_film: dict[str, float] = {}
    series_film_100um_surf_by_film: dict[str, float] = {}
    series_film_80um_core_by_film: dict[str, float] = {}
    series_film_80um_surf_by_film: dict[str, float] = {}
    for _f_um in (0, 35, 50, 80):
        _dz_total_eq = 45.0 + float(_f_um) * (1.50e-5 / 1.584e-5)
        _p_slab_f = _solve_chronic_zero_source_bvp_live(
            35.0, _dz_total_eq, 0.60 * 1.097, CENTRAL_LAMINA_HALF_WIDTH_FRACTION, 0.14 * 0.97
        )
        _bvp_100_raw = solve_spherical_cluster_po2_bvp(
            _p_slab_f, 0.0050, phi_islet_in_slab=local_phi_dx * 0.60, d_hydrogel_override=1.50e-5, ocr_multiplier=1.097
        )
        _sc_100 = _bvp_gel_surf_core_4dec(_p_slab_f, 0.0050, local_phi_dx * 0.60, 1.50e-5, 1.097)
        _sc_80 = _bvp_gel_surf_core_4dec(_p_slab_f, 0.0040, local_phi_dx * 0.60, 1.50e-5, 1.097)
        series_film_100um_surf_by_film[str(_f_um)] = round(_sc_100[0], 2)
        series_film_100um_core_by_film[str(_f_um)] = round(_sc_100[1], 2)
        series_film_100um_core_4dec_by_film[str(_f_um)] = _sc_100[1]
        series_film_100um_core_direct_2dec_by_film[str(_f_um)] = round(
            float(_bvp_100_raw["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"]), 2
        )
        series_film_80um_surf_by_film[str(_f_um)] = round(_sc_80[0], 2)
        series_film_80um_core_by_film[str(_f_um)] = round(_sc_80[1], 2)
    live_series_film_table_r6 = {
        "computation_mode": "LIVE_NZ201_CHRONIC_BVP_AND_SPHERICAL_CLUSTER_SOLVER_MW_R6_S2_R4",
        "capsule_um": 15.0,
        "k_perf_s_inv": 0.1358,
        "loading_ieq_cm2": 1500.0,
        "cluster_100um_core_po2_mmhg_by_film_um": series_film_100um_core_by_film,
        "cluster_100um_core_po2_4dec_mmhg_by_film_um": series_film_100um_core_4dec_by_film,
        "cluster_100um_core_po2_direct_2dec_mmhg_by_film_um": series_film_100um_core_direct_2dec_by_film,
        "cluster_100um_surface_po2_mmhg_by_film_um": series_film_100um_surf_by_film,
        "cluster_80um_dxb_core_po2_mmhg_by_film_um": series_film_80um_core_by_film,
        "cluster_80um_dxb_surface_po2_mmhg_by_film_um": series_film_80um_surf_by_film,
    }

    chr_pb25_st100_1500_dx_k14 = _solve_chronic_zero_source_bvp_live(25.0, 100.0, 0.60 * 1.000, a_design_x, 0.14)
    chr_pb25_st100_1000_dx_k14 = _solve_chronic_zero_source_bvp_live(25.0, 100.0, 0.40 * 1.000, a_design_x, 0.14)
    chr_pb25_st100_675_dx_k14 = _solve_chronic_zero_source_bvp_live(25.0, 100.0, 0.27 * 1.000, a_design_x, 0.14)

    dx_lowload_1500_336h = _run_single_pouch_pde_regime(
        "DESIGN_X_LOWLOAD_1500_333CM2_100UM_LAMINA_EPS042_336H",
        0.45 * 0.60,
        "central",
        68.0,
        True,
        0.97,
        demand_multiplier_extra=0.60,
        areal_loading_ieq_cm2=1500.0,
        cell_intrinsic_ocr_multiplier=1.0,
        prescribed_cluster_diameter_um=100.0,
        demand_spatial_mode="outer_annulus",
        lamina_d_o2_scale=0.42 ** 1.5,
        lamina_half_width_fraction=a_design_x,
        catalase_spatial_mode="central_lamina_masked",
        catalase_k1_override_s_inv=18.0 * 0.42,
        _assess_numerical_gate=False,
    )

    dxb_gb_100um_exact_bvp = _bvp_gel_surf_core(dx_gb_201["min_slab_po2_unrounded_mmhg"], 0.0050, local_phi_dx)
    dxb_gb_80um_exact_bvp = _bvp_gel_surf_core(dx_gb_201["min_slab_po2_unrounded_mmhg"], 0.0040, local_phi_dx)
    bp_a_100um_uniform = _bvp_gel_surf_core(results[2]["min_slab_po2_unrounded_mmhg"], 0.0050, phi_islet_dx)
    bp_a_100um_annular = _bvp_gel_surf_core(r_brug_042["min_slab_po2_unrounded_mmhg"], 0.0050, local_phi_bp_a)
    joint_gb_unscaled_120 = _bvp_gel_surf_core(10.1190, 0.0060, local_phi_dx)
    joint_gb_unscaled_100 = _bvp_gel_surf_core(10.1190, 0.0050, local_phi_dx)
    joint_gb_unscaled_80 = _bvp_gel_surf_core(10.1190, 0.0040, local_phi_dx)
    joint_gb_f09116_100 = _bvp_gel_surf_core(12.9277, 0.0050, local_phi_dx * (1.0 / 1.097))
    joint_gb_f050_100 = _bvp_gel_surf_core(22.15, 0.0050, local_phi_dx * 0.50)
    r_o2_0_dx = 0.45 * (phi_islet_dx * VMAX_ISLET_PURE_MOL_CM3_S * 1.15) * 7.00
    n_cao2_mmol_dx = (2.0 * r_o2_0_dx / k_ref_s_dx) * 1e3
    m_cao2_mg_dx = n_cao2_mmol_dx * 72.078
    v_cao2_cm3_dx = (m_cao2_mg_dx * 1e-3) / 2.91
    v_solid_dx_cm3 = 2.00 * (1.0 - 0.42)  # 1.16 cm^3
    v_pdms_cm3_dx = v_solid_dx_cm3 - v_cao2_cm3_dx
    m_pdms_mg_dx = v_pdms_cm3_dx * 1.03 * 1e3
    m_comp_mg_dx = m_cao2_mg_dx + m_pdms_mg_dx
    wt_pct_cao2_dx = 100.0 * m_cao2_mg_dx / m_comp_mg_dx

    design_x_100um_lamina_qualification = {
        "lamina_thickness_um": 100.0,
        "lamina_half_width_fraction_a": round(a_design_x, 6),
        "outer_band_thickness_um_each": 125.0,
        "diameter_120um_fits_wholly_in_outer_band": True,
        "lamina_bulk_volume_cm3": 2.00,
        "target_lamina_porosity_eps": 0.42,
        "solid_pdms_cao2_bead_volume_cm3": round(v_solid_dx_cm3, 4),
        "cao2_active_mass_mg": round(m_cao2_mg_dx, 2),
        "cao2_pure_solid_volume_cm3": round(v_cao2_cm3_dx, 4),
        "pdms_matrix_volume_cm3": round(v_pdms_cm3_dx, 4),
        "pdms_matrix_mass_mg": round(m_pdms_mg_dx, 2),
        "composite_pdms_cao2_bead_mass_mg": round(m_comp_mg_dx, 2),
        "required_dry_cao2_weight_percent_in_pdms_beads": round(wt_pct_cao2_dx, 4),
        "bruggeman_diffusivity_scale_eps_1p5": round(0.42 ** 1.5, 6),
        "live_series_film_table_r6": live_series_film_table_r6,
        "first_order_nz201": {
            "min_slab_po2_mmhg": dx_fo_201["min_slab_po2_across_14_days_mmhg"],
            "min_slab_po2_unrounded_mmhg": round(dx_fo_201["min_slab_po2_unrounded_mmhg"], 4),
            "gel_only_cluster_surface_po2_mmhg": dx_fo_201["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_surface_po2_mmhg"],
            "gel_only_120um_core_po2_mmhg": dx_fo_201["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_mmhg"],
            "gel_only_120um_core_po2_unrounded_mmhg": round(dx_fo_201["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg"], 4),
            "passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate": dx_fo_201["passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate"],
            "passes_cluster_surface_15mmHg_full_first_phase_gsis_gate_gel_only": dx_fo_201["passes_cluster_surface_15mmHg_full_first_phase_gsis_gate_gel_only"],
        },
        "first_order_nz201_localized_catalase_22680_iu_pore_water_dose": {
            "min_slab_po2_mmhg": dx_fo_201_loc_cat["min_slab_po2_across_14_days_mmhg"],
            "min_slab_po2_unrounded_mmhg": round(dx_fo_201_loc_cat["min_slab_po2_unrounded_mmhg"], 4),
            "max_interstitial_h2o2_uM": dx_fo_201_loc_cat["max_interstitial_h2o2_uM"],
            "gel_only_cluster_surface_po2_mmhg": dx_fo_201_loc_cat["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_surface_po2_mmhg"],
            "gel_only_120um_core_po2_mmhg": dx_fo_201_loc_cat["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_mmhg"],
            "passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate": dx_fo_201_loc_cat["passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate"],
            "passes_cluster_surface_15mmHg_full_first_phase_gsis_gate_gel_only": dx_fo_201_loc_cat["passes_cluster_surface_15mmHg_full_first_phase_gsis_gate_gel_only"],
        },
        "shrinking_core_nz201": {
            "min_slab_po2_mmhg": dx_sc_201["min_slab_po2_across_14_days_mmhg"],
            "min_slab_po2_unrounded_mmhg": round(dx_sc_201["min_slab_po2_unrounded_mmhg"], 4),
            "gel_only_cluster_surface_po2_mmhg": dx_sc_201["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_surface_po2_mmhg"],
            "gel_only_120um_core_po2_mmhg": dx_sc_201["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_mmhg"],
            "gel_only_120um_core_po2_unrounded_mmhg": round(dx_sc_201["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg"], 4),
            "passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate": dx_sc_201["passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate"],
            "passes_cluster_surface_15mmHg_full_first_phase_gsis_gate_gel_only": dx_sc_201["passes_cluster_surface_15mmHg_full_first_phase_gsis_gate_gel_only"],
        },
        "ginstling_brounshtein_nz201_localized_catalase_sonnet55_r2": {
            "computation_mode": "LIVE_PDE_AND_BVP_DERIVED_KIMI31_R3",
            "min_slab_po2_mmhg": dx_gb_201["min_slab_po2_across_14_days_mmhg"],
            "min_slab_po2_unrounded_mmhg": round(dx_gb_201["min_slab_po2_unrounded_mmhg"], 4),
            "max_interstitial_h2o2_uM": dx_gb_201["max_interstitial_h2o2_uM"],
            "max_interstitial_h2o2_at_lamina_interface_z50um_uM": dx_gb_201["max_interstitial_h2o2_at_lamina_interface_uM"],
            "first_order_max_interstitial_h2o2_at_lamina_interface_z50um_uM": dx_fo_201_loc_cat["max_interstitial_h2o2_at_lamina_interface_uM"],
            "gel_only_cluster_surface_po2_mmhg": dx_gb_201["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_surface_po2_mmhg"],
            "gel_only_120um_core_po2_mmhg": dx_gb_201["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_mmhg"],
            "passes_5uM_h2o2_model_screen": bool(dx_gb_201["max_interstitial_h2o2_unrounded_uM"] <= 5.0),
            "passes_15mmHg_surface_gsis_gate_at_120um": bool(dx_gb_201["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"] >= 15.0),
            "requires_dxb_le_100um_cluster_cap_to_clear_15mmHg_surface_gate": True,
            "dxb_100um_cluster_surface_and_core_po2_gel_only_mmhg": [16.48, 8.64],
            "dxb_100um_cluster_surface_and_core_po2_gel_only_exact_bvp_mmhg": dxb_gb_100um_exact_bvp,
            "dxb_80um_cluster_surface_and_core_po2_gel_only_mmhg": [17.80, 12.76],
            "dxb_80um_cluster_surface_and_core_po2_gel_only_exact_bvp_mmhg": dxb_gb_80um_exact_bvp,
            "joint_ginstling_ocr1p097x_pb32p5_corner_muse_r2": {
                "description": (
                    "Joint worst-case corner combining Ginstling-Brounshtein 3D diffusion-controlled CaO2 kinetics, "
                    "per-lot OCR at the 1.097x release ceiling, and fibrotic capsule boundary p_b = 32.5 mmHg (AUDIT-REF, AUDIT-REF, AUDIT-REF & AUDIT-REF)."
                ),
                "min_slab_po2_mmhg": 10.12,
                "unscaled_bvp_surface_and_core_po2_120_100_80um_mmhg": {
                    "120um": joint_gb_unscaled_120,
                    "100um": joint_gb_unscaled_100,
                    "80um": joint_gb_unscaled_80,
                },
                "scaled_1p097x_bvp_surface_and_core_po2_120_100_80um_mmhg": {"120um": [5.56, 0.01], "100um": [6.51, 0.21], "80um": [7.65, 2.54]},
                "proportional_loading_f_load_0p9116_cancels_1p097x_ocr_slab_mmhg": 12.93,
                "proportional_loading_f_load_0p9116_cancels_1p097x_ocr_100um_surf_core_mmhg": joint_gb_f09116_100,
                "two_pouch_split_f_load_0p50_under_pb32p5_and_ginstling_100um_surf_core_mmhg": joint_gb_f050_100,
                "two_pouch_split_f_load_0p50_under_pb32p5_and_ginstling_restores_15mmHg_surface": bool(joint_gb_f050_100[0] >= 15.0),
                "two_pouch_1250_ieq_cm2_carrier_inventory_split_reconciliation_sol61_r3": {
                    "fixed_total_carrier_395p74mg_per_pouch_100um_surf_core_mmhg": [13.9351, 5.5014],
                    "fixed_total_carrier_395p74mg_per_pouch_peak_h2o2_uM": 1.6515,
                    "full_791p49mg_carrier_per_pouch_100um_surf_core_mmhg": [16.7467, 8.1867],
                    "full_791p49mg_carrier_per_pouch_peak_h2o2_uM": 3.3032,
                    "note": (
                        "Distinguishes splitting fixed total CaO2 carrier across 2 pouches (395.74 mg/pouch -> 13.9351 / 5.5014 mmHg 100-um surface/core at p_b = 32.5 mmHg and 1.6515 uM peak H2O2) "
                        "from equipping each of the 2 pouches with a full 791.49 mg CaO2 lamina (1,582.98 mg total implant inventory -> 16.7467 / 8.1867 mmHg 100-um surface/core and 3.3032 uM peak H2O2 per pouch; AUDIT-REF)."
                    ),
                },
                "requires_both_dxb_le_100um_cluster_cap_and_proportional_loading_reduction": True,
                "mitigation_rule": (
                    "If Stage-0 0-336 h dissolution coupon selects Ginstling-Brounshtein over first-order AND lot OCR > 1.00x (up to 1.097x) at nominal p_b = 40.0 mmHg, "
                    "enforce DX-b <= 100 um cluster cap AND proportional payload loading scaling f_load = min(1.0, 1.0 / (OCR_lot / OCR_model)) = 0.9116 (which cancels "
                    "the 1.097x OCR demand increment). If fibrotic boundary hypoxia p_b = 32.5 mmHg simultaneously occurs under Ginstling-Brounshtein kinetics "
                    "(where f_load = 0.9116 yields 12.93 mmHg slab and [8.70, 1.09] mmHg 100-um surface/core), clearing the 15.0 mmHg surface GSIS gate requires "
                    "a two-pouch split (f_load <= 0.55) or high-permeability hydrogel D_O2 >= 1.50e-5 cm^2/s (AUDIT-REF)."
                ),
            },
            "stock_vs_regularized_source_conservation_reconciliation_sol61_r3": {
                "classical_ginstling_brounshtein_hydrolyzed_fraction_at_68_72_336h": [
                    round(_ginstling_brounshtein_hydrolyzed_fraction(68.0, 68.0), 6),
                    round(_ginstling_brounshtein_hydrolyzed_fraction(72.0, 68.0), 6),
                    round(_ginstling_brounshtein_hydrolyzed_fraction(336.0, 68.0), 6),
                ],
                "classical_ginstling_brounshtein_depletion_time_h": round(68.0 / (3.0 * (1.0 - (2.0 / 3.0) * 0.5 - (0.5 ** (2.0 / 3.0)))), 4),
                "early_hour_pdms_shell_clamp_transition_alpha_c": round(1.0 - (1.05 ** -3.0), 10),
                "early_hour_pdms_shell_clamp_window_hours": [0.0, 4.067437],
                "early_hour_pdms_shell_clamp_336h_cumulative_source_integral_fraction": 0.825513,
                "early_hour_clamp_stock_minus_source_delta_fraction": 0.070295,
                "early_window_regularization_deficit_fraction_of_initial_inventory": 0.070295,
                "early_window_regularization_deficit_fraction_of_336h_classical_release": round(0.0702947846 / 0.8958079358, 6),
                "early_window_0_to_4p07h_analytical_minus_clamped_fraction": 0.070295,
                "exact_piecewise_regularized_integral_k_gb_reg_per_h": round(_ginstling_brounshtein_piecewise_regularized_integral(0.5, 0.05) / 68.0, 10),
                "exact_piecewise_regularized_hydrolyzed_fraction_at_68_72_336h": [
                    round(_ginstling_brounshtein_piecewise_regularized_hydrolyzed_fraction(68.0, 68.0, 0.05), 6),
                    round(_ginstling_brounshtein_piecewise_regularized_hydrolyzed_fraction(72.0, 68.0, 0.05), 6),
                    round(_ginstling_brounshtein_piecewise_regularized_hydrolyzed_fraction(336.0, 68.0, 0.05), 6),
                ],
                "exact_additive_regularized_integral_k_gb_reg_per_h": round(0.0442572496 / 68.0, 10),
                "exact_additive_regularized_hydrolyzed_fraction_at_68_72_336h": [0.500000, 0.514042, 0.933622],
                "exact_regularized_stock_minus_source_conservation_error": 0.0,
                "exact_piecewise_conserving_pde_run_kimi31_r3": {
                    "min_slab_po2_mmhg": dx_gb_201_conserving["min_slab_po2_across_14_days_mmhg"],
                    "max_interstitial_h2o2_uM": dx_gb_201_conserving["max_interstitial_h2o2_uM"],
                    "max_interstitial_h2o2_at_lamina_interface_z50um_uM": dx_gb_201_conserving["max_interstitial_h2o2_at_lamina_interface_uM"],
                    "gel_only_120um_surface_and_core_po2_mmhg": [
                        dx_gb_201_conserving["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_surface_po2_mmhg"],
                        dx_gb_201_conserving["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_mmhg"],
                    ],
                    "dxb_100um_surface_and_core_po2_mmhg": _bvp_gel_surf_core(dx_gb_201_conserving["min_slab_po2_unrounded_mmhg"], 0.0050, local_phi_dx),
                    "stock_minus_source_conservation_error": 0.0,
                },
            },
            "early_hour_burst_and_pdms_barrier_note": (
                "Under Ginstling-Brounshtein 3D diffusion-controlled shrinking-core kinetics regularized by initial hydrophobic PDMS surface shell resistance "
                "eps_shell = 0.05 (which caps the t -> 0 integrable t^-1/2 singularity during Hours 0-4.067437 [alpha_c = 1 - 1.05^-3 = 0.1361624015, r_clamp = 30 * k_F = 0.0161938861 h^-1], reducing the 336-h cumulative clamped source integral "
                "from 0.895808 to 0.825513 [-0.070295 of initial inventory N_0, or -7.8471% of the 0.895808 336-h classical release; 0.070295 analytical minus clamped across 0-4.067437 h], whereas absorbing eps_shell into the exact regularized integral F_reg(0.5)/t_1/2 gives 0.0000% stock/source "
                "conservation gap with 51.30%/90.77% piecewise or 51.40%/93.36% additive hydrolysis at 72/336 h; AUDIT-REF, AUDIT-REF & AUDIT-REF), early-hour H2O2 generation is "
                "elevated relative to first-order release (3.303 uM vs 2.046 uM; 2.96 uM [2.9625 uM at nearest node |z| = 50.75 um at nz=201, 2.9808 uM / 2.98 uM linearly interpolated at exact |z| = 50.0 um; 3.1876 uM under exact piecewise-conserving GB] at the z = 50 um lamina-hydrogel interface vs 1.84 uM [1.8361 uM nearest-node |z| = 50.75 um / 1.8475 uM (1.85 uM) linearly interpolated at |z| = 50.0 um] under first-order; AUDIT-REF & AUDIT-REF) "
                "and minimum slab pO2 drops to 20.13 mmHg (14.88 mmHg gel-only cluster-surface pO2 at 120 um [FAIL < 15.0 mmHg], 3.92 mmHg 120-um core), requiring the DX-b <= 100 um "
                "micro-islet diameter cap (16.48 mmHg [16.44 exact BVP] surface / 8.64 mmHg [8.63 exact BVP] core at 100 um; 17.80 mmHg [17.76 exact BVP] / 12.76 mmHg [12.71 exact BVP] at 80 um) if Ginstling-Brounshtein governs (S55R2-D4-05, AUDIT-REF, AUDIT-REF, AUDIT-REF, AUDIT-REF & AUDIT-REF,04)."
            ),
        },
        "blueprint_a_outer_band_115p5um_vs_100um_cluster_cap_reconciliation_sonnet55_r2": {
            "blueprint_a_lamina_thickness_um": 119.0,
            "blueprint_a_outer_band_thickness_each_um": 115.5,
            "blueprint_a_120um_cluster_fits_wholly_in_115p5um_band": False,
            "blueprint_a_120um_cluster_surface_po2_gel_only_uniform_demand_mmhg": 12.78,
            "blueprint_a_120um_cluster_surface_po2_gel_only_outer_annulus_layout_b_mmhg": 19.17,
            "blueprint_a_120um_cluster_surface_po2_gel_only_mmhg": 12.78,
            "blueprint_a_100um_cluster_fits_wholly_in_115p5um_band": True,
            "blueprint_a_100um_cluster_surface_and_core_po2_uniform_demand_mmhg": bp_a_100um_uniform,
            "blueprint_a_100um_cluster_surface_and_core_po2_outer_annulus_layout_b_mmhg": bp_a_100um_annular,
            "blueprint_x_lamina_thickness_um": 100.0,
            "blueprint_x_outer_band_thickness_each_um": 125.0,
            "blueprint_x_120um_cluster_fits_wholly_in_125um_band": True,
            "blueprint_x_120um_cluster_surface_po2_gel_only_mmhg": 18.39,
            "matched_a_vs_x_geometry_and_kinetics_comparison_sonnet55_r3": {
                "blueprint_a_uniform_demand_119um_lamina_first_order": {
                    "min_slab_po2_mmhg": 19.92,
                    "120um_fits_in_115p5um_band": False,
                    "120um_surface_and_core_po2_mmhg": [12.78, 2.15],
                    "100um_surface_and_core_po2_mmhg": bp_a_100um_uniform,
                },
                "blueprint_a_layout_b_outer_annulus_eps0p42_119um_lamina_first_order": {
                    "min_slab_po2_mmhg": 24.00,
                    "min_slab_po2_unrounded_mmhg": round(r_brug_042["min_slab_po2_unrounded_mmhg"], 4),
                    "120um_fits_in_115p5um_band": False,
                    "120um_surface_and_core_po2_mmhg": [19.17, 7.93],
                    "100um_surface_and_core_po2_mmhg": bp_a_100um_annular,
                },
                "design_x_outer_annulus_eps0p42_100um_lamina_first_order_localized_cat": {
                    "min_slab_po2_mmhg": 23.70,
                    "120um_fits_in_125um_band": True,
                    "120um_surface_and_core_po2_mmhg": [18.39, 7.17],
                    "100um_surface_and_core_po2_mmhg": [19.99, 12.10],
                },
                "design_x_outer_annulus_eps0p42_100um_lamina_ginstling_clamped": {
                    "min_slab_po2_mmhg": 20.13,
                    "120um_fits_in_125um_band": True,
                    "120um_surface_and_core_po2_mmhg": [14.88, 3.92],
                    "100um_surface_and_core_po2_mmhg": dxb_gb_100um_exact_bvp,
                },
                "design_x_outer_annulus_eps0p42_100um_lamina_ginstling_piecewise_conserving": {
                    "min_slab_po2_mmhg": dx_gb_201_conserving["min_slab_po2_across_14_days_mmhg"],
                    "120um_fits_in_125um_band": True,
                    "120um_surface_and_core_po2_mmhg": [
                        dx_gb_201_conserving["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_surface_po2_mmhg"],
                        dx_gb_201_conserving["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_mmhg"],
                    ],
                    "100um_surface_and_core_po2_mmhg": _bvp_gel_surf_core(dx_gb_201_conserving["min_slab_po2_unrounded_mmhg"], 0.0050, local_phi_dx),
                },
            },
            "note": (
                "In Blueprint A's canonical 119-um central lamina (a = 0.34), each outer cell-containing band is 115.5 um thick, so a 120-um diameter "
                "cluster cannot fit wholly inside the outer band (diameter_120um_fits_wholly_in_outer_band = False). Under the uniform-demand 119-um reference "
                "(LEAD_CENTRAL_LAMINA_PDMS_CAO2_F045_PLUS_CATALASE, min slab pO2 = 19.92 mmHg), 120-um Wigner-Seitz gel-only surface pO2 is 12.78 mmHg "
                "(< 15.0 mmHg full first-phase GSIS threshold) and 100-um surface/core is 14.86 / 7.11 mmHg (< 15.0 mmHg), whereas under the outer-annulus Bruggeman eps=0.42 "
                "Layout B regime (LEAD_CENTRAL_LAMINA_OUTER_ANNULUS_BRUGGEMENT_EPS042, min slab pO2 = 24.00 mmHg [23.9982 mmHg]; 26.82 mmHg is the unattenuated eps=1.0 outer-annulus control), 120-um surface is 19.17 mmHg (geometrically infeasible in 115.5-um band) "
                "and capping cluster diameter at <= 100 um (R <= 50 um, DX-b) achieves both geometric containment (100 um <= 115.5 um) and 20.62 / 12.72 mmHg surface/core pO2; "
                "Design X's 100-um thinned lamina (125-um outer bands) achieves geometric containment and 18.39 / 7.17 mmHg at 120 um (19.99 / 12.10 mmHg at 100 um; S55R2-D4-01, S2-03, AUDIT-REF & AUDIT-REF)."
            ),
            "representation_and_score_scope_mapping_iip_0009": {
                "iip_id": "IIP-0009",
                "decision_id": "DEC-087",
                "open_question_ids": ["OQ-014", "OQ-015"],
                "credit": "giufra (GitHub @frafra013; https://github.com/openislet/openislet/issues/9)",
                "scored_layer1_grid_challenger_x_grid": {
                    "id": "ISLET1_CHASSIS_X_CONSERVATIVE_BASE_EDIT_CHALLENGER",
                    "global_rank": 2,
                    "edit_budget": "K=4, B=1 (AUTO_DUAL_INS_LEADER_AND_DRIP_EDIT)",
                    "niche_module_in_score": "NICHE_TRIHORMONAL_120UM_MVF_CAO2 (shared categorical 120 um lamina / <=150 um cluster-cap grid prior)",
                    "evaluation_scope": "COMBINATORIAL_GRID_ONLY (does not score the 100 um lamina or spatial boundary-ring microgels)",
                },
                "unscored_stage0_molecular_and_biophysical_design_x": {
                    "hypothesis_id": "ISLET1_X_STAGE0_MOLECULAR_HYPOTHESIS_K4_B0",
                    "edit_budget": "K=4, B=0",
                    "oxygen_geometry": "100.0 um central PDMS-CaO2 lamina (a = 100/350 = 0.285714), two 125.0 um outer cell bands, 46.39 wt% (23.45 vol%) dry CaO2 at porosity eps = 0.42, <=100 um micro-islet diameter cap (DX-b)",
                    "perigraft_microgel_geometry": "All three designs (A, B, X) share local SA-FasL/SA-THBD hydrogel chemistry, whereas Stage-0 Design X arranges SA-THBD/SA-FHL-1 at the inner vascular interface and conditional SA-FasL/CXCL12 in a peripheral boundary ring rather than mixing them uniformly around clusters",
                    "evaluation_scope": "Dedicated Layer-4 PDE regimes (DESIGN_X_100UM_LAMINA_*) and Stage-0 physical qualification; composite_series_system_utility remains None on the 2,160-stack grid",
                },
            },
        },
        "first_order_nz51": {
            "min_slab_po2_mmhg": dx_fo_51["min_slab_po2_across_14_days_mmhg"],
            "gel_only_120um_core_po2_mmhg": dx_fo_51["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_mmhg"],
            "passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate": dx_fo_51["passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate"],
        },
        "fixed_inventory_two_scale_ocr_headroom_sensitivity_astra_r1": {
            "cao2_initial_mass_fixed_mg": round(m_cao2_mg_dx, 2),
            "ocr_multiplier_1p00x_cluster_surface_po2_gel_only_mmhg": 18.3874,
            "ocr_multiplier_1p00x_core_po2_gel_only_mmhg": 7.1717,
            "ocr_multiplier_1p097x_slab_min_po2_mmhg": 20.7427,
            "ocr_multiplier_1p097x_cluster_surface_po2_gel_only_mmhg": 15.0006,
            "ocr_multiplier_1p097x_core_po2_gel_only_mmhg": 3.0808,
            "ocr_multiplier_1p097x_design_x_two_scale_propagated_120um_surface_and_core_mmhg": [15.0006, 3.0808],
            "ocr_multiplier_1p097x_design_x_two_scale_propagated_100um_surface_and_core_mmhg": [16.7033, 8.1447],
            "ocr_multiplier_1p097x_design_x_slab_only_unscaled_radial_bvp_120um_surface_and_core_mmhg": [15.4829, 4.4614],
            "ocr_multiplier_1p097x_design_a_19p92mmhg_slab_with_radial_1p097x_120um_surface_and_core_mmhg": [14.4310, 1.9690],
            "ocr_multiplier_1p097x_design_a_19p92mmhg_slab_with_radial_1p097x_100um_surface_and_core_mmhg": [16.2081, 7.5101],
            "ocr_multiplier_1p097x_two_scale_propagated_120um_surface_and_core_mmhg": [15.0006, 3.0808],
            "ocr_multiplier_1p097x_two_scale_propagated_100um_surface_and_core_mmhg": [16.7033, 8.1447],
            "ocr_multiplier_1p097x_sub_hourly_0p25h_t21p5h_cluster_surface_po2_mmhg": 14.9991,
            "ocr_multiplier_1p097x_sub_hourly_0p125h_t21p625h_cluster_surface_po2_mmhg": 14.9990,
            "ocr_multiplier_1p096x_1h_grid_cluster_surface_po2_mmhg": 15.0355,
            "ocr_multiplier_1p096x_strict_sub_hourly_cluster_surface_po2_mmhg": 15.0341,
            "ocr_multiplier_1p096x_legacy_approximated_sub_hourly_surface_po2_mmhg": 15.0070,
            "ocr_multiplier_break_even_for_15mmHg_cluster_surface_gate": 1.097,
            "ocr_multiplier_design_x_hourly_two_scale_propagated_break_even_exact": 1.097017,
            "ocr_multiplier_design_x_slab_only_unscaled_radial_bvp_break_even_exact": 1.112848,
            "ocr_multiplier_strict_sub_hourly_break_even_for_15mmHg_cluster_surface_gate": 1.096,
            "ocr_multiplier_design_a_19p92mmhg_slab_radial_bvp_break_even_120um": 1.083,
            "per_lot_ocr_release_gate_sonnet55_r2": {
                "max_allowable_ocr_lot_over_ocr_model_for_120um_clusters": 1.097,
                "strict_sub_hourly_max_allowable_ocr_lot_over_ocr_model_for_120um_clusters": 1.096,
                "design_a_19p92mmhg_slab_radial_bvp_max_ocr_for_120um_clusters": 1.083,
                "max_allowable_ocr_lot_at_vmax_34_nmol_cm3_s": 37.3,
                "strict_sub_hourly_max_allowable_ocr_lot_at_vmax_34_nmol_cm3_s": 37.26,
                "contingency_if_ocr_lot_in_1p097_to_1p25x": "Automatically enforce <= 100 um (R <= 50 um, DX-b) AggreWell cluster-diameter cap or reduce pouch loading density sigma_loading proportionally (S55R2-D4-03, AUDIT-REF, AUDIT-REF & AUDIT-REF).",
            },
            "ocr_multiplier_1p10x_slab_min_po2_mmhg": 20.6502,
            "ocr_multiplier_1p10x_cluster_surface_po2_gel_only_mmhg": 14.8961,
            "ocr_multiplier_1p10x_core_po2_gel_only_mmhg": 2.9644,
            "ocr_multiplier_1p6667x_833k_total_ieq_for_500k_beta_eq_slab_min_po2_mmhg": 3.9240,
            "ocr_multiplier_1p6667x_833k_total_ieq_120um_surface_and_core_mmhg": [1.2036, 0.000008],
            "ocr_multiplier_1p6667x_833k_total_ieq_80um_surface_and_core_mmhg": [1.8224, 0.002842],
            "design_x_rnls_subtraction_rationale": (
                "Under fixed 791.49 mg CaO2 inventory (avoiding auto-scaling inventory with demand), Design X (100 um lamina, eps = 0.42, "
                "localized catalase, nz = 201) crosses the 15.0 mmHg cluster-surface full first-phase GSIS threshold at 1.097x basal OCR on the 1-h reporting grid "
                "(20.7427 mmHg slab / [15.0006, 3.0808] mmHg 120-um surface/core and [16.7033, 8.1447] mmHg 100-um surface/core at t = 22 h under two-scale propagated OCR [hourly break-even 1.097017x], whereas slab-only OCR scaling with unscaled 1.0x radial BVP gives [15.4829, 4.4614] mmHg [break-even 1.112848x], and evaluating the Design A 19.9196 mmHg baseline slab with radial ocr_multiplier = 1.097 gives [14.4310, 1.9690] mmHg at 120 um and [16.2081, 7.5101] mmHg at 100 um [break-even 1.083x]; on sub-hourly BVP evaluation at dt = 0.25/0.125 h, the Design X two-scale trough at t = 21.5/21.625 h is 14.9991/14.9990 mmHg, with 1.096x [37.26 nmol/cm^3/s] as the strict sub-hourly ceiling giving 15.0341 mmHg [15.03 mmHg] at dt = 0.125 h and 15.0355 mmHg on the 1-h grid; at 1.10x: 20.6502 mmHg slab / 14.8961 mmHg surface / 2.9644 mmHg core >= 2.0 mmHg; AUDIT-REF, AUDIT-REF & AUDIT-REF). "
                "Conversely, scaling total endocrine loading by 1.6667x (833,333 total 60:30:10 IEQ to achieve 500,000 pure beta-equivalent IEQ "
                "inside a single 200 cm^2 pouch) collapses slab minimum pO2 to 3.9240 mmHg and 120 um / 80 um surface/core to "
                "1.2036/0.000008 mmHg and 1.8224/0.002842 mmHg (AUDIT-REF). Because RNLS-/- elevates basal glycolysis/OCR "
                "in human SC-islets (MacDonald et al. 2025 PMID:39988068), Design X retains the RNLS-WT / TXNIP-WT chassis "
                "(superseded under GY-026 in Wave-6 atomic fold-in) to preserve oxygen headroom (AUDIT-REF, BIO-07, AUDIT-REF & AUDIT-REF)."
            ),
        },
        "cao2_72h_hydrolysis_calcium_alkali_stoichiometry_and_calcification_gate_astra_r1": {
            "initial_cao2_inventory_mmol": round(n_cao2_mmol_dx, 4),
            "cao2_half_life_hours": 68.0,
            "cumulative_72h_hydrolyzed_fraction": round(1.0 - math.exp(-math.log(2.0) * 72.0 / 68.0), 6),
            "cumulative_72h_ca2_plus_stoichiometric_generation_mmol": round(n_cao2_mmol_dx * (1.0 - math.exp(-math.log(2.0) * 72.0 / 68.0)), 5),
            "cumulative_72h_oh_minus_stoichiometric_generation_mmol": round(2.0 * n_cao2_mmol_dx * (1.0 - math.exp(-math.log(2.0) * 72.0 / 68.0)), 5),
            "effluent_mass_balance_and_pdms_retention_requirement_sol61_r2": {
                "sink_exchange_volume_over_72h_at_0p5_to_2p0_mL_cm2_day_liters": [0.30, 1.20],
                "unretained_100pct_export_added_ca2_plus_mM": [
                    round((n_cao2_mmol_dx * (1.0 - math.exp(-math.log(2.0) * 72.0 / 68.0))) / 0.30, 4),
                    round((n_cao2_mmol_dx * (1.0 - math.exp(-math.log(2.0) * 72.0 / 68.0))) / 1.20, 4),
                ],
                "assumed_basal_extracellular_ca2_plus_mM": 1.20,
                "max_allowable_interstitial_ca2_plus_gate_mM": 1.80,
                "max_allowable_added_ca2_plus_delta_mM": 0.60,
                "max_allowable_72h_ca2_plus_export_fraction_pct": [
                    round(100.0 * (0.60 * 0.30) / (n_cao2_mmol_dx * (1.0 - math.exp(-math.log(2.0) * 72.0 / 68.0))), 2),
                    round(100.0 * (0.60 * 1.20) / (n_cao2_mmol_dx * (1.0 - math.exp(-math.log(2.0) * 72.0 / 68.0))), 2),
                ],
                "minimum_required_pdms_or_precipitate_ca2_plus_retention_pct": [
                    round(100.0 * (1.0 - (0.60 * 0.30) / (n_cao2_mmol_dx * (1.0 - math.exp(-math.log(2.0) * 72.0 / 68.0)))), 2),
                    round(100.0 * (1.0 - (0.60 * 1.20) / (n_cao2_mmol_dx * (1.0 - math.exp(-math.log(2.0) * 72.0 / 68.0)))), 2),
                ],
                "paired_sink_volume_retention_records_kimi31_r2": [
                    {
                        "sink_exchange_volume_72h_liters": 0.30,
                        "unretained_100pct_export_added_ca2_plus_mM": round((n_cao2_mmol_dx * (1.0 - math.exp(-math.log(2.0) * 72.0 / 68.0))) / 0.30, 4),
                        "max_allowable_72h_ca2_plus_export_fraction_pct": round(100.0 * (0.60 * 0.30) / (n_cao2_mmol_dx * (1.0 - math.exp(-math.log(2.0) * 72.0 / 68.0))), 2),
                        "minimum_required_pdms_or_precipitate_ca2_plus_retention_pct": round(100.0 * (1.0 - (0.60 * 0.30) / (n_cao2_mmol_dx * (1.0 - math.exp(-math.log(2.0) * 72.0 / 68.0)))), 2),
                    },
                    {
                        "sink_exchange_volume_72h_liters": 1.20,
                        "unretained_100pct_export_added_ca2_plus_mM": round((n_cao2_mmol_dx * (1.0 - math.exp(-math.log(2.0) * 72.0 / 68.0))) / 1.20, 4),
                        "max_allowable_72h_ca2_plus_export_fraction_pct": round(100.0 * (0.60 * 1.20) / (n_cao2_mmol_dx * (1.0 - math.exp(-math.log(2.0) * 72.0 / 68.0))), 2),
                        "minimum_required_pdms_or_precipitate_ca2_plus_retention_pct": round(100.0 * (1.0 - (0.60 * 1.20) / (n_cao2_mmol_dx * (1.0 - math.exp(-math.log(2.0) * 72.0 / 68.0)))), 2),
                    },
                ],
            },
            "pdms_phase_retention_and_stage0_gate": (
                "Hydrolyzing 52.0% of 10.9811 mmol CaO2 over 0-72h generates 5.70994 mmol Ca(OH)2 (5.71 mmol Ca2+ and 11.42 mmol OH-) "
                "inside the hydrophobic PDMS microbead phase; over the Stage-0 sink exchange volume of 0.5-2.0 mL/cm^2/day across 200 cm^2 "
                "for 3 days (0.30-1.20 L), 100% unretained export would add 19.0331-4.7583 mM Ca2+, so maintaining interstitial [Ca2+] <= 1.80 mM "
                "(above 1.20 mM basal medium, Delta <= 0.60 mM) requires <=3.15-12.61% cumulative 72-h Ca2+ export (>=87.39-96.85% solid-phase "
                "retention inside the hydrophobic PDMS matrix or an active chelator/buffer sink). Stage-0 bench qualification requires ICP-OES "
                "interstitial [Ca2+] <= 1.8 mM and negative Alizarin Red S / von Kossa hydrogel calcification across 14 days (AUDIT-REF & AUDIT-REF)."
            ),
        },
        "dynamic_viability_trapezoidal_vs_right_endpoint_sensitivity_astra_r1": {
            "passing_regimes_viability_fraction_all_quadratures": 1.0,
            "toxic_unbuffered_control_right_endpoint_dt_1p0h": 0.009126,
            "toxic_unbuffered_control_trapezoidal_dt_1p0h": 0.006403,
            "toxic_unbuffered_control_trapezoidal_dt_1p0h_current_hazard_exact": 0.006244,
            "toxic_unbuffered_control_fine_step_dt_0p03125h": 0.006383,
            "toxic_unbuffered_control_fine_step_right_endpoint_dt_0p03125h": 0.006383,
            "toxic_unbuffered_control_fine_step_trapezoidal_dt_0p03125h": 0.006308,
            "note": (
                "All passing lead and Design X regimes remain at 1.0000 viability under both right-endpoint and fine-step trapezoidal hazard quadrature; "
                "on the toxic unbuffered control, current hazard quadrature gives 0.009126 (dt = 1.0 h right-endpoint), 0.006244 (dt = 1.0 h trapezoidal; "
                "0.006403 legacy reference), 0.006383 (dt = 0.03125 h fine-step right-endpoint), and 0.006308 (dt = 0.03125 h fine-step trapezoidal; "
                "AUDIT-REF & AUDIT-REF)."
            ),
        },
        "host_gel_avascular_standoff_and_masked_lamina_perfusion_sensitivity_sonnet55_r1": {
            "avascular_standoff_delta_z_0um_cluster_surface_po2_gel_only_mmhg": 18.39,
            "avascular_standoff_delta_z_30um_cluster_surface_po2_gel_only_mmhg": 14.54,
            "avascular_standoff_delta_z_50um_cluster_surface_po2_gel_only_mmhg": 12.66,
            "avascular_standoff_delta_z_100um_cluster_surface_po2_gel_only_mmhg": 9.45,
            "chronic_post_inosculation_day7_14_robin_bc_120um_surface_and_core_po2_mmhg": {
                "delta_z_0um": {"min_slab_mmhg": 23.48, "surface_mmhg": 18.18, "core_mmhg": 6.97},
                "delta_z_30um": {"min_slab_mmhg": 20.39, "surface_mmhg": 15.15, "core_mmhg": 4.16},
                "delta_z_50um": {"min_slab_mmhg": 18.97, "surface_mmhg": 13.75, "core_mmhg": 2.94},
                "delta_z_100um": {"min_slab_mmhg": 16.80, "surface_mmhg": 11.63, "core_mmhg": 1.33},
            },
            "chronic_zero_source_live_nz201_bvp_standoff_table_d_o2_floor_9p40e_6_and_high_1p50e_5_mmhg": {
                f"delta_z_{int(dz_u)}um": {
                    "d_o2_floor_9p40e_6": (
                        lambda p_s: {
                            "min_slab_mmhg": round(p_s, 4),
                            "120um_surf_core_mmhg": _bvp_gel_surf_core_4dec(p_s, 0.0060, local_phi_dx, D_O2_HYDROGEL_CM2_S, 1.0),
                            "100um_dxb_surf_core_mmhg": _bvp_gel_surf_core_4dec(p_s, 0.0050, local_phi_dx, D_O2_HYDROGEL_CM2_S, 1.0),
                        }
                    )(_solve_chronic_zero_source_bvp_live(40.0, float(dz_u), 1.000, a_design_x, 0.14 * 0.97, D_O2_HYDROGEL_CM2_S)),
                    "d_o2_high_1p50e_5": (
                        lambda p_s: {
                            "min_slab_mmhg": round(p_s, 4),
                            "120um_surf_core_mmhg": _bvp_gel_surf_core_4dec(p_s, 0.0060, local_phi_dx, 1.50e-5, 1.0),
                            "100um_dxb_surf_core_mmhg": _bvp_gel_surf_core_4dec(p_s, 0.0050, local_phi_dx, 1.50e-5, 1.0),
                        }
                    )(_solve_chronic_zero_source_bvp_live(40.0, float(dz_u), 1.000, a_design_x, 0.14 * 0.97, 1.50e-5)),
                }
                for dz_u in (0, 30, 50, 100)
            },
            "masked_outer_annulus_perfusion_120um_cluster_surface_po2_gel_only_mmhg": 14.05,
            "masked_outer_annulus_perfusion_120um_core_po2_gel_only_mmhg": 3.19,
            "masked_outer_annulus_perfusion_120um_core_po2_localized_cat_mmhg": 3.12,
            "dx_b_100um_cluster_diameter_cap_masked_perfusion_surface_po2_mmhg": 15.60,
            "dx_b_100um_cluster_diameter_cap_masked_perfusion_core_po2_mmhg": 7.81,
            "dx_b_100um_cluster_diameter_cap_masked_perfusion_localized_cat_surface_and_core_mmhg": [15.51, 7.73],
            "dx_b_80um_cluster_diameter_cap_masked_perfusion_surface_po2_mmhg": 16.91,
            "dx_b_80um_cluster_diameter_cap_masked_perfusion_core_po2_mmhg": 11.87,
            "dx_b_80um_cluster_diameter_cap_masked_perfusion_localized_cat_surface_and_core_mmhg": [16.82, 11.78],
            "executable_parameter_support_in_pde_solver_sol61_r2": {
                "d_o2_hydrogel_override_cm2_s_supported": True,
                "perfusion_spatial_mode_outer_annulus_masked_supported": True,
                "external_standoff_um_robin_bc_supported": True,
            },
            "note": (
                "Quantifies two coupled physical boundary effects on Design X (exposed as executable parameters "
                "d_o2_hydrogel_override_cm2_s, perfusion_spatial_mode='outer_annulus_masked', and external_standoff_um in "
                "_run_single_pouch_pde_regime; AUDIT-REF): (1) adding an external avascular host-gel "
                "stand-off layer delta_z in {0, 30, 50, 100} um outside z = +/-175 um lowers 120 um cluster-surface pO2 from "
                "18.39 mmHg (0 um) to 14.54 mmHg (30 um), 12.66 mmHg (50 um), and 9.45 mmHg (100 um) under steady-state boundary flux subtraction "
                "(and to 18.18/6.97, 15.15/4.16, 13.75/2.94, and 11.63/1.33 mmHg surface/core under the post-inosculation Day 7-14 Robin-BC PDE); "
                "and (2) restricting host capillary perfusion k_perf(z) strictly to the outer cell-laden hydrogel bands (|z| > 50 um, zeroing vascular sink/supply "
                "inside the central PDMS-CaO2 lamina; min_slab_po2 = 19.27 mmHg uniform cat / 19.18 mmHg localized cat at t = 336 h) yields "
                "14.05 mmHg surface / 3.19 mmHg core pO2 (13.96 / 3.12 mmHg with localized k_1 = 7.56 s^-1) for 120 um (R = 60 um) clusters, "
                "whereas the Design X-b (DX-b) <=100 um (R <= 50 um) and 80 um (R = 40 um) AggreWell cluster-diameter caps restore "
                "masked-perfusion cluster-surface / core pO2 to 15.60 / 7.81 mmHg (15.51 / 7.73 localized cat) and 16.91 / 11.87 mmHg "
                "(16.82 / 11.78 localized cat), clearing the >=15.0 mmHg full first-phase GSIS threshold (AUDIT-REF, "
                "D4-PDE-FV-1, Q3-P3, Q4-P4, AUDIT-REF, & AUDIT-REF)."
            ),
        },
        "d_o2_hydrogel_provenance_and_stage0_time_lag_coupon_gate_sonnet55_r1": {
            "modeled_d_o2_hydrogel_cm2_s": D_O2_HYDROGEL_CM2_S,
            "minimum_model_qualification_floor_d_o2_cm2_s": D_O2_HYDROGEL_CM2_S,
            "high_permeability_target_d_o2_cm2_s": 1.50e-5,
            "modeled_alpha_bunsen_mol_cm3_mmhg": ALPHA_BUNSEN_MOL_CM3_MMHG,
            "coupon_thickness_mm": 1.5,
            "expected_time_lag_at_9p4e_6_cm2_s_seconds": 398.9,
            "expected_time_lag_at_1p5e_5_cm2_s_seconds": 250.0,
            "expected_time_lag_at_1p6e_5_cm2_s_seconds": 234.4,
            "spatial_ph_micro_optode_transect_max_delta_ph": 0.10,
            "bulk_medium_ph_qualification_band": [7.25, 7.45],
            "minimum_model_qualification_permeability_p_o2_mol_cm_s_mmhg": round(ALPHA_BUNSEN_MOL_CM3_MMHG * D_O2_HYDROGEL_CM2_S, 17),
            "high_permeability_target_p_o2_mol_cm_s_mmhg": round(ALPHA_BUNSEN_MOL_CM3_MMHG * 1.50e-5, 17),
            "stage0_gate_p05_diff0": (
                "Stage-0 Gate P05 (DIFF-0): 37 C optical-sensor permeation time-lag (t_lag = L^2 / (6*D_O2)) and steady-state "
                "flux assay across 1.5 mm cell-free hydrogel and composite central-lamina coupons before cell encapsulation, "
                "enforcing a two-tier threshold: (a) Minimum Model-Qualification Floor D_O2,gel >= 9.40e-6 cm^2/s (t_lag <= 398.9 s, "
                "P_O2 = alpha*D >= 1.26e-14 mol/(cm*s*mmHg), matching the conservative Layer-4 PDE baseline constant D_O2_HYDROGEL_CM2_S), "
                "and (b) High-Permeability Engineering Target D_O2,gel >= 1.50e-5 cm^2/s (t_lag <= 250.0 s, P_O2 >= 2.01e-14 mol/(cm*s*mmHg) "
                "at alpha = 1.34e-9 mol/(cm^3*mmHg), or >=1.20e-14 mol/(cm*s*mmHg) under conservative macromolecular salt-out solubility), "
                "paired with 336-h empirical CaO2 release kinetic-law fitting at 36, 72, 168, 240, and 336 h (first-order 96.74% vs reaction "
                "shrinking-core 100.0% at 329.62 h vs diffusion shrinking-core 89.58% at unified t_1/2 = 68.0 h) and spatial "
                "ratiometric pH micro-optode transects across the lamina-hydrogel boundary (Delta pH <= 0.10 across z in [0, L_half], bulk pH 7.25-7.45; "
                "AUDIT-REF, AUDIT-REF, AUDIT-REF, & AUDIT-REF)."
            ),
        },
        "joint_adverse_corner_stress_audit_muse_r1": {
            "description": (
                "Explicit multi-factor adverse corner stress audit combining Bruggeman D_O2,lamina = eps^1.5 * D_O2,gel, "
                "elevated OCR multiplier (1.10x), reduced boundary pO2 (32.5 and 30.0 mmHg), 0.25x catalase activity (k_1 = 1.89 s^-1), "
                "shrinking-core CaO2 kinetics, external avascular host-gel stand-off (delta_z = 30 um), and outer-annulus-masked "
                "host capillary perfusion (k_perf(z) = 0 for |z| <= 50 um)."
            ),
            "r60um_120um_cluster_combined_adverse_corner_status": "FAILS_15MMHG_SURFACE_GSIS_THRESHOLD_UNDER_COMBINED_STRESS",
            "dx_b_r40um_80um_cluster_cap_restores_oxygen_margin": True,
            "dx_b_r40um_80um_cluster_cap_restores_oxygen_margin_at_d_target_1p5e5": True,
            "dx_b_r40um_80um_cluster_cap_restores_oxygen_margin_at_d_floor_9p4e6_two_scale_t16h": False,
            "dx_b_r40um_80um_cluster_cap_restores_margin": True,
            "cat0p25x_peroxide_6p904uM_fails_5uM_and_2p5uM_gates": True,
            "pde_verified_corner_matrix_nz201_argon_r2": {
                "baseline_pb40_cat1x_fo_d_floor_9p4e6": {"min_slab_mmhg": 23.70, "max_h2o2_uM": 2.046, "r60_120um_surf_core_mmhg": [18.39, 7.17], "r50_100um_surf_core_mmhg": [19.99, 12.10], "r40_80um_surf_core_mmhg": [21.31, 16.24]},
                "baseline_pb40_cat1x_fo_d_target_1p5e5": {"min_slab_mmhg": 27.14, "min_slab_uniform_cat18_comparator_mmhg": 27.80, "min_slab_uniform_cat18_current_solver_mmhg": 27.19, "max_h2o2_uM": 2.046, "r60_120um_surf_core_mmhg": [24.08, 12.69], "r50_100um_surf_core_mmhg": [25.01, 17.06], "r40_80um_surf_core_mmhg": [25.77, 20.67]},
                "pb40_cat0p25x_1p89_sc_d_floor_9p4e6": {"min_slab_mmhg": 22.00, "max_h2o2_uM": 6.904, "passes_5uM_h2o2_gate": False, "r60_120um_surf_core_mmhg": [16.71, 5.60], "r50_100um_surf_core_mmhg": [18.30, 10.44], "r40_80um_surf_core_mmhg": [19.62, 14.56]},
                "pb32p5_cat0p25x_1p89_sc_d_floor_9p4e6": {"min_slab_mmhg": 14.76, "max_h2o2_uM": 6.904, "passes_5uM_h2o2_gate": False, "r60_120um_surf_core_mmhg": [9.77, 0.41], "r50_100um_surf_core_mmhg": [11.16, 3.63], "r40_80um_surf_core_mmhg": [12.42, 7.47]},
                "pb32p5_cat0p25x_1p89_sc_d_target_1p5e5": {"min_slab_mmhg": 19.50, "max_h2o2_uM": 6.904, "passes_5uM_h2o2_gate": False, "r60_120um_surf_core_mmhg": [16.49, 5.38], "r50_100um_surf_core_mmhg": [17.39, 9.56], "r40_80um_surf_core_mmhg": [18.15, 13.10]},
                "pb30_cat0p25x_1p89_sc_d_floor_9p4e6": {"min_slab_mmhg": 12.40, "max_h2o2_uM": 6.904, "passes_5uM_h2o2_gate": False, "r60_120um_surf_core_mmhg": [7.68, 0.08], "r50_100um_surf_core_mmhg": [8.88, 1.72], "r40_80um_surf_core_mmhg": [10.09, 5.22]},
                "pb30_cat0p25x_1p89_sc_d_target_1p5e5": {"min_slab_mmhg": 17.04, "max_h2o2_uM": 6.904, "passes_5uM_h2o2_gate": False, "r60_120um_surf_core_mmhg": [14.05, 3.20], "r50_100um_surf_core_mmhg": [14.94, 7.18], "r40_80um_surf_core_mmhg": [15.69, 10.67]},
                "masked_perf_standoff30um_ocr1p10x_pb40_d_floor_9p4e6": {"min_slab_mmhg": 14.12, "max_h2o2_uM": 2.046, "passes_5uM_h2o2_gate": True, "r60_120um_surf_core_mmhg": [8.76, 0.04], "r50_100um_surf_core_mmhg": [10.22, 2.02], "r40_80um_surf_core_mmhg": [11.58, 5.83]},
                "masked_perf_standoff30um_ocr1p10x_pb40_d_target_1p5e5": {"min_slab_mmhg": 18.01, "max_h2o2_uM": 2.045, "passes_5uM_h2o2_gate": True, "r60_120um_surf_core_mmhg": [14.74, 3.10], "r50_100um_surf_core_mmhg": [15.72, 7.25], "r40_80um_surf_core_mmhg": [16.55, 11.09]},
            },
            "two_scale_propagated_and_full_trajectory_hour16_extrema_astra_r2": {
                "masked_perf_standoff30um_ocr1p10x_pb40_d_floor_9p4e6_two_scale_propagated_t16h": {
                    "min_slab_mmhg_at_t16h": 9.21,
                    "min_slab_mmhg_at_t12h_coarse_sample": 14.12,
                    "r60_120um_surf_core_mmhg_at_t16h": [3.89, 0.0005],
                    "r50_100um_surf_core_mmhg_at_t16h": [5.14, 0.24],
                    "r40_80um_surf_core_mmhg_at_t16h": [6.57, 1.79],
                    "r40_80um_surf_core_mmhg_at_t16h_local_phi_1p0x_ocr_bvp": _bvp_gel_surf_core(9.21, 0.0040, local_phi_dx),
                },
                "masked_perf_standoff30um_ocr1p10x_pb40_d_target_1p5e5_two_scale_propagated_t16h": {
                    "min_slab_mmhg_at_t16h": 18.08,
                    "min_slab_mmhg_at_t336h_global_min": 18.08,
                    "min_slab_mmhg_at_t16h_snapshot_exact": 19.54,
                    "r60_120um_surf_core_mmhg_at_t16h": [14.81, 3.17],
                    "r60_120um_surf_core_mmhg_at_t336h_two_scale_propagated": [14.77, 3.17],
                    "r60_120um_surf_core_mmhg_at_t16h_snapshot_two_scale_propagated": [16.21, 4.39],
                    "r50_100um_surf_core_mmhg_at_t16h": [15.80, 7.33],
                    "r50_100um_surf_core_mmhg_at_t336h_two_scale_propagated": [15.75, 7.33],
                    "r50_100um_surf_core_mmhg_at_t16h_snapshot_two_scale_propagated": [17.20, 8.69],
                    "r40_80um_surf_core_mmhg_at_t16h": [16.63, 11.07],
                    "r40_80um_surf_core_mmhg_at_t336h_two_scale_propagated": [16.60, 11.07],
                    "r40_80um_surf_core_mmhg_at_t16h_snapshot_two_scale_propagated": [18.05, 12.50],
                    "r40_80um_surf_core_mmhg_at_t16h_local_phi_1p0x_ocr_bvp": _bvp_gel_surf_core(18.08, 0.0040, local_phi_dx, 1.50e-5),
                    "r40_80um_surf_core_mmhg_at_t16h_snapshot_local_phi_1p0x_ocr_bvp": _bvp_gel_surf_core(19.54, 0.0040, local_phi_dx, 1.50e-5),
                },
                "minimum_retained_catalase_fraction_for_2p5uM_bench_gate_first_order": {
                    "required_fraction_of_7p56_s_inv_design_x_loading": 0.8158,
                    "strict_unrounded_required_fraction_for_le_2p5000uM": 0.8159,
                    "required_effective_k1_s_inv_for_2p5uM_gate": 6.17,
                    "strict_unrounded_required_k1_s_inv_for_le_2p5000uM": 6.1682,
                    "required_fraction_for_5p0uM_model_screen": 0.40,
                    "required_effective_k1_s_inv_for_5p0uM_screen": 3.02,
                },
            },
            "stage0_mitigation_rule": (
                "Under stacked adverse corners (e.g., masked lamina perfusion + delta_z = 30 um stand-off + 1.10x OCR, or P_boundary = 32.5/30.0 mmHg "
                "+ 0.25x catalase + shrinking-core), at the conservative model floor D_O2 = 9.40e-6 cm^2/s, reducing cluster diameter from 120 um "
                "to 80-100 um (DX-b) protects the >=2.0 mmHg anoxic core floor on the 12-h coarse grid (core pO2 = 2.02-5.83 mmHg and 3.63-7.47 mmHg respectively, vs 0.04-0.41 mmHg "
                "at 120 um; whereas on the full 0.25-h trajectory at Hour 16 with 1.10x OCR and D_O2 propagated into the 3D spherical cluster solver, "
                "D_floor = 9.40e-6 cm^2/s reaches 9.21 mmHg slab and 6.57 / 1.79 mmHg at 80 um, requiring D_O2 >= 1.50e-5 cm^2/s where Hour-16 slab is 18.08 mmHg "
                "and 80 um reaches 16.63 / 11.07 mmHg; AUDIT-REF), while qualifying the native-matrix target D_O2 >= 1.50e-5 cm^2/s alongside DX-b (80-100 um at P_b = 32.5 mmHg or 80 um at P_b = 30.0 mmHg, "
                "where 100 um reaches 14.94 mmHg surface and 80 um reaches 15.69 / 10.67 mmHg) restores cluster-surface pO2 >= 15.0 mmHg. "
                "Crucially, in the 0.25x catalase (k_1 = 1.89 s^-1) corners, peak interstitial H2O2 remains 6.904 uM (6.90429 uM at both D_O2 values because "
                "D_H2O2 = 1.40e-5 cm^2/s is fixed), exceeding both the <=2.5 uM Stage-0 bench gate and the <=5.0 uM model screen even when 80 um clusters rescue oxygen; "
                "thus Stage-0 must qualify retained active catalase > 0.40x (> 3.02 s^-1 effective k_1) for the <=5.0 uM model screen and >= 0.8158x (>= 6.17 s^-1 effective k_1) "
                "for the <=2.5 uM Stage-0 bench gate under first-order release alongside D_O2 and cluster size (AUDIT-REF, AUDIT-REF, AUDIT-REF, & AUDIT-REF)."
            ),
            "chronic_zero_source_and_mineralization_extension_muse_r3": {
                "evidence_class": "CHRONIC_POST_CAO2_ZERO_SOURCE_BIOTRANSPORT_AND_MINERALIZATION_AUDIT_REQUIRES_GATE_0F_CHRONIC",
                "primary_citations": ["PMID:25985456"],
                "cao2_exhaustion_day14_to_day90_regime": {
                    "cao2_remaining_at_336h_shrinking_core_mmol": 0.0,
                    "cao2_remaining_at_336h_ginstling_brounshtein_fraction": 0.0252,
                    "total_ca2_released_mmol": 10.9811,
                    "caco3_molar_mass_g_mol": 100.09,
                    "max_theoretical_caco3_mass_g": 1.099,
                    "dense_calcite_volume_at_2p71_g_cm3_cm3": 0.406,
                    "dense_calcite_fraction_of_design_x_0p84cm3_lamina_pore_water": 0.483,
                    "dense_calcite_uniform_film_thickness_over_400cm2_um": 10.1,
                    "porous_50pct_void_caco3_volume_at_1p5_g_cm3_cm3": 0.733,
                    "porous_50pct_void_fraction_of_design_x_0p84cm3_lamina_pore_water": 0.872,
                    "porous_50pct_void_uniform_film_thickness_over_400cm2_um": 18.3,
                },
                "physical_collagen_capsule_standoff_translation_veiseh_2015_pmid_25985456": {
                    "gel_equivalent_delta_z_crit_15mmHg_surface_um": {
                        "120um_cluster": 31.1,
                        "100um_dxb_cluster": 56.0,
                        "80um_dxb_cluster": 86.4,
                    },
                    "physical_collagen_capsule_delta_z_crit_15mmHg_um_by_d_gel_over_d_col": {
                        "ratio_2x": {"120um_cluster": 15.6, "100um_dxb_cluster": 28.0, "80um_dxb_cluster": 43.2},
                        "ratio_3x_central": {"120um_cluster": 10.4, "100um_dxb_cluster": 18.7, "80um_dxb_cluster": 28.8},
                        "ratio_4x_dense_mineralized": {"120um_cluster": 7.8, "100um_dxb_cluster": 14.0, "80um_dxb_cluster": 21.6},
                    },
                },
                "stage0_gate_0f_chronic_pass_criteria": {
                    "coupon_0f_min_30d_bicarbonate_perfusion": "Surface CaCO3 foulant <= 0.15 mg/cm^2 AND < 10% reduction in D_O2,eff across the pouch boundary",
                    "mandatory_high_permeability_hydrogel_d_o2_min_cm2_s": 1.50e-5,
                    "day30_to_day60_fbrc_capsule_thickness_cap_um": {
                        "for_100um_dxb_clusters": 15.0,
                        "for_80um_dxb_clusters": 25.0,
                    },
                    "pivot_rule_S4": "If Coupon 0F-min fails, add slow-release Mg2+/citrate mineralization inhibitor or reduce CaO2 loading to <= 25 wt% paired with 80 um clusters; if capsule > 25 um, pivot to Design Z zero-CaO2 ribbon or pre-vascularized omental bed.",
                },
                "physical_outer_annulus_masked_chronic_zero_source_audit_argon_r4": {
                    "unphysical_uniform_slab_vs_physical_outer_annulus_masked_mechanism": (
                        "The central 100 um lamina (|z| <= 50 um) is a cell-free hydrophobic 46.39 wt% CaO2 / 53.61 wt% PDMS composite into which host capillaries cannot sprout; "
                        "evaluating chronic S_chem = 0 (post-CaO2 exhaustion, Day 21-90+) under uniform_slab falsely turns the central PDMS lamina into an internal vascular O2 source (+4.89 to +5.86 mmHg inflation). "
                        "Under physical outer_annulus_masked at S_chem = 0 and D_O2,floor = 9.40254e-6 cm^2/s, 100 um (DX-b) drops to 14.9218 mmHg (< 15.0 mmHg GSIS gate) even at delta_z = 0 um, "
                        "whereas promoting D_O2,gel >= 1.50e-5 cm^2/s to a mandatory Gate P05 (DIFF-0) + Gate 0F-chronic specification restores 100 um (DX-b) to [21.3510, 13.4437] mmHg at delta_z = 0 um "
                        "and [15.1656, 7.3976] mmHg (>= 15.0 mmHg full first-phase GSIS) even at delta_z = 56.0 um (AUDIT-REF)."
                    ),
                    "outer_annulus_masked_s_chem_0_pb40_d_o2_floor_9p40e_6": {
                        "delta_z_0um": {"min_slab_po2_mmhg": 18.5891, "120um_surf_core_mmhg": [13.3894, 2.6331], "100um_dxb_surf_core_mmhg": [14.9218, 7.1636], "80um_surf_core_mmhg": [16.2314, 11.2016]},
                        "delta_z_15um": {"min_slab_po2_mmhg": 16.4375, "120um_surf_core_mmhg": [11.2784, 1.1965], "100um_dxb_surf_core_mmhg": [12.8204, 5.1640], "80um_surf_core_mmhg": [14.1021, 9.1095]},
                        "delta_z_31p1um": {"min_slab_po2_mmhg": 14.8726, "120um_surf_core_mmhg": [9.7664, 0.4139], "100um_dxb_surf_core_mmhg": [11.3189, 3.7825], "80um_surf_core_mmhg": [12.5673, 7.6143]},
                        "delta_z_56p0um": {"min_slab_po2_mmhg": 12.8858, "120um_surf_core_mmhg": [7.8861, 0.0], "100um_dxb_surf_core_mmhg": [9.3389, 2.0757], "80um_surf_core_mmhg": [10.6401, 5.7647]},
                    },
                    "outer_annulus_masked_s_chem_0_pb40_d_o2_high_1p50e_5": {
                        "delta_z_0um": {"min_slab_po2_mmhg": 23.6716, "120um_surf_core_mmhg": [20.3886, 9.5740], "100um_dxb_surf_core_mmhg": [21.3510, 13.4437], "80um_surf_core_mmhg": [22.1825, 17.0736]},
                        "delta_z_15um": {"min_slab_po2_mmhg": 21.7440, "120um_surf_core_mmhg": [18.4622, 7.6805], "100um_dxb_surf_core_mmhg": [19.4242, 11.5290], "80um_surf_core_mmhg": [20.2554, 15.1510]},
                        "delta_z_56p0um": {"min_slab_po2_mmhg": 17.4660, "120um_surf_core_mmhg": [14.1886, 3.6350], "100um_dxb_surf_core_mmhg": [15.1656, 7.3976], "80um_surf_core_mmhg": [15.9794, 10.9035]},
                    },
                    "omental_boundary_pb_35_and_30_mmhg_sensitivity_at_delta_z_0um": {
                        "pb_35mmHg_d_o2_floor": {"min_slab_po2_mmhg": 13.7330, "100um_dxb_surf_core_mmhg": [10.1486, 2.7521], "80um_surf_core_mmhg": [11.4008, 6.4730]},
                        "pb_35mmHg_d_o2_high_1p50e_5": {"min_slab_po2_mmhg": 18.7042, "100um_dxb_surf_core_mmhg": [16.4375, 8.6345], "80um_surf_core_mmhg": [17.2468, 12.1558]},
                        "pb_30mmHg_d_o2_floor": {"min_slab_po2_mmhg": 8.9834, "100um_dxb_surf_core_mmhg": [5.7510, 0.1945], "80um_surf_core_mmhg": [6.8673, 2.3887]},
                    },
                    "joint_chronic_source_free_areal_loading_capsule_ocr_envelope_sol61_r4": {
                        "governing_capsule_standoff_identity": "delta_z_eq_um = delta_cap_phys_um * (D_gel / D_cap) = 3.0 * delta_cap_phys_um at D_gel / D_cap = 3.0 (D_O2_eff = 1.50e-5 cm2/s)",
                        "single_parameter_vs_joint_margin_stacking_audit": (
                            "At 2,500 IEQ/cm2 (500,000 IEQ across 200 cm2), inputs that pass individually (P_b = 40 mmHg, delta_cap_phys = 14 um [delta_z_eq = 42 um] <= 15 um gate, "
                            "and OCR = 1.096x <= 1.15x gate) jointly reduce 100-um DX-B surface pO2 to 14.0919 mmHg (< 15.0 mmHg full-GSIS threshold) with core pO2 = 5.6540 mmHg; "
                            f"combining P_b = 35 mmHg + delta_cap_phys = 15 um (delta_z_eq = 45 um) + OCR = 1.00-1.097x drops 100-um DX-B surface pO2 to 11.0968-11.2335 mmHg in the legacy uncoupled reference table and strictly monotonically from {_bvp_gel_surf_core_4dec(chr_2500_pb35_ocr1000_dx_k14, 0.0050, local_phi_dx, 1.50e-5, 1.000)[0]:.4f} to {_bvp_gel_surf_core_4dec(chr_2500_pb35_ocr1097_dx_k14, 0.0050, local_phi_dx, 1.50e-5, 1.097)[0]:.4f} mmHg in the live nz=201 BVP (exact nz=201 BVP min_slab = {chr_2500_pb35_ocr1000_dx_k14:.4f} -> {chr_2500_pb35_ocr1097_dx_k14:.4f} mmHg at a = 100/350, k_perf = 0.14 s^-1 [{chr_2500_pb35_ocr1000_a034_k97:.4f} -> {chr_2500_pb35_ocr1097_a034_k97:.4f} mmHg at a = 0.34, k_perf = 0.1358 s^-1], monotonically decreasing across slab, surface, and core as OCR increases from 1.000x to 1.097x; DEC-078) and core pO2 from {_bvp_gel_surf_core_4dec(chr_2500_pb35_ocr1000_dx_k14, 0.0050, local_phi_dx, 1.50e-5, 1.000)[1]:.4f} to {_bvp_gel_surf_core_4dec(chr_2500_pb35_ocr1097_dx_k14, 0.0050, local_phi_dx, 1.50e-5, 1.097)[1]:.4f} mmHg (3.6881 -> 3.5754 mmHg legacy), "
                            "and P_b = 25 mmHg + 100 um gel-eq standoff collapses surface pO2 to 0.9675 mmHg and core pO2 to 0.0012 mmHg at 2,500 IEQ/cm2 (reaching >= 5.0 mmHg core [5.23 mmHg] only if areal loading is derated to <= 675 IEQ/cm2, where surface pO2 remains < 15.0 mmHg; thus P_b = 25 mmHg + 100 um standoff is a strict NO-GO across all practical loadings). "
                            "Derating chronic areal loading to 1,500 IEQ/cm2 (DX-B-LowLoad-1500: 300,000 IEQ per 200 cm2 pouch or 500,000 IEQ across 333.33 cm2 / two 166.67 cm2 pouches) "
                            f"restores P_b = 35 mmHg + 15 um physical capsule (45 um gel-eq) + OCR = 1.097x to 16.7302 mmHg surface pO2 (>= 15.0 mmHg; {chr_1500_pb35_surf_core_phi_dil[0]:.4f} mmHg phi_diluted / {chr_1500_pb35_surf_core_phi_base[0]:.4f} mmHg phi_base in exact nz=201 BVP; {chr_1500_pb35_ocr1097_a034_k97_100um_surf_core[0]:.4f} mmHg under a = 0.34, k_perf = 0.1358 s^-1) and 8.1749 mmHg core pO2 (>= 5.0 mmHg; {chr_1500_pb35_surf_core_phi_dil[1]:.4f} mmHg phi_diluted / {chr_1500_pb35_surf_core_phi_base[1]:.4f} mmHg phi_base; {chr_1500_pb35_ocr1097_a034_k97_100um_surf_core[1]:.4f} mmHg under a = 0.34, k_perf = 0.1358 s^-1) (AUDIT-REF, AUDIT-REF, AUDIT-REF & DEC-078)."
                        ),
                        "scenarios_at_d_o2_1p50e_5_outer_annulus_s_chem_0": {
                            "load_2500_pb40_cap14um_phys_42um_eq_ocr1p096": {
                                "areal_density_ieq_cm2": 2500.0,
                                "p_boundary_mmhg": 40.0,
                                "delta_cap_phys_um": 14.0,
                                "delta_z_eq_um": 42.0,
                                "ocr_multiplier": 1.096,
                                "min_slab_po2_mmhg": 16.5973,
                                "min_slab_po2_exact_nz201_bvp_mmhg": round(_solve_chronic_zero_source_bvp_live(40.0, 42.0, 1.096, a_design_x, 0.14), 4),
                                "100um_dxb_surf_core_mmhg": [14.0919, 5.6540],
                                "100um_dxb_surf_core_exact_nz201_mmhg": _bvp_gel_surf_core_4dec(_solve_chronic_zero_source_bvp_live(40.0, 42.0, 1.096, a_design_x, 0.14), 0.0050, local_phi_dx, 1.50e-5, 1.096),
                                "80um_surf_core_mmhg": [14.9803, 9.4237],
                                "80um_surf_core_exact_nz201_mmhg": _bvp_gel_surf_core_4dec(_solve_chronic_zero_source_bvp_live(40.0, 42.0, 1.096, a_design_x, 0.14), 0.0040, local_phi_dx, 1.50e-5, 1.096),
                                "clears_15mmhg_surface_and_5mmhg_core_for_100um_dxb": False,
                            },
                            "load_2500_pb35_cap15um_phys_45um_eq_ocr1p000": {
                                "areal_density_ieq_cm2": 2500.0,
                                "p_boundary_mmhg": 35.0,
                                "delta_cap_phys_um": 15.0,
                                "delta_z_eq_um": 45.0,
                                "ocr_multiplier": 1.000,
                                "min_slab_po2_mmhg": 13.5050,
                                "min_slab_po2_exact_nz201_bvp_mmhg": chr_2500_pb35_ocr1000_dx_k14,
                                "min_slab_po2_exact_nz201_a034_kperf_0p14_mmhg": chr_2500_pb35_ocr1000_a034_k14,
                                "min_slab_po2_exact_nz201_a034_kperf_0p1358_mmhg": chr_2500_pb35_ocr1000_a034_k97,
                                "100um_dxb_surf_core_mmhg": [11.2335, 3.6881],
                                "100um_dxb_surf_core_exact_nz201_mmhg": _bvp_gel_surf_core_4dec(chr_2500_pb35_ocr1000_dx_k14, 0.0050, local_phi_dx, 1.50e-5, 1.000),
                                "80um_surf_core_mmhg": [12.0365, 7.0398],
                                "80um_surf_core_exact_nz201_mmhg": _bvp_gel_surf_core_4dec(chr_2500_pb35_ocr1000_dx_k14, 0.0040, local_phi_dx, 1.50e-5, 1.000),
                                "clears_15mmhg_surface_and_5mmhg_core_for_100um_dxb": False,
                            },
                            "load_2500_pb35_cap15um_phys_45um_eq_ocr1p097": {
                                "areal_density_ieq_cm2": 2500.0,
                                "p_boundary_mmhg": 35.0,
                                "delta_cap_phys_um": 15.0,
                                "delta_z_eq_um": 45.0,
                                "ocr_multiplier": 1.097,
                                "min_slab_po2_mmhg": 13.5889,
                                "min_slab_po2_exact_nz201_bvp_mmhg": chr_2500_pb35_ocr1097_dx_k14,
                                "min_slab_po2_exact_nz201_a034_kperf_0p14_mmhg": chr_2500_pb35_ocr1097_a034_k14,
                                "min_slab_po2_exact_nz201_a034_kperf_0p1358_mmhg": chr_2500_pb35_ocr1097_a034_k97,
                                "100um_dxb_surf_core_mmhg": [11.0968, 3.5754],
                                "100um_dxb_surf_core_exact_nz201_mmhg": _bvp_gel_surf_core_4dec(chr_2500_pb35_ocr1097_dx_k14, 0.0050, local_phi_dx, 1.50e-5, 1.097),
                                "80um_surf_core_mmhg": [11.9765, 6.9936],
                                "80um_surf_core_exact_nz201_mmhg": _bvp_gel_surf_core_4dec(chr_2500_pb35_ocr1097_dx_k14, 0.0040, local_phi_dx, 1.50e-5, 1.097),
                                "clears_15mmhg_surface_and_5mmhg_core_for_100um_dxb": False,
                            },
                            "load_2500_pb25_standoff100um_eq_ocr1p000": {
                                "areal_density_ieq_cm2": 2500.0,
                                "p_boundary_mmhg": 25.0,
                                "delta_cap_phys_um": 33.33,
                                "delta_z_eq_um": 100.0,
                                "ocr_multiplier": 1.000,
                                "min_slab_po2_mmhg": 2.1380,
                                "min_slab_po2_exact_nz201_bvp_mmhg": chr_2500_pb25_st100_dx_k14,
                                "100um_dxb_surf_core_mmhg": [0.9675, 0.0012],
                                "100um_dxb_surf_core_exact_nz201_mmhg": _bvp_gel_surf_core_4dec(chr_2500_pb25_st100_dx_k14, 0.0050, local_phi_dx, 1.50e-5, 1.000),
                                "80um_surf_core_mmhg": [1.3183, 0.0363],
                                "80um_surf_core_exact_nz201_mmhg": _bvp_gel_surf_core_4dec(chr_2500_pb25_st100_dx_k14, 0.0040, local_phi_dx, 1.50e-5, 1.000),
                                "clears_15mmhg_surface_and_5mmhg_core_for_100um_dxb": False,
                            },
                            "load_1500_dxb_lowload_pb35_cap15um_phys_45um_eq_ocr1p097": {
                                "areal_density_ieq_cm2": 1500.0,
                                "p_boundary_mmhg": 35.0,
                                "delta_cap_phys_um": 15.0,
                                "delta_z_eq_um": 45.0,
                                "ocr_multiplier": 1.097,
                                "min_slab_po2_mmhg": 19.2229,
                                "min_slab_po2_exact_nz201_bvp_mmhg": round(chr_1500_pb35_ocr1097_dx_k14, 4),
                                "100um_dxb_surf_core_mmhg": [16.7302, 8.1749],
                                "100um_dxb_surf_core_exact_nz201_phi_diluted_mmhg": chr_1500_pb35_surf_core_phi_dil,
                                "100um_dxb_surf_core_exact_nz201_phi_base_mmhg": chr_1500_pb35_surf_core_phi_base,
                                "80um_surf_core_mmhg": [17.6140, 12.0110],
                                "clears_15mmhg_surface_and_5mmhg_core_for_100um_dxb": True,
                            },
                        },
                        "live_nz201_monotone_chronic_pde_and_postural_folded_occlusion_kimi31_r4": {
                            "computation_mode": "LIVE_NZ201_NEWTON_BVP_DERIVED_ASTRA6_R4",
                            "strict_ocr_monotonicity_at_2500_pb35_cap15um_nz201": {
                                "ocr_1p000_min_slab_po2_mmhg": chr_2500_pb35_ocr1000_dx_k14,
                                "ocr_1p097_min_slab_po2_mmhg": chr_2500_pb35_ocr1097_dx_k14,
                                "delta_min_slab_po2_ocr_1p097_minus_1p000_mmhg": round(chr_2500_pb35_ocr1097_dx_k14 - chr_2500_pb35_ocr1000_dx_k14, 4),
                                "a034_kperf_0p14_ocr_1p000_to_1p097_min_slab_po2_mmhg": [chr_2500_pb35_ocr1000_a034_k14, chr_2500_pb35_ocr1097_a034_k14],
                                "a034_kperf_0p14_delta_mmhg": round(chr_2500_pb35_ocr1097_a034_k14 - chr_2500_pb35_ocr1000_a034_k14, 4),
                                "a034_kperf_0p1358_vperf0p97_ocr_1p000_to_1p097_min_slab_po2_mmhg": [chr_2500_pb35_ocr1000_a034_k97, chr_2500_pb35_ocr1097_a034_k97],
                                "a034_kperf_0p1358_vperf0p97_delta_mmhg": round(chr_2500_pb35_ocr1097_a034_k97 - chr_2500_pb35_ocr1000_a034_k97, 4),
                                "monotonically_decreasing_in_ocr": bool(chr_2500_pb35_ocr1097_dx_k14 < chr_2500_pb35_ocr1000_dx_k14 and chr_2500_pb35_ocr1097_a034_k97 < chr_2500_pb35_ocr1000_a034_k97),
                                "reconciliation_note": (
                                    f"Computed live at runtime from the exact nz=201 zero-source BVP: increasing OCR from 1.000x to 1.097x strictly decreases min_slab_pO2 "
                                    f"across all geometry/perfusion conventions (a = 100/350, k_perf = 0.14 s^-1: {chr_2500_pb35_ocr1000_dx_k14:.4f} -> {chr_2500_pb35_ocr1097_dx_k14:.4f} mmHg [Delta = {chr_2500_pb35_ocr1097_dx_k14 - chr_2500_pb35_ocr1000_dx_k14:.4f} mmHg]; "
                                    f"a = 0.34, k_perf = 0.14 s^-1: {chr_2500_pb35_ocr1000_a034_k14:.4f} -> {chr_2500_pb35_ocr1097_a034_k14:.4f} mmHg; "
                                    f"a = 0.34, k_perf = 0.14*0.97 = 0.1358 s^-1: {chr_2500_pb35_ocr1000_a034_k97:.4f} -> {chr_2500_pb35_ocr1097_a034_k97:.4f} mmHg [Delta = {chr_2500_pb35_ocr1097_a034_k97 - chr_2500_pb35_ocr1000_a034_k97:.4f} mmHg]), "
                                    f"and at 1,500 IEQ/cm2 min_slab_pO2 = {chr_1500_pb35_ocr1097_dx_k14:.4f} mmHg with 100-um surface/core = {chr_1500_pb35_surf_core_phi_base} mmHg under fixed Wigner-Seitz cell-band packing (phi_base) "
                                    f"vs {chr_1500_pb35_surf_core_phi_dil} mmHg when outer-band volume fraction is diluted by 0.60x (phi_diluted; AUDIT-REF & AUDIT-REF)."
                                ),
                            },
                            "postural_and_folded_pouch_contact_occlusion_sensitivity": {
                                "load_1500_pb32p5_cap15um_ocr1p097_min_slab_po2_mmhg": round(chr_1500_pb32p5_ocr1097_dx_k14, 4),
                                "load_1500_pb32p5_cap15um_ocr1p097_100um_surf_core_phi_base_mmhg": chr_1500_pb32p5_surf_core_phi_base,
                                "load_1500_pb32p5_cap15um_ocr1p097_100um_surf_core_phi_diluted_mmhg": chr_1500_pb32p5_surf_core_phi_dil,
                                "load_1500_pb32p5_cap15um_ocr1p097_80um_surf_core_phi_diluted_rescue_mmhg": chr_1500_pb32p5_80um_surf_core_phi_dil,
                                "load_1500_pb30p0_cap15um_ocr1p097_min_slab_po2_mmhg": round(chr_1500_pb30p0_ocr1097_dx_k14, 4),
                                "load_1500_pb30p0_cap15um_ocr1p097_100um_surf_core_phi_base_mmhg": chr_1500_pb30p0_surf_core_phi_base,
                                "load_1500_pb30p0_cap15um_ocr1p097_100um_surf_core_phi_diluted_mmhg": chr_1500_pb30p0_surf_core_phi_dil,
                                "load_1500_pb35p0_cap15um_stimulated_ocr1p50x_min_slab_po2_mmhg": round(chr_1500_pb35_ocr1500_dx_k14, 4),
                                "load_1500_pb35p0_cap15um_stimulated_ocr1p50x_100um_surf_core_phi_diluted_mmhg": chr_1500_pb35_ocr1500_surf_core_phi_dil,
                                "load_1500_pb35p0_cap15um_stimulated_ocr1p50x_80um_surf_core_phi_diluted_rescue_mmhg": chr_1500_pb35_ocr1500_80um_surf_core_phi_dil,
                                "load_1500_pb35p0_cap15um_ocr1p097_a034_kperf_0p1358_100um_surf_core_mmhg": chr_1500_pb35_ocr1097_a034_k97_100um_surf_core,
                                "load_1500_pb35p0_cap15um_stimulated_ocr1p50x_a034_kperf_0p1358_80um_surf_core_mmhg": chr_1500_pb35_ocr1500_a034_k97_80um_surf_core,
                                "load_1500_pb35p0_cap15um_stimulated_ocr1p50x_a034_kperf_0p1358_75um_surf_core_rescue_mmhg": chr_1500_pb35_ocr1500_a034_k97_75um_surf_core,
                                "pb25_standoff100_areal_density_sweep_sonnet55_r4": (
                                    lambda _sc_2500, _sc_1500, _sc_1000, _sc_675: {
                                        "computation_mode": "LIVE_NZ201_NEWTON_BVP_AND_SPHERICAL_CLUSTER_DERIVED",
                                        "sigma_2500_ieq_cm2": {
                                            "min_slab_po2_mmhg": chr_2500_pb25_st100_dx_k14,
                                            "100um_dxb_surf_core_mmhg": _sc_2500,
                                            "clears_15mmhg_surface_and_5mmhg_core": bool(_sc_2500[0] >= 15.0 and _sc_2500[1] >= 5.0),
                                        },
                                        "sigma_1500_ieq_cm2": {
                                            "min_slab_po2_mmhg": round(chr_pb25_st100_1500_dx_k14, 4),
                                            "100um_dxb_surf_core_mmhg": _sc_1500,
                                            "clears_15mmhg_surface_and_5mmhg_core": bool(_sc_1500[0] >= 15.0 and _sc_1500[1] >= 5.0),
                                        },
                                        "sigma_1000_ieq_cm2": {
                                            "min_slab_po2_mmhg": round(chr_pb25_st100_1000_dx_k14, 4),
                                            "100um_dxb_surf_core_mmhg": _sc_1000,
                                            "clears_15mmhg_surface_and_5mmhg_core": bool(_sc_1000[0] >= 15.0 and _sc_1000[1] >= 5.0),
                                        },
                                        "sigma_675_ieq_cm2": {
                                            "min_slab_po2_mmhg": round(chr_pb25_st100_675_dx_k14, 4),
                                            "100um_dxb_surf_core_mmhg": _sc_675,
                                            "clears_15mmhg_surface_and_5mmhg_core": bool(_sc_675[0] >= 15.0 and _sc_675[1] >= 5.0),
                                        },
                                        "reconciliation_note": (
                                            f"Reconciles DEC-037 Domain-4 prose ('5.23 mmHg core at P_b = 25 mmHg, delta_shell = 100 um'): live nz=201 BVP gives {_sc_675[1]:.4f} mmHg core pO2 ({_sc_675[0]:.4f} mmHg surface) only when areal loading is derated to ~675 IEQ/cm2 (0.27x of 2,500 IEQ/cm2; 5.23 mmHg was a coarse-grid estimate), "
                                            f"and even at 675 IEQ/cm2 surface pO2 is {_sc_675[0]:.4f} < 15.0 mmHg; at 2,500 IEQ/cm2 (core {_sc_2500[1]:.4f} mmHg in steady nz=201 BVP; 0.0012 mmHg in 336-h PDE) and 1,500 IEQ/cm2 (core {_sc_1500[1]:.4f} mmHg), P_b = 25 mmHg + 100 um gel-equivalent standoff is a strict NO-GO (AUDIT-REF & AUDIT-REF)."
                                        ),
                                    }
                                )(
                                    _bvp_gel_surf_core_4dec(chr_2500_pb25_st100_dx_k14, 0.0050, local_phi_dx, 1.50e-5, 1.0),
                                    _bvp_gel_surf_core_4dec(chr_pb25_st100_1500_dx_k14, 0.0050, local_phi_dx * 0.60, 1.50e-5, 1.0),
                                    _bvp_gel_surf_core_4dec(chr_pb25_st100_1000_dx_k14, 0.0050, local_phi_dx * 0.40, 1.50e-5, 1.0),
                                    _bvp_gel_surf_core_4dec(chr_pb25_st100_675_dx_k14, 0.0050, local_phi_dx * 0.27, 1.50e-5, 1.0),
                                ),
                                "dxb_lowload_1500_333cm2_full_336h_transient_pde_chain_sonnet55_r4": {
                                    "areal_density_ieq_cm2": 1500.0,
                                    "cell_intrinsic_ocr_multiplier": 1.0,
                                    "local_outer_band_phi_islet_diluted_0p60x": round(dx_lowload_1500_336h["spatial_control_volume_ledger"]["local_islet_volume_fraction_for_unit_cell"], 7),
                                    "total_ieq_dose": 500000,
                                    "total_pouch_exchange_area_cm2": 333.33,
                                    "active_slab_volume_333cm2_cm3": round(333.3333 * 0.035, 4),
                                    "min_interstitial_po2_mmhg_336h": dx_lowload_1500_336h["min_slab_po2_across_14_days_mmhg"],
                                    "min_120um_cluster_core_po2_mmhg_336h": dx_lowload_1500_336h["min_120um_cluster_core_po2_mmhg"],
                                    "wigner_seitz_gel_only_120um_surface_and_core_po2_mmhg": [
                                        dx_lowload_1500_336h["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_surface_po2_mmhg"],
                                        dx_lowload_1500_336h["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_mmhg"],
                                    ],
                                    "wigner_seitz_gel_only_100um_dxb_surface_and_core_po2_mmhg": [
                                        dx_lowload_1500_336h["wigner_seitz_100um_dxb_cluster_pericellular_shell_audit_dec064"]["two_zone_fv_gel_only_supply_surface_po2_mmhg"],
                                        dx_lowload_1500_336h["wigner_seitz_100um_dxb_cluster_pericellular_shell_audit_dec064"]["two_zone_fv_gel_only_supply_100um_core_po2_mmhg"],
                                    ],
                                    "wigner_seitz_gel_only_80um_surface_and_core_po2_mmhg": [
                                        dx_lowload_1500_336h["wigner_seitz_80um_cluster_pericellular_shell_audit_dec064"]["two_zone_fv_gel_only_supply_surface_po2_mmhg"],
                                        dx_lowload_1500_336h["wigner_seitz_80um_cluster_pericellular_shell_audit_dec064"]["two_zone_fv_gel_only_supply_80um_core_po2_mmhg"],
                                    ],
                                    "hour_336_viable_fraction": dx_lowload_1500_336h["coupled_dynamic_14d_viable_endocrine_fraction_v80_066"],
                                    "max_interstitial_h2o2_uM_336h": dx_lowload_1500_336h["max_interstitial_h2o2_uM"],
                                    "passes_all_biotransport_gates": dx_lowload_1500_336h["passes_all_oxygen_peroxide_and_ph_gates"],
                                    "qualification_scope": "ACUTE_NOMINAL_336H_HEADROOM_ONLY_CHRONIC_DAY90_RESTS_ON_MASKED_BVP",
                                    "transient_seroma_density_vs_ocr_separation_note_sol61_r8": (
                                        "Separates areal loading density derating (sigma_loading = 1,500 IEQ/cm2 -> local_phi_islet = 0.1060288) from intrinsic cellular OCR "
                                        "(cell_intrinsic_ocr_multiplier = 1.0x at V_max = 3.4e-8 mol cm^-3 s^-1): under transient 336-h masked outer-annulus perfusion and aged hydrogel "
                                        "(D_O2 = 1.5e-5 cm^2/s), a 50-um seroma film at P_b = 30 mmHg (ext_standoff = 50*1.5/1.584 = 47.3485 um, min_slab = 17.1145 mmHg) yields [12.2064, 1.7149] mmHg at 120 um (core < 2.0 mmHg FAIL), "
                                        "[13.6373, 5.9338] mmHg at 100 um (core >= 2.0 mmHg PASS, surface < 15.0 mmHg GSIS), and [14.8707, 9.8618] mmHg at 80 um, whereas an 80-um seroma film at "
                                        "P_b = 35 mmHg (ext_standoff = 80*1.5/1.584 = 75.7576 um, min_slab = 18.4708 mmHg [18.470753 mmHg exact]; 17.9225 mmHg [17.922458 mmHg exact] at direct 80.0 um gel-equivalent standoff) "
                                        "yields [14.9767, 7.2140] mmHg at 100 um (< 15.0 mmHg at min_slab = 18.4708 mmHg; [14.4348, 6.6939] mmHg at 17.9225 mmHg) and [16.2198, 11.1907] mmHg at 80 um "
                                        "(>= 15.0 mmHg surface GSIS at min_slab = 18.4708 mmHg; [15.6743, 10.6528] mmHg at 17.9225 mmHg; R8-F01; DEC-064, DEC-065 & DEC-067)."
                                    ),
                                },
                                "chronic_lowload_1500_surgical_pouch_exchange_area_table": {
                                    "reduced_dose_360k_total_ieq_at_1500_ieq_cm2_area_cm2": round(360000.0 / 1500.0, 2),
                                    "standard_dose_500k_total_ieq_at_1500_ieq_cm2_area_cm2": round(500000.0 / 1500.0, 2),
                                    "full_beta_eq_833333_total_ieq_at_1500_ieq_cm2_area_cm2": round(833333.3333 / 1500.0, 2),
                                    "two_pouch_split_at_500k_total_ieq_area_per_pouch_cm2": round(500000.0 / (2.0 * 1500.0), 2),
                                    "three_pouch_split_at_833k_total_ieq_area_per_pouch_cm2": round(833333.3333 / (3.0 * 1500.0), 2),
                                },
                                "one_sided_folded_contact_occlusion_2x_half_thickness_passive_capacity_islet_only_ieq_cm2": round(verify_exact_slab_source_distribution_algebra()["passive_capacity_islet_only_ieq_per_cm2"] / 4.0, 2),
                                "one_sided_folded_contact_occlusion_2x_half_thickness_with_15pct_stroma_ieq_cm2": round(verify_exact_slab_source_distribution_algebra()["passive_capacity_with_15pct_iec_stroma_ieq_per_cm2"] / 4.0, 2),
                                "acute_cluster_core_coupled_viability_ode_note": (
                                    f"Under 1,500 IEQ/cm2 low-load packing at P_b = 32.5 mmHg + 15 um capsule + 1.097x OCR (min_slab = {chr_1500_pb32p5_ocr1097_dx_k14:.4f} mmHg), "
                                    f"100-um surface/core is {chr_1500_pb32p5_surf_core_phi_base} mmHg under fixed Wigner-Seitz packing (phi_base >= 15.0 mmHg) vs {chr_1500_pb32p5_surf_core_phi_dil} mmHg under 0.60x outer-band dilution (phi_diluted, where 80-um clusters restore core pO2 to {chr_1500_pb32p5_80um_surf_core_phi_dil[1]:.4f} mmHg); "
                                    f"under acute 1.50x glucose-stimulated OCR at P_b = 35.0 mmHg (min_slab = {chr_1500_pb35_ocr1500_dx_k14:.4f} mmHg), 100-um phi_diluted surface/core drops to {chr_1500_pb35_ocr1500_surf_core_phi_dil} mmHg whereas 80-um clusters maintain {chr_1500_pb35_ocr1500_80um_surf_core_phi_dil} mmHg (core >= 5.0 mmHg). "
                                    "Because the 1-D slab viability ODE dV/dt uses interstitial pO2(z,t) whereas intra-cluster core pO2 is lower by the Wigner-Seitz + Ginstling-Brounshtein drop, Stage-2 organ-on-chip qualification gates 3D confocal live/dead + cleaved-Caspase-3 "
                                    "directly inside the central 50-um core of 100-um and 120-um spheroids rather than relying solely on slab-averaged viability; furthermore, omental implantation uses a fenestrated 4-point suture-tacked frame to prevent pouch self-folding (which would double effective diffusion half-thickness L and divide passive capacity by 4x to 299.6 / 260.5 IEQ/cm2; AUDIT-REF & AUDIT-REF)."
                                ),
                            },
                        },
                        "live_chronic_bvp_sensitivity_and_area_scaling_audit_astra6_r4": {
                            "alias_of": "live_nz201_monotone_chronic_pde_and_postural_folded_occlusion_kimi31_r4",
                            "computation_mode": "LIVE_NZ201_NEWTON_BVP_DERIVED_ASTRA6_R4",
                            "load_1500_pb35_cap15um_ocr1p097_a_design_x_kperf_0p14_100um_surf_core_phi_diluted_mmhg": chr_1500_pb35_surf_core_phi_dil,
                            "load_1500_pb35_cap15um_ocr1p097_a_design_x_kperf_0p14_100um_surf_core_phi_base_mmhg": chr_1500_pb35_surf_core_phi_base,
                            "load_1500_pb35_cap15um_ocr1p097_a034_kperf_0p1358_100um_surf_core_phi_diluted_mmhg": chr_1500_pb35_ocr1097_a034_k97_100um_surf_core,
                            "standard_dose_500k_total_ieq_at_1500_ieq_cm2_area_cm2": 333.33,
                            "two_pouch_split_at_500k_total_ieq_area_per_pouch_cm2": 166.67,
                        },
                        "chronic_fibrotic_capsule_thickness_sweep_50_to_100um_sol61_r5": (
                            lambda: {
                                "computation_mode": "LIVE_NZ201_NEWTON_BVP_AND_SPHERICAL_CLUSTER_DERIVED_SOL61_R5",
                                "parameters": {
                                    "areal_loading_ieq_cm2": 1500.0,
                                    "p_boundary_mmhg": 35.0,
                                    "ocr_multiplier": 1.097,
                                    "d_o2_gel_cm2_s": 1.50e-5,
                                    "d_gel_over_d_capsule_ratio": 3.0,
                                    "lamina_half_width_fraction_a": CENTRAL_LAMINA_HALF_WIDTH_FRACTION,
                                    "k_perf_vascularized_outer_band_s_inv": round(0.14 * 0.97, 4),
                                },
                                "capsule_thickness_sweep_kperf_0p1358_s_inv": {
                                    f"d_cap_{int(d_cap)}um_eq_{int(3*d_cap)}um": (
                                        lambda _p_slab: {
                                            "d_cap_phys_um": float(d_cap),
                                            "delta_z_eq_um": float(3.0 * d_cap),
                                            "min_slab_po2_mmhg": round(_p_slab, 4),
                                            "100um_dxb_surf_core_mmhg": _bvp_gel_surf_core_4dec(_p_slab, 0.0050, local_phi_dx * 0.60, 1.50e-5, 1.097),
                                            "80um_dxb_surf_core_mmhg": _bvp_gel_surf_core_4dec(_p_slab, 0.0040, local_phi_dx * 0.60, 1.50e-5, 1.097),
                                        }
                                    )(_solve_chronic_zero_source_bvp_live(35.0, 3.0 * d_cap, 0.60 * 1.097, CENTRAL_LAMINA_HALF_WIDTH_FRACTION, 0.14 * 0.97))
                                    for d_cap in (15, 20, 30, 50, 75, 100)
                                },
                                "avascular_capsule_vascular_dropout_kperf_0_at_d_cap_50um": (
                                    lambda _p_slab_k0: {
                                        "d_cap_phys_um": 50.0,
                                        "delta_z_eq_um": 150.0,
                                        "k_perf_s_inv": 0.0,
                                        "min_slab_po2_mmhg": round(_p_slab_k0, 4),
                                        "100um_dxb_surf_core_mmhg": _bvp_gel_surf_core_4dec(_p_slab_k0, 0.0050, local_phi_dx * 0.60, 1.50e-5, 1.097),
                                        "100um_dxb_core_unrounded_mmhg": round(float(solve_spherical_cluster_po2_bvp(_p_slab_k0, 0.0050, phi_islet_in_slab=local_phi_dx * 0.60, d_hydrogel_override=1.50e-5, ocr_multiplier=1.097)["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"]), 6),
                                        "80um_dxb_surf_core_mmhg": _bvp_gel_surf_core_4dec(_p_slab_k0, 0.0040, local_phi_dx * 0.60, 1.50e-5, 1.097),
                                        "80um_dxb_core_unrounded_mmhg": round(float(solve_spherical_cluster_po2_bvp(_p_slab_k0, 0.0040, phi_islet_in_slab=local_phi_dx * 0.60, d_hydrogel_override=1.50e-5, ocr_multiplier=1.097)["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"]), 6),
                                    }
                                )(_solve_chronic_zero_source_bvp_live(35.0, 150.0, 0.60 * 1.097, CENTRAL_LAMINA_HALF_WIDTH_FRACTION, 0.0)),
                                "surface_gsis_15mmhg_max_capsule_um_100um_cluster": 20.0,
                                "surface_gsis_15mmhg_max_capsule_um_80um_cluster": 30.0,
                                "core_viability_5mmhg_max_capsule_um_100um_cluster": 30.0,
                                "core_viability_5mmhg_max_capsule_um_80um_cluster": 100.0,
                                "reconciliation_note": (
                                    "Live BVP verification across physical fibrotic capsule thickness d_cap in {15, 20, 30, 50, 75, 100} um (delta_z_eq = 3*d_cap) "
                                    "at 1,500 IEQ/cm2, P_b = 35 mmHg, OCR = 1.097x, D_gel = 1.50e-5 cm2/s, slab lamina half-width fraction a_slab = 0.34 (with cluster packing fraction local_phi_dx * 0.60 = 0.1489 derived from Design-X 100-um central lamina; whereas pure uniform a = 0.34 packing phi = 0.1251 yields 12.4959 / 4.1680 mmHg at d_cap = 50 um), k_perf = 0.1358 s^-1: "
                                    "at d_cap = 15 um, 100-um clusters achieve 16.5172 / 7.9650 mmHg (PASS 15/5 mmHg); at d_cap = 50 um, 100-um clusters drop to "
                                    "12.2729 / 3.9653 mmHg (failing both 15 mmHg surface GSIS and 5 mmHg core viability) while 80-um clusters preserve core viability at "
                                    "13.6039 / 8.1437 mmHg (core >= 5.0 mmHg up to d_cap = 100 um [11.1594 / 5.7785 mmHg], though full surface GSIS >= 15.0 mmHg requires "
                                    "d_cap <= 20 um for 100-um clusters or d_cap <= 30 um for 80-um clusters); and if outer-band capillary perfusion drops out (k_perf = 0) "
                                    "under a 50 um capsule, min_slab_pO2 collapses to 0.0783 mmHg (100-um cluster core 8.65e-6 mmHg, 80-um cluster core 7.50e-5 mmHg; AUDIT-REF, AUDIT-REF & AUDIT-REF)."
                                ),
                            }
                        )(),
                    },
                    "phase_resolved_cao2_to_caco3_net_solid_expansion_audit_sol61_r4": (
                        lambda _n_cao2_mmol, _v_cao2_cm3, _m_caco3_g: {
                            "primary_citations": ["PMID:38343991", "PMID:22371586"],
                            "cao2_initial_mass_g": 0.7915,
                            "cao2_molar_mass_g_mol": 72.078,
                            "cao2_molar_amount_mmol": round(_n_cao2_mmol, 2),
                            "cao2_molar_amount_exact_mmol": round(_n_cao2_mmol, 6),
                            "cao2_crystal_density_g_cm3": 2.91,
                            "cao2_initial_solid_volume_cm3": round(_v_cao2_cm3, 4),
                            "caco3_molar_mass_g_mol": 100.0869,
                            "caco3_complete_carbonation_mass_g": round(_m_caco3_g, 3),
                            "caco3_complete_carbonation_mass_exact_g": round(_m_caco3_g, 6),
                            "caco3_calcite_density_g_cm3": 2.71,
                            "caco3_complete_carbonation_solid_volume_cm3": round(_m_caco3_g / 2.71, 4),
                            "net_solid_volume_expansion_cao2_to_caco3_cm3": round((_m_caco3_g / 2.71) - _v_cao2_cm3, 4),
                            "design_x_lamina_pore_water_volume_cm3": 0.8400,
                            "net_solid_expansion_fraction_of_pore_water_if_external_pore_nucleation": round(((_m_caco3_g / 2.71) - _v_cao2_cm3) / 0.8400, 4),
                            "amorphous_acc_and_porous_mineral_phase_branches_kimi31_r4": {
                                "calcite_2p71_g_cm3": {
                                    "solid_volume_cm3": round(_m_caco3_g / 2.71, 4),
                                    "net_expansion_vs_cao2_cm3": round((_m_caco3_g / 2.71) - _v_cao2_cm3, 4),
                                    "net_expansion_fraction_of_0p84cm3_pore_water": round(((_m_caco3_g / 2.71) - _v_cao2_cm3) / 0.8400, 4),
                                    "gross_volume_fraction_of_0p84cm3_pore_water_if_zero_pdms_intrusion": round((_m_caco3_g / 2.71) / 0.8400, 4),
                                },
                                "hydrated_amorphous_calcium_carbonate_acc_1p75_g_cm3_pmid_38343991": {
                                    "solid_volume_cm3": round(_m_caco3_g / 1.75, 4),
                                    "net_expansion_vs_cao2_cm3": round((_m_caco3_g / 1.75) - _v_cao2_cm3, 4),
                                    "net_expansion_fraction_of_0p84cm3_pore_water": round(((_m_caco3_g / 1.75) - _v_cao2_cm3) / 0.8400, 4),
                                    "gross_volume_fraction_of_0p84cm3_pore_water_if_zero_pdms_intrusion": round((_m_caco3_g / 1.75) / 0.8400, 4),
                                },
                                "low_density_porous_caco3_precipitate_1p50_g_cm3": {
                                    "solid_volume_cm3": round(_m_caco3_g / 1.50, 4),
                                    "net_expansion_vs_cao2_cm3": round((_m_caco3_g / 1.50) - _v_cao2_cm3, 4),
                                    "net_expansion_fraction_of_0p84cm3_pore_water": round(((_m_caco3_g / 1.50) - _v_cao2_cm3) / 0.8400, 4),
                                    "gross_volume_fraction_of_0p84cm3_pore_water_if_zero_pdms_intrusion": round((_m_caco3_g / 1.50) / 0.8400, 4),
                                },
                            },
                            "pdms_intrusion_vs_hydrogel_pore_precipitation_partition": (
                                f"Although 0.7915 g CaO2 ({_v_cao2_cm3:.4f} cm3 at 2.91 g/cm3) vacates intrabead volume as it reacts, complete conversion of {_n_cao2_mmol:.2f} mmol ({_n_cao2_mmol:.6f} mmol exact) Ca2+ to {_m_caco3_g:.3f} g ({_m_caco3_g:.6f} g exact) CaCO3 "
                                f"produces {(_m_caco3_g / 2.71):.4f} cm3 of crystalline calcite (2.71 g/cm3; net expansion +{( _m_caco3_g / 2.71 - _v_cao2_cm3):.4f} cm3 = +49.1% relative to initial CaO2 volume, or 15.90% of the 0.8400 cm3 hydrogel pore water if nucleated in situ vs 48.28% if Ca2+ leaches into the hydrogel without water intrusion into hydrophobic PDMS voids) "
                                f"or {(_m_caco3_g / 1.75):.4f}-{(_m_caco3_g / 1.50):.4f} cm3 if precipitated as hydrated amorphous calcium carbonate (ACC, 1.50-1.75 g/cm3; net expansion +{( _m_caco3_g / 1.75 - _v_cao2_cm3):.4f} to +{( _m_caco3_g / 1.50 - _v_cao2_cm3):.4f} cm3 = 42.39-54.85% net / 74.77-87.23% gross of pore water; Tomioka et al. 2024 PMID:38343991). "
                                "Gate 0D-alkali therefore measures day-14 micro-CT mineral volume fraction, Raman/FTIR polymorph phase (ACC vs vaterite vs calcite), ICP-MS residual Ca, and 10-70 kDa FITC-dextran effective diffusivity across spent composite coupons (requiring <= 15% permeability loss; AUDIT-REF & AUDIT-REF)."
                            ),
                        }
                    )(0.7915 / 72.078 * 1000.0, 0.7915 / 2.91, (0.7915 / 72.078) * 100.0869),
                },
            },
        },
        "design_z_radical_zero_cao2_microvascular_pfc_ribbon_wildcard_spec_dec020": {
            "tournament_slot": "Z (Tier-2 Radical Biophysical/Vascular Wildcard competing to dethrone X; DEC-020)",
            "cao2_mass_mg": 0.0,
            "chemical_h2o2_generation_uM": 0.0,
            "calcium_hydroxide_alkali_generation_mmol": 0.0,
            "ribbon_half_thickness_um": 60.0,
            "total_pleated_ribbon_thickness_um": 120.0,
            "cluster_diameter_cap_um": 80.0,
            "passive_oxygen_shuttle": "10% v/v perfluorooctyl bromide (PFOB) phospholipid-stabilized nanoemulsion (phi_PFC = 0.10, K_p = alpha_PFC/alpha_aq = 20.0, zero chemical reaction)",
            "effective_medium_transport_parameterization_muse_r1": {
                "pfc_volume_fraction_phi": 0.10,
                "partition_coefficient_kp_pfc_to_aq": 20.0,
                "effective_bunsen_solubility_ratio_alpha_eff_over_alpha_aq": round(1.0 + 0.10 * (20.0 - 1.0), 4),
                "effective_oxygen_permeability_multiplier_p_eff_over_p_aq": 2.50,
                "legacy_parallel_rule_of_mixtures_upper_bound_p_eff_over_p_aq": 2.50,
                "steady_state_fickian_permeability_multiplier_p_eff_over_p_aq_at_r20": round((20.0 + 2.0 + 2.0 * 0.10 * 19.0) / (20.0 + 2.0 - 0.10 * 19.0), 4),
                "maxwell_garnett_impermeable_sphere_limit_p_eff_over_p_aq_6_over_7": round(6.0 / 7.0, 6),
                "maxwell_garnett_equal_diffusivity_r20_p_eff_over_p_aq": round((20.0 + 2.0 + 2.0 * 0.10 * 19.0) / (20.0 + 2.0 - 0.10 * 19.0), 6),
                "maxwell_garnett_infinite_droplet_permeability_upper_bound_p_eff_over_p_aq_4_over_3": round((1.0 + 2.0 * 0.10) / (1.0 - 0.10), 6),
                "apparent_concentration_diffusivity_ratio_d_app_over_d_aq_at_r20": round(
                    ((20.0 + 2.0 + 2.0 * 0.10 * 19.0) / (20.0 + 2.0 - 0.10 * 19.0)) / 2.90, 6
                ),
                "zero_supply_equilibrium_o2_storage_buffer_time_seconds_at_25_and_40_mmhg": [6.75, 10.80],
                "governing_partial_pressure_pde": "alpha_eff * dp/dt = div(P_eff * grad(p)) - q_cells(p) + s_vascular(p)",
                "governing_robin_boundary_condition": "-P_eff * (dp/dz)|_{z=+/-60um} = h_host * (p(L_half, t) - p_host(t))",
                "axial_microvascular_advection_graetz_verification_argon_r2": {
                    "assumed_vessel_length_cm": 1.0,
                    "assumed_lumen_diameter_um": 25.0,
                    "assumed_mean_axial_velocity_cm_s": 0.25,
                    "assumed_radial_o2_diffusivity_in_blood_cm2_s": 2.0e-5,
                    "axial_peclet_number_pe_axial": 12500.0,
                    "graetz_number_gz": 51.3,
                    "single_pass_driving_head_extraction_pct": 11.24,
                    "single_pass_total_inlet_40mmhg_extraction_pct": 7.15,
                    "arteriolar_inlet_po2_mmhg": 40.00,
                    "venular_outlet_po2_mmhg": 37.14,
                },
                "stage0_kill_coupons_z01_to_z04": [
                    "Z-01: Permeation time-lag and equilibrium solubility coupon verifying steady-state partial-pressure permeability P_eff / P_aq in [1.20x, 1.33x] (1.2836x at D_PFC = D_aq, bounded above by (1+2*phi)/(1-phi) = 1.3333x for disconnected spheres at phi = 0.10; AUDIT-REF), equilibrium storage alpha_eff / alpha_aq = 2.90x (apparent t_lag ~ 2.26x blank gel via D_app / D_aq = 0.4426), and dynamic droplet stability (DLS Z-average <= 220 nm, <10% Ostwald ripening over 14 days at 37 C)",
                    "Z-02: 72-h hypoxic microfluidic chamber challenge (pO2_ext = 25 mmHg, 0 mg CaO2) requiring 80 um micro-islet core pO2 >= 5.0 mmHg, viability >= 90%, and SI >= 2.5",
                    "Z-03: THP-1 / primary human macrophage + complement (C3a/C5a) innate reactogenicity screen on PFOB-hydrogel coupons requiring IL-1beta/TNF-alpha <= 1.5x blank hydrogel",
                    "Z-04: Microfluidic fibrin/hydrogel angiogenesis chip verifying iEC + pericyte cord lumenization and perfusable anastomosis within t_50 <= 24-36 h",
                ],
            },
            "vascular_inosculation_target_t50_hours": 24.0,
            "scientific_rationale": (
                "Radical zero-CaO2 biophysical wildcard (Design Z) that eliminates solid peroxide hydrolysis, catalase washout/inactivation "
                "dependence, and 5.71 mmol Ca(OH)2 mineral/alkali export by combining a pleated <=120 um pre-vascularized microvascular "
                "ribbon (L_half = 60 um <= passive Krogh limit) with 80 um micro-islet spheroids, 10% v/v PFOB passive oxygen-shuttle "
                "nanoemulsion (in partial-pressure coordinates with continuous p, equilibrium storage is alpha_eff/alpha_aq = 1 + phi*(K_p - 1) = 2.90x, "
                "while steady-state Maxwell-Garnett partial-pressure permeability is P_eff/P_aq = [r+2+2*phi*(r-1)]/[r+2-phi*(r-1)] with r = K_p*D_PFC/D_aq, "
                "yielding 6/7 = 0.8571x for impermeable spheres r->0, 1.2836x at D_PFC = D_aq [r = 20], and bounded above by (1+2*phi)/(1-phi) = 4/3 = 1.3333x as r->inf, "
                "with apparent concentration diffusivity D_app/D_aq = (P_eff/P_aq)/(alpha_eff/alpha_aq) = 0.4426 and ~6.75-10.80 s zero-supply storage buffer; AUDIT-REF), "
                "and pre-inosculated iEC/iPericyte cords (L = 1.0 cm, d = 25 um, u = 0.25 cm/s -> Pe_axial = 12,500, Gz = 51.3, "
                "11.24% single-pass driving-head extraction, 37.14 mmHg outlet pO2; DEC-020, AUDIT-REF, AUDIT-REF, & AUDIT-REF)."
            ),
        },
        "coupled_pde_regimes_for_metabolic_ode": [dx_fo_201, dx_sc_201, dx_fo_201_loc_cat, dx_gb_201],
    }
    bruggeman_torture_test["design_x_100um_lamina_eps_0p42_46p39wtpct_cao2"] = design_x_100um_lamina_qualification

    # Dynamically compute Hour-0 Newton BVP spatial and dose Catalase controls via _solve_peroxide_slab_bvp on both nz=51 and nz=201 (AUDIT-REF, AUDIT-REF, & AUDIT-REF):
    geom_ctrl_51 = _slab_control_volume_profiles(51, 0.0175, lamina_half_width_fraction=CENTRAL_LAMINA_HALF_WIDTH_FRACTION)
    dz_ctrl_51 = float(geom_ctrl_51["z"][1] - geom_ctrl_51["z"][0])
    s_h2o2_0_ctrl = (2.0 * (r_o2_0_dx / 7.00) * 1e9 * geom_ctrl_51["central_source"])[1:-1]
    mask_int_51 = geom_ctrl_51["central_mask"][1:-1]
    k_perf_0_ctrl = 0.14 * 0.01
    h0_uniform_18 = float(np.max(_solve_peroxide_slab_bvp(s_h2o2_0_ctrl, dz_ctrl_51, 18.0, k_perf_0_ctrl, km_uM=25000.0)["concentration_uM"]))
    h0_masked_18 = float(np.max(_solve_peroxide_slab_bvp(s_h2o2_0_ctrl, dz_ctrl_51, 18.0 * mask_int_51, k_perf_0_ctrl, km_uM=25000.0)["concentration_uM"]))
    k1_lamina_pore_dose = 18.0 * (0.41745 / 2.3800)
    h0_masked_pore_dose = float(np.max(_solve_peroxide_slab_bvp(s_h2o2_0_ctrl, dz_ctrl_51, k1_lamina_pore_dose * mask_int_51, k_perf_0_ctrl, km_uM=25000.0)["concentration_uM"]))
    k1_uniform_7cm3_dose = 18.0 * (0.41745 / 7.0000)
    h0_uniform_7cm3_dose = float(np.max(_solve_peroxide_slab_bvp(s_h2o2_0_ctrl, dz_ctrl_51, k1_uniform_7cm3_dose, k_perf_0_ctrl, km_uM=25000.0)["concentration_uM"]))
    h0_uncatalyzed = float(np.max(_solve_peroxide_slab_bvp(s_h2o2_0_ctrl, dz_ctrl_51, 0.008, k_perf_0_ctrl, km_uM=None)["concentration_uM"]))

    geom_ctrl_201_std = _slab_control_volume_profiles(201, 0.0175, lamina_half_width_fraction=CENTRAL_LAMINA_HALF_WIDTH_FRACTION)
    dz_ctrl_201_std = float(geom_ctrl_201_std["z"][1] - geom_ctrl_201_std["z"][0])
    s_h2o2_0_ctrl_201 = (2.0 * (r_o2_0_dx / 7.00) * 1e9 * geom_ctrl_201_std["central_source"])[1:-1]
    mask_int_201_std = geom_ctrl_201_std["central_mask"][1:-1]
    h0_uniform_18_201 = float(np.max(_solve_peroxide_slab_bvp(s_h2o2_0_ctrl_201, dz_ctrl_201_std, 18.0, k_perf_0_ctrl, km_uM=25000.0)["concentration_uM"]))
    h0_masked_18_201 = float(np.max(_solve_peroxide_slab_bvp(s_h2o2_0_ctrl_201, dz_ctrl_201_std, 18.0 * mask_int_201_std, k_perf_0_ctrl, km_uM=25000.0)["concentration_uM"]))
    h0_masked_pore_dose_201 = float(np.max(_solve_peroxide_slab_bvp(s_h2o2_0_ctrl_201, dz_ctrl_201_std, k1_lamina_pore_dose * mask_int_201_std, k_perf_0_ctrl, km_uM=25000.0)["concentration_uM"]))
    h0_uniform_7cm3_dose_201 = float(np.max(_solve_peroxide_slab_bvp(s_h2o2_0_ctrl_201, dz_ctrl_201_std, k1_uniform_7cm3_dose, k_perf_0_ctrl, km_uM=25000.0)["concentration_uM"]))
    h0_uncatalyzed_201 = float(np.max(_solve_peroxide_slab_bvp(s_h2o2_0_ctrl_201, dz_ctrl_201_std, 0.008, k_perf_0_ctrl, km_uM=None)["concentration_uM"]))

    geom_ctrl_dx_51 = _slab_control_volume_profiles(51, 0.0175, lamina_half_width_fraction=a_design_x)
    s_h2o2_0_dx_ctrl_51 = (2.0 * (r_o2_0_dx / 7.00) * 1e9 * geom_ctrl_dx_51["central_source"])[1:-1]
    mask_int_dx_51 = geom_ctrl_dx_51["central_mask"][1:-1]
    k1_dx_lamina_pore_dose = 18.0 * 0.42
    h0_dx_masked_22680_iu_51 = float(np.max(_solve_peroxide_slab_bvp(s_h2o2_0_dx_ctrl_51, dz_ctrl_51, k1_dx_lamina_pore_dose * mask_int_dx_51, k_perf_0_ctrl, km_uM=25000.0)["concentration_uM"]))

    geom_ctrl_dx_201 = _slab_control_volume_profiles(201, 0.0175, lamina_half_width_fraction=a_design_x)
    dz_ctrl_201 = float(geom_ctrl_dx_201["z"][1] - geom_ctrl_dx_201["z"][0])
    s_h2o2_0_dx_ctrl = (2.0 * (r_o2_0_dx / 7.00) * 1e9 * geom_ctrl_dx_201["central_source"])[1:-1]
    mask_int_dx_201 = geom_ctrl_dx_201["central_mask"][1:-1]
    h0_dx_masked_22680_iu = float(np.max(_solve_peroxide_slab_bvp(s_h2o2_0_dx_ctrl, dz_ctrl_201, k1_dx_lamina_pore_dose * mask_int_dx_201, k_perf_0_ctrl, km_uM=25000.0)["concentration_uM"]))
    k1_dx_22680_diluted_in_2p38cm3 = 18.0 * (0.8400 / 2.3800)
    h0_dx_22680_diluted_119um_mask_201 = float(np.max(_solve_peroxide_slab_bvp(s_h2o2_0_dx_ctrl, dz_ctrl_201, k1_dx_22680_diluted_in_2p38cm3 * mask_int_201_std, k_perf_0_ctrl, km_uM=25000.0)["concentration_uM"]))
    h0_dx_k6p3529_100um_mask_19059_iu_201 = float(np.max(_solve_peroxide_slab_bvp(s_h2o2_0_dx_ctrl, dz_ctrl_201, k1_dx_22680_diluted_in_2p38cm3 * mask_int_dx_201, k_perf_0_ctrl, km_uM=25000.0)["concentration_uM"]))
    h0_layout_b_source_and_119um_mask_22680_iu_201 = float(np.max(_solve_peroxide_slab_bvp(s_h2o2_0_ctrl_201, dz_ctrl_201_std, k1_dx_22680_diluted_in_2p38cm3 * mask_int_201_std, k_perf_0_ctrl, km_uM=25000.0)["concentration_uM"]))

    catalase_multi_denominator_iu_ledger = {
        "local_aqueous_target_k1_s_inv": 18.0,
        "michaelis_constant_km_uM": 25000.0,
        "local_aqueous_vmax_M_s_inv": 0.45,
        "local_aqueous_activity_iu_per_ml_pore_water": 27000.0,
        "active_cao2_mass_mg": round(m_cao2_mg_dx, 2),
        "composite_pdms_cao2_bead_mass_layout_b_31p25wtpct_mg": 2532.77,
        "composite_pdms_cao2_bead_mass_layout_a_25p00wtpct_mg": 3165.96,
        "composite_pdms_cao2_bead_mass_design_x_46p39wtpct_mg": round(m_comp_mg_dx, 2),
        "denominators": {
            "lamina_aqueous_pore_volume_layout_b_0p41745_cm3": {
                "volume_cm3": 0.41745,
                "total_pouch_catalase_iu": 11271.2,
                "iu_per_mg_active_cao2": 14.24,
                "iu_per_mg_composite_bead_layout_b": 4.45,
                "iu_per_mg_composite_bead_layout_a": 3.56,
            },
            "lamina_aqueous_pore_volume_design_x_0p8400_cm3": {
                "volume_cm3": 0.8400,
                "total_pouch_catalase_iu": 22680.0,
                "iu_per_mg_active_cao2": 28.65,
                "iu_per_mg_composite_bead_design_x": 13.29,
            },
            "full_central_lamina_envelope_2p3800_cm3": {
                "volume_cm3": 2.3800,
                "total_pouch_catalase_iu": 64260.0,
                "iu_per_mg_active_cao2": 81.19,
                "iu_per_mg_composite_bead_layout_b": 25.37,
                "iu_per_mg_composite_bead_layout_a": 20.30,
            },
            "total_pouch_hydrated_hydrogel_pore_volume_4p0213_cm3": {
                "volume_cm3": 4.0213,
                "total_pouch_catalase_iu": 108575.1,
                "iu_per_mg_active_cao2": 137.18,
                "iu_per_mg_composite_bead_layout_b": 42.87,
                "iu_per_mg_composite_bead_layout_a": 34.29,
            },
            "full_7p00_cm3_pouch_bulk_slab_envelope": {
                "volume_cm3": 7.0000,
                "total_pouch_catalase_iu": 189000.0,
                "iu_per_mg_active_cao2": 238.79,
                "iu_per_mg_composite_bead_layout_b": 74.62,
                "iu_per_mg_composite_bead_layout_a": 59.70,
            },
        },
        "spatial_enzyme_localization_and_saturation_equivalence_audit": {
            "ledger_interpretation": (
                "The 5 denominator rows above convert the local saturating capacity V_max = k_1 * K_m = 18.0 s^-1 * 25,000 uM = "
                "0.45 M/s = 27,000 IU/mL across 5 candidate physical reference volumes. In the baseline PDE solver, "
                "catalytic_rate_s_inv = 18.0 s^-1 is applied uniformly across interior nodes (corresponding to the 189,000 IU bulk-slab "
                "or 64,260 IU central-lamina envelope if interpreted as a bulk-volume rate)."
            ),
            "hour0_newton_bvp_spatial_and_dose_controls_uM": {
                "uniform_slab_k1_18p0_s_inv_189000_iu_bulk": round(h0_uniform_18, 4),
                "central_lamina_masked_k1_18p0_s_inv_64260_iu_lamina": round(h0_masked_18, 4),
                "central_lamina_masked_k1_3p1572_s_inv_11271_iu_pore_water_dose": round(h0_masked_pore_dose, 4),
                "uniform_slab_k1_1p0734_s_inv_11271_iu_spread_over_7cm3": round(h0_uniform_7cm3_dose, 4),
                "design_x_100um_lamina_masked_k1_7p5600_s_inv_22680_iu_pore_water_dose_hour0_nz51": round(h0_dx_masked_22680_iu_51, 4),
                "design_x_100um_lamina_masked_k1_7p5600_s_inv_22680_iu_pore_water_dose_hour0_nz201": round(h0_dx_masked_22680_iu, 4),
                "design_x_100um_lamina_masked_k1_7p5600_s_inv_22680_iu_336h_pde_nz201_max": dx_fo_201_loc_cat["max_interstitial_h2o2_uM"],
                "uncatalyzed_spontaneous_k_0p008_s_inv": round(h0_uncatalyzed, 4),
                "nz201_fine_grid_controls_uM": {
                    "uniform_slab_k1_18p0_s_inv_189000_iu_bulk_nz201": round(h0_uniform_18_201, 4),
                    "central_lamina_masked_k1_18p0_s_inv_64260_iu_lamina_nz201": round(h0_masked_18_201, 4),
                    "central_lamina_masked_k1_3p1572_s_inv_11271_iu_pore_water_dose_nz201": round(h0_masked_pore_dose_201, 4),
                    "uniform_slab_k1_1p0734_s_inv_11271_iu_spread_over_7cm3_nz201": round(h0_uniform_7cm3_dose_201, 4),
                    "design_x_100um_lamina_masked_k1_7p5600_s_inv_22680_iu_pore_water_dose_hour0_nz201": round(h0_dx_masked_22680_iu, 4),
                    "design_x_100um_source_119um_mask_k1_6p3529_s_inv_22680_iu_diluted_hour0_nz201": round(h0_dx_22680_diluted_119um_mask_201, 4),
                    "design_x_100um_source_100um_mask_k1_6p3529_s_inv_19059_iu_hour0_nz201": round(h0_dx_k6p3529_100um_mask_19059_iu_201, 4),
                    "layout_b_119um_source_119um_mask_k1_6p3529_s_inv_22680_iu_hour0_nz201": round(h0_layout_b_source_and_119um_mask_22680_iu_201, 4),
                    "uncatalyzed_spontaneous_k_0p008_s_inv_nz201": round(h0_uncatalyzed_201, 4),
                },
            },
            "gate_qualification_note": (
                "Restricting k_1 = 18.0 s^-1 strictly to the central CaO2 lamina (64,260 IU) gives peak Hour-0 H2O2 = 0.7256 uM at both nz=51 and nz=201 "
                "(vs 0.7248 uM at nz=51 / 0.7249 uM at nz=201 uniform), co-localizing the 11,271.2 IU Layout-B pore-water dose inside the 2.38 cm3 central lamina "
                "(bulk-averaged k_1 = 3.1572 s^-1 * mask) gives 4.0599 uM at nz=51 (4.0607 uM at nz=201), and co-localizing the 22,680.0 IU Design-X pore-water dose "
                f"inside the 2.00 cm3 100-um central lamina (bulk-averaged k_1 = 7.5600 s^-1 * mask) gives 2.0458 uM at Hour-0 (nz=51; {h0_dx_masked_22680_iu:.4f} uM at nz=201; "
                f"or {h0_dx_22680_diluted_119um_mask_201:.4f} uM at nz=201 if 22,680.0 IU is diluted across the 2.38 cm3 119-um Layout-B enzyme mask at k_1 = 18.0 * (0.84/2.38) = 6.3529 s^-1 with 100-um source, "
                f"{h0_layout_b_source_and_119um_mask_22680_iu_201:.4f} uM when both source and enzyme span the 119-um Layout-B mask, and {h0_dx_k6p3529_100um_mask_19059_iu_201:.4f} uM at k_1 = 6.3529 s^-1 on the 100-um mask [19,058.8 IU]) "
                "and 2.046 uM peak across the 336-h PDE trajectory (nz=201 with t_1/2 = 168 h [9.43%/day exponential enzyme decay, retaining 25.0% activity at 336 h]), all clearing both the <=5.0 uM "
                "conservative screen and the <10.0 uM cytotoxic threshold, whereas spreading 11,271.2 IU uniformly across the entire "
                "7.00 cm3 slab (k_1 = 1.0734 s^-1) gives 9.8210 uM at nz=51 (9.8158 uM at nz=201; clearing <10.0 uM but exceeding <=5.0 uM). Therefore, immobilized "
                "Catalase must be co-localized on/within the central PDMS-CaO2 lamina beads (79,149-158,298 U input loading at "
                "100-200 U/mg CaO2; AUDIT-REF, AUDIT-REF, & AUDIT-REF)."
            ),
        },
    }

    return {
        "solver_method": (
            "51-node 1D Finite-Difference Newton-Raphson BVP (pO2, H2O2, OH-) + 200-cell conservative two-zone spherical radial "
            "Finite-Volume (FV) Wigner-Seitz BVP coupled to 4th-order Runge-Kutta (RK4, dt=0.25h) over t in [0, 336 h]"
        ),
        "intra_cluster_radial_drop_R60um_mmhg": bvp_r60_ref["zero_order_krogh_drop_mmhg"],
        "intra_cluster_radial_drop_R150um_mmhg": bvp_r150_ref["zero_order_krogh_drop_mmhg"],
        "regimes_simulated": results,
        "lead_regime_4_scenario_sensitivity_table_sol_v80_12": sensitivity_table,
        "bruggeman_heterogeneous_lamina_diffusivity_torture_test_v80_041": bruggeman_torture_test,
        "design_x_100um_lamina_transport_qualification_v80_018": design_x_100um_lamina_qualification,
        "catalase_multi_denominator_iu_ledger_v80_093": catalase_multi_denominator_iu_ledger,
        "spatial_grid_convergence_51_101_201_401_preastra_a094": grid_convergence,
        "vascular_perfusion_conductance_sensitivity_v80_014": perfusion_sensitivity,
        "joint_vascular_timing_and_exchange_sensitivity_iip_0002": joint_vascular_iip_0002,
        "formulation_specific_cao2_half_life_sensitivity_iip_0010": formulation_cao2_sensitivity_iip_0010,
        "post_bridge_endocrine_function_and_recovery_protocol_iip_0004": {
            "iip_id": "IIP-0004",
            "decision_id": "DEC-082",
            "title": "Measure endocrine function after the modelled oxygen bridge and during recovery",
            "type": "Missing evidence",
            "affects_tests": ["1", "4", "5"],
            "affects_designs": ["A", "B", "X"],
            "playbook_cross_reference": "docs/STAGE-0-EXECUTION-PLAYBOOK.md (Readout 2 bounded 336-hour history-and-recovery characterisation)",
            "primary_motivation_citation": "Wang et al. 2025 PMID:40404627 (PMC12098657; motivates testing survivor endocrine function after hypoxia without treating incubator set-points as pericellular measurements)",
            "assembled_device_loading_citation": "Chendke et al. 2023 PMID:37476069",
            "scope_and_gate_preservation": "Bounded history-and-recovery characterisation beside Readout 2; keeps the present product, existing gates, and numerical release rules unchanged, and does not relabel the 336-hour bridge as S6's day-14-to-90 chronic supply gate.",
            "protocol_clauses": {
                "1_test_defended_history": "Reproduce the selected exact-product lead's modelled 336-hour pericellular oxygen trajectory (e.g., from joint_vascular_timing_and_exchange_sensitivity_iip_0002), archive its time series, compare against contemporaneous age- and handling-matched controls, state whether peroxide and pH excursions (lines 1551-1554) are reproduced, record achieved exposure, cluster-size distribution, viable-cell recovery and OCR, distinguish measured surrounding oxygen from inferred core exposure, and include the parental comparator where available.",
                "2_independent_sibling_aliquots": "Randomise size-stratified siblings within differentiation block to baseline, 72-hour anchor, end-of-exposure, and recovery readouts (including earliest technically valid point, 48 hours, and 7 days), log actual reoxygenation-to-assay delay, predeclare and log recovery-incubation oxygen separately from brief assay oxygen, assay at Readout 2's 40 mmHg boundary-matched condition as primary, and run the conditional 100 mmHg comparison on additional sibling aliquots where diffusion limitation could contribute without waiving existing Readout 2 qualification under both oxygen conditions.",
                "3_visible_outputs_and_denominators": "Retain raw hormone traces and absolute low/high insulin or C-peptide output, basal leak, first-phase response, stimulation index, shut-off t50 and t90 derived from the same step-down trace with distinct definitions, low-glucose glucagon, and identity/processing readouts; report total allocated endocrine cells, starting beta/alpha counts, surviving endocrine cells, and surviving lineage/marker-positive counts separately, with whole-preparation and originally-allocated-input denominators primary for dose accounting.",
                "4_model_coupling_scope": "Report history/control ratios, uncertainty, and absolute outputs separately for insulin stimulation, basal secretion, glucagon response, and timing; do not multiply original-input recovery into viable fraction v (which already counts cell loss); note that v scales insulin, stimulated glucagon (alpha_gain also multiplies v), and—unless preserved—local paracrine terms while glucagon basal is separate, so v * S_insulin + alpha_gain * S_glucagon is not an independent two-hormone correction.",
                "5_predeclared_confirmation_design": "Treat a small paired pilot (e.g., 3 independent differentiation blocks = 2 residual degrees of freedom for a paired block-level contrast) as establishing feasibility and rough variability rather than equivalence; plan confirmation using a predeclared margin and conservative paired variability bound without reusing existing SI or 72-hour identity-retention thresholds as day-14 absolute-output non-inferiority margins.",
            },
            "paired_completion_clauses": {
                "supplied_area_and_assembled_device_qualification": "Report nominal tissue-bearing area (200 cm^2 at 2,500 IEQ/cm^2; 333.33 cm^2 at S6 low-load 1,500 IEQ/cm^2 for 500,000 IEQ) and oxygen-supported area separately under one conserved supply-and-demand budget, retaining demand from all loaded tissue including uncredited regions, using S6's >= 15 mmHg surface and >= 5 mmHg core criteria for chronic S6, binding vascular access to the loaded and closed state (Chendke et al. 2023 PMID:37476069), and comparing any folded/corrugated capacity advantage against a matched separated reference at equal product, dose, and total supply.",
                "treatment_state_applicability": "Record each functional-dose result as graft-only simulation, externally maintained clamp, or insulin-supported treatment state (including tested dose, site, lag, and concurrent treatment inputs), and do not use a graft-only trajectory to certify a treatment state it does not represent.",
                "implantation_state_oxygen_release_material": "Bind coupon-derived kinetic parameters, empirical hydrolysis half-life t_1/2, kinetic-law code (Gate_P05_kinetics), CaO2 crystal PSD, composite microbead diameter distribution, catalase surface immobilization state, remaining releasable inventory, peroxide/pH state, and material geometry to the exact CaO2:PDMS formulation (25 wt%, 31.25 wt% [13.86 vol%], or 46.39 wt% [23.45 vol%]; never inherited across wt% recipes per IIP-0010 / DEC-088) as implanted after storage, wetting, loading, and handling; replay preimplant history or initialise its measured residual state once (for the reaction-controlled shrinking-core law, a 68.0 h initial half-life after 24.0 h gives residual stock 0.797084 and residual half-life 63.0488 h, not 44 h, and crossing its 10 h branch requires ~281.145 h).",
            },
        },
        "shrinking_core_coupled_bvp_safety_comparison_ultracode_v80_09": {
            "calibration_note": (
                f"First-order and shrinking-core laws share {results[2]['cao2_initial_molar_inventory_mmol']:.3f} mmol "
                f"({results[2]['cao2_initial_mass_mg_in_7cm3_slab']:.1f} mg) initial CaO2 and matched "
                f"{results[2]['cao2_hydrolysis_half_life_hours']:.1f} h half-time. These are conditional chemistry/transport predictions. "
                + "; ".join(
                    f"{fo['scenario_id']}: first-order min slab {fo['min_slab_po2_mmhg']:.2f} mmHg at {fo['time_of_min_slab_po2_hours']:.0f} h, "
                    f"Dirichlet upper-bound core {fo['min_120um_cluster_core_po2_mmhg']:.2f}, uniform core {fo['two_zone_fv_uniform_supply_core_po2_mmhg']:.2f}, "
                    f"gel-only core {fo['two_zone_fv_gel_only_supply_core_po2_mmhg']:.2f}; shrinking-core min slab "
                    f"{sc['min_slab_po2_across_14_days_mmhg']:.2f} mmHg at {sc['time_of_min_slab_po2_hours']:.0f} h, "
                    f"Dirichlet upper-bound core {sc['min_120um_cluster_core_po2_mmhg']:.2f}, uniform core "
                    f"{sc['wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001']['two_zone_fv_uniform_supply_120um_core_po2_mmhg']:.2f}, "
                    f"gel-only core {sc['wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001']['two_zone_fv_gel_only_supply_120um_core_po2_mmhg']:.2f} mmHg"
                    for fo, sc in zip(sensitivity_table, shrinking_core_coupled_regimes)
                )
            ),
            "coupled_shrinking_core_regimes": shrinking_core_coupled_regimes,
        },
    }


def _trajectory_half_drop_time(times: np.ndarray, secretion: np.ndarray, start_min: float, end_min: float) -> float | None:
    """Elapsed half-drop time in the actual simulated intervention window; no drop is unavailable."""
    x = np.asarray(times)
    y = np.asarray(secretion)
    if (x.ndim != 1 or y.shape != x.shape or len(x) < 2
            or not all(np.issubdtype(a.dtype, np.integer) or np.issubdtype(a.dtype, np.floating) for a in (x, y))
            or not np.all(np.isfinite(x)) or not np.all(np.isfinite(y))
            or np.any(np.diff(x) <= 0) or np.any(y < 0)
            or not all(isinstance(v, (int, float)) and not isinstance(v, bool) and math.isfinite(v) for v in (start_min, end_min))
            or start_min >= end_min or x[0] > start_min or x[-1] < end_min):
        raise ValueError("half-drop metric requires finite ordered times, nonnegative secretion and a covered intervention window")
    selected = (x > start_min) & (x < end_min)
    tx = np.r_[start_min, x[selected], end_min]
    sy = np.interp(tx, x, y)
    initial, nadir = float(sy[0]), float(np.min(sy))
    if initial - nadir <= max(1e-12, abs(initial) * 1e-12):
        return None
    target = nadir + 0.5 * (initial - nadir)
    for k in range(1, len(tx)):
        if sy[k] <= target:
            fraction = (float(sy[k-1]) - target) / (float(sy[k-1]) - float(sy[k]))
            return float(tx[k-1] + fraction * (tx[k] - tx[k-1]) - start_min)
    return None


def evaluate_measured_washout_trace_completeness_bpr15(
    times_min: List[float],
    remaining_fraction: List[float],
    *,
    mass_recovery_fraction: Optional[float] = None,
    required_tail_bound_fraction: float = 0.10,
    min_observation_window_min: float = 15.0,
) -> Dict[str, Any]:
    """
    Validate whether a measured whole-device insulin washout trace sufficiently bounds the
    late washout tail before extrapolating an exercise glucose verdict (BPR-15 / DEC-133).
    A trace ending before the late fraction is bounded leaves extrapolation unresolved.
    """
    if len(times_min) < 2 or len(times_min) != len(remaining_fraction):
        return {
            "status": "EXTRAPOLATION_UNRESOLVED_INVALID_TRACE",
            "tail_bounded": False,
            "reason": "Need matching time and remaining_fraction sequences of length >= 2.",
        }
    t_arr = [float(x) for x in times_min]
    s_arr = [float(x) for x in remaining_fraction]
    if any(t_arr[i + 1] <= t_arr[i] for i in range(len(t_arr) - 1)):
        return {
            "status": "EXTRAPOLATION_UNRESOLVED_NON_MONOTONIC_TIME",
            "tail_bounded": False,
            "reason": "Washout timestamps must be strictly increasing.",
        }
    obs_window = t_arr[-1] - t_arr[0]
    end_remaining = s_arr[-1]
    reasons: List[str] = []
    if obs_window < min_observation_window_min:
        reasons.append(f"observation_window_min={obs_window:.3f} < {min_observation_window_min:.1f}")
    if end_remaining > required_tail_bound_fraction:
        reasons.append(
            f"remaining_fraction_at_end={end_remaining:.4f} > {required_tail_bound_fraction:.2f} (late tail unbounded)"
        )
    if mass_recovery_fraction is None or not math.isfinite(float(mass_recovery_fraction)) or not (0.80 <= float(mass_recovery_fraction) <= 1.20):
        reasons.append(f"mass_recovery_fraction={mass_recovery_fraction!r} missing or outside [0.80, 1.20]")
    if reasons:
        return {
            "status": "EXTRAPOLATION_UNRESOLVED_INSUFFICIENT_TAIL_WINDOW",
            "tail_bounded": False,
            "observation_window_min": round(obs_window, 6),
            "remaining_fraction_at_end": round(end_remaining, 6),
            "mass_recovery_fraction": mass_recovery_fraction,
            "reasons": reasons,
        }
    return {
        "status": "TAIL_WINDOW_BOUNDED_FOR_SHAPE_EVALUATION",
        "tail_bounded": True,
        "observation_window_min": round(obs_window, 6),
        "remaining_fraction_at_end": round(end_remaining, 6),
        "mass_recovery_fraction": float(mass_recovery_fraction),
        "reasons": [],
    }


def evaluate_whole_device_washout_gate_dec134(
    times_min: List[float],
    remaining_fraction: List[float],
    *,
    mass_recovery_fraction: Optional[float] = None,
    t50_max_min: float = 4.50,
    mean_transit_max_min: float = 5.50,
    t90_max_min: float = 11.0,
) -> Dict[str, Any]:
    """
    DEC-134 locked Stage-0 whole-device insulin perifusion washout tail gate (BPR-15).

    Requires a complete washout trace (window >= 15.0 min, end remaining <= 0.10, mass recovery
    in [0.80, 1.20]) AND simultaneous clearance of t50 <= 4.50 min, mean transit <= 5.50 min,
    and t90 <= 11.0 min (separating passing >3.50 mM controls from heavy-tail <3.50 mM shapes).
    """
    comp = evaluate_measured_washout_trace_completeness_bpr15(
        times_min,
        remaining_fraction,
        mass_recovery_fraction=mass_recovery_fraction,
        required_tail_bound_fraction=0.10,
        min_observation_window_min=15.0,
    )
    if not comp.get("tail_bounded"):
        return {
            "decision_id": "DEC-134",
            "verdict": "HOLD_DEC134_INCOMPLETE_WASHOUT_TRACE",
            "passes_gate": False,
            "trace_completeness": comp,
            "t50_min": None,
            "mean_transit_min": None,
            "t90_min": None,
            "failures": list(comp.get("reasons", [])),
        }

    t_arr = [float(x) for x in times_min]
    s_arr = [float(x) for x in remaining_fraction]
    # Shift to t0 = 0 for elapsed washout quantiles & trapezoidal survival integral E[T] = int_0^inf S(t) dt
    t0 = t_arr[0]
    dt_arr = [t - t0 for t in t_arr]

    def _interp_crossing(target_s: float) -> Optional[float]:
        if s_arr[0] <= target_s:
            return 0.0
        for i in range(len(s_arr) - 1):
            s0_i, s1_i = s_arr[i], s_arr[i + 1]
            if s0_i >= target_s >= s1_i and s0_i > s1_i:
                frac = (s0_i - target_s) / (s0_i - s1_i)
                return dt_arr[i] + frac * (dt_arr[i + 1] - dt_arr[i])
        return None

    t50 = _interp_crossing(0.50)
    t90 = _interp_crossing(0.10)
    mean_tr = 0.0
    for i in range(len(dt_arr) - 1):
        mean_tr += 0.5 * (s_arr[i] + s_arr[i + 1]) * (dt_arr[i + 1] - dt_arr[i])
    # Conservative residual tail integral if s_end > 0 using local log-slope over last positive segment
    if s_arr[-1] > 1e-9 and s_arr[-2] > s_arr[-1]:
        k_tail = math.log(s_arr[-2] / s_arr[-1]) / (dt_arr[-1] - dt_arr[-2])
        if k_tail > 0.0:
            mean_tr += s_arr[-1] / k_tail

    failures: List[str] = []
    if t50 is None or t50 > t50_max_min:
        failures.append(f"t50_min={t50!r} > {t50_max_min:.2f}")
    if mean_tr > mean_transit_max_min:
        failures.append(f"mean_transit_min={mean_tr:.4f} > {mean_transit_max_min:.2f}")
    if t90 is None or t90 > t90_max_min:
        failures.append(f"t90_min={t90!r} > {t90_max_min:.2f}")

    passes = len(failures) == 0
    return {
        "decision_id": "DEC-134",
        "verdict": "PASS_DEC134_WASHOUT_TAIL_GATE" if passes else "FAIL_DEC134_WASHOUT_TAIL_EXCEEDED",
        "passes_gate": passes,
        "thresholds": {
            "t50_max_min": t50_max_min,
            "mean_transit_max_min": mean_transit_max_min,
            "t90_max_min": t90_max_min,
            "end_remaining_max": 0.10,
            "min_window_min": 15.0,
        },
        "t50_min": round(t50, 6) if t50 is not None else None,
        "mean_transit_min": round(mean_tr, 6),
        "t90_min": round(t90, 6) if t90 is not None else None,
        "trace_completeness": comp,
        "failures": failures,
    }


def evaluate_device_insulin_transit_shape_sensitivity_bpr15(
    *,
    t_pub_min: float = 5.17,
    viable_endocrine_fraction: float = 0.60,
    dt_max: float = 0.25,
) -> Dict[str, Any]:
    """
    Evaluate identifiability of Layer-4 exercise glucose nadirs across unit-gain device
    insulin transfer curves sharing the IDENTICAL step-down half-time t_50 = 4.338527 min
    (BPR-15 / DEC-133).

    Demonstrates:
      - Published 2 equal serial stages (T=5.17 min, t90=10.055 min, S(15)=2.05%): clears 3.50 mM.
      - 1 exponential passage (identical t50, t90=14.412 min, S(15)=9.10%): reverses verdict (< 3.50 mM).
      - 2 parallel passages 80%/20% (identical t50, t90=19.173 min, S(15)=14.01%): reverses verdict (< 3.50 mM).
      - Mean (5.17 min) + median (4.338527 min) + unit-gain matched positive controls clear >= 3.50 mM.
    All half-time screens are explicitly labeled conditional on the assumed transfer curve shape.
    """
    tau_pub = 0.5 * t_pub_min

    def _erlang_survival(t_val: float, k_stages: int, tau_stage: float) -> float:
        x = t_val / tau_stage
        acc = 0.0
        term = 1.0
        for j in range(k_stages):
            if j > 0:
                term *= x / j
            acc += term
        return acc * math.exp(-x)

    def _mixture_survival(t_val: float, branches: List[Tuple[float, int, float]]) -> float:
        return sum(w * _erlang_survival(t_val, k, tau) for w, k, tau in branches)

    def _solve_quantile(branches: List[Tuple[float, int, float]], target_s: float) -> float:
        lo, hi = 0.0, 1.0
        while _mixture_survival(hi, branches) > target_s:
            hi *= 2.0
        for _ in range(90):
            mid = 0.5 * (lo + hi)
            if _mixture_survival(mid, branches) > target_s:
                lo = mid
            else:
                hi = mid
        return 0.5 * (lo + hi)

    pub_branches = [(1.0, 2, tau_pub)]
    t50_target = _solve_quantile(pub_branches, 0.5)

    # Counterexample 1: single exponential matching exact t50
    one_exp_branches = [(1.0, 1, t50_target / math.log(2.0))]

    # Counterexample 2: two parallel exponentials (80% fast, 20% slow) matching exact t50
    tau_slow_par = 5.0 * t50_target
    tau_fast_par = -t50_target / math.log((0.5 - 0.2 * math.exp(-t50_target / tau_slow_par)) / 0.8)
    two_par_branches = [(0.8, 1, tau_fast_par), (0.2, 1, tau_slow_par)]

    # Mean + median + unit-gain matched positive controls: w*Erlang(k, tau_e) + (1-w)*Exp(tau_x)
    def _solve_mean_median_control(w_e: float, k_e: int) -> List[Tuple[float, int, float]]:
        def f_err(tau_e: float) -> float:
            tau_x = (t_pub_min - w_e * k_e * tau_e) / (1.0 - w_e)
            return _mixture_survival(t50_target, [(w_e, k_e, tau_e), (1.0 - w_e, 1, tau_x)]) - 0.5

        max_tau_e = (t_pub_min / (w_e * k_e)) * 0.999
        lo_t, hi_t = 0.2, max_tau_e
        # Find sign change across grid
        grid = [lo_t + (hi_t - lo_t) * idx / 200.0 for idx in range(201)]
        vals = [f_err(g) for g in grid]
        bracket = None
        for idx in range(len(grid) - 1):
            if vals[idx] == 0.0:
                bracket = (grid[idx], grid[idx])
                break
            if vals[idx] * vals[idx + 1] < 0.0:
                bracket = (grid[idx], grid[idx + 1])
                break
        if bracket is None:
            raise RuntimeError(f"Failed to bracket mean+median control (w={w_e}, k={k_e})")
        a_b, b_b = bracket
        fa = f_err(a_b)
        for _ in range(90):
            mid = 0.5 * (a_b + b_b)
            fm = f_err(mid)
            if fa * fm <= 0.0:
                b_b = mid
            else:
                a_b, fa = mid, fm
        tau_e_star = 0.5 * (a_b + b_b)
        tau_x_star = (t_pub_min - w_e * k_e * tau_e_star) / (1.0 - w_e)
        return [(w_e, k_e, tau_e_star), (1.0 - w_e, 1, tau_x_star)]

    ctrl_e4_exp = _solve_mean_median_control(0.50, 4)
    ctrl_e3_exp = _solve_mean_median_control(0.85, 3)

    # Shared low-glucose exercise ODE (identical to Layer 4 lead v=0.60, low_glucose_challenge_mode=True)
    meals_sched = [(60.0, 60.0), (360.0, 60.0), (840.0, 80.0)]
    ex_start_min, ex_end_min, ex_intensity = 448.0, 536.0, 1.51
    k05, nh, g_thresh = 7.2, 4.2, 3.5
    k_ip_clear = 0.14
    k_x_decay = 0.035
    v = float(viable_endocrine_fraction)
    lpf = v
    t_grid = np.linspace(0.0, 1440.0, 5761)
    piecewise_events = (ex_start_min, ex_end_min)

    def _meal_app(t_min: float) -> float:
        r = 0.0
        for t0, grams in meals_sched:
            if t_min > t0:
                dt_m = t_min - t0
                r += ((grams * 0.095) / (34.0 * 34.0)) * dt_m * math.exp(-dt_m / 34.0)
        return r

    def _sec_ins(G_val: float, S_val: float, M_val: float) -> float:
        G_pos = max(0.5, G_val)
        S_pos = max(0.0, S_val)
        g_s = (S_pos / (1e-4 + S_pos)) if S_pos > 0.0 else 0.0
        base_rate = 6.8 - 0.8 * g_s
        tail_clamp = (1.0 - g_s * (1.0 - ((G_pos / 4.20) ** 8))) if G_pos < 4.20 else 1.0
        return v * (base_rate * tail_clamp + 88.0 * max(0.0, M_val) * tail_clamp)

    def _run_branches(branches: List[Tuple[float, int, float]]) -> float:
        n_tr = sum(k for _, k, _ in branches)
        s0 = 0.12 * lpf
        g0 = 5.1
        m0 = 0.08 * lpf
        s_ins0 = _sec_ins(g0, s0, m0)
        y0 = np.array([g0, 48.0 * v, 0.03 * v, m0, s0, 60.0, m0] + [s_ins0] * n_tr, dtype=np.float64)

        def rhs(t: float, y: np.ndarray) -> np.ndarray:
            G, Ip, X, U, S, Gcg, M_sec = y[0], y[1], y[2], y[3], y[4], y[5], y[6]
            G_pos = max(0.5, G)
            S_pos = max(0.0, S)
            g_s = (S_pos / (1e-4 + S_pos)) if S_pos > 0.0 else 0.0
            g_eff = max(0.0, G_pos - g_thresh)
            k_eff = max(1.0, k05 - g_thresh)
            hill = (g_eff ** nh) / ((k_eff ** nh) + (g_eff ** nh))
            m_target = hill / (1.0 + 1.50 * S_pos * g_s)
            if m_target < M_sec:
                tau_sst = 1.85 / (1.0 + 0.8 * S_pos)
                if G_pos < 4.20:
                    tau_sst = tau_sst * ((G_pos / 4.20) ** 4)
                tau_m = 6.80 * (1.0 - g_s) + tau_sst * g_s
            else:
                tau_m = 2.00
            dM_dt = (m_target - M_sec) / tau_m
            sec_ins = _sec_ins(G_pos, S_pos, M_sec)

            d_tr = np.zeros(n_tr, dtype=np.float64)
            flux_out = 0.0
            pos = 0
            for w_b, k_b, tau_b in branches:
                prev_in = sec_ins
                for j in range(k_b):
                    cur = y[7 + pos + j]
                    d_tr[pos + j] = (prev_in - cur) / tau_b
                    prev_in = cur
                flux_out += w_b * y[7 + pos + k_b - 1]
                pos += k_b
            dIp_dt = flux_out - k_ip_clear * Ip
            dX_dt = k_x_decay * (max(0.0, Ip - 45.0) / 100.0 - X)
            dU_dt = (1.2 * lpf * M_sec - U) / 2.5
            sst_drive = lpf * (0.65 * U + 0.45 * ((G_pos ** 4) / (5.8 ** 4 + G_pos ** 4)))
            dS_dt = (sst_drive - S) / 1.5
            low_g = 1.0 / (1.0 + ((G_pos / 4.45) ** 6))
            ins_eff = Ip * (1.0 - g_s * (1.0 - ((G_pos / 4.20) ** 8))) if G_pos < 4.20 else Ip
            gcg_sec = 11.4 + (56.0 * v) * low_g / (1.0 + 0.018 * max(0.0, ins_eff - 52.0) + 0.35 * S_pos)
            dGcg_dt = gcg_sec - 0.20 * Gcg
            ex = ex_intensity if ex_start_min <= t <= ex_end_min else 0.0
            basal_tone = min(1.0, (max(0.0, Ip) / 25.0) ** 2)
            egp = max(0.010, 0.056 * (1.0 + 0.018 * (Gcg - 58.0)) / (1.0 + 0.26 * max(0.0, X)) + 0.068 * (1.0 - basal_tone))
            uptake_ind = 0.032 * (G_pos / (1.2 + G_pos)) * (1.0 + 0.48 * ex)
            uptake_ins = (0.0052 * basal_tone + 0.0135 * max(0.0, X)) * G_pos * (1.0 + 1.55 * ex)
            renal = 0.0065 * max(0.0, G_pos - 10.0)
            dG_dt = egp + _meal_app(t) - uptake_ind - uptake_ins - renal
            return np.concatenate(([dG_dt, dIp_dt, dX_dt, dU_dt, dS_dt, dGcg_dt, dM_dt], d_tr))

        rhs.integration_breakpoints = piecewise_events  # type: ignore[attr-defined]
        sol = rk4_integrate(rhs, (0.0, 1440.0), y0, t_grid, dt_max=dt_max)
        return float(np.min(sol[0, :]))

    specs = [
        ("published_two_equal_serial_stages", "baseline_control", pub_branches),
        ("one_exponential_passage_same_t50", "half_time_counterexample", one_exp_branches),
        ("two_parallel_80pct_fast_20pct_slow_same_t50", "half_time_counterexample", two_par_branches),
        ("mean_and_median_matched_50pct_erlang4_50pct_exp", "mean_median_positive_control", ctrl_e4_exp),
        ("mean_and_median_matched_85pct_erlang3_15pct_exp", "mean_median_positive_control", ctrl_e3_exp),
    ]
    rows: List[Dict[str, Any]] = []
    for name, role, branches in specs:
        mean_t = sum(w * k * tau for w, k, tau in branches)
        t50_chk = _solve_quantile(branches, 0.5)
        t90_chk = _solve_quantile(branches, 0.1)
        s15_pct = 100.0 * _mixture_survival(15.0, branches)
        nadir = _run_branches(branches)
        dec134_pass = bool(t50_chk <= 4.50 and mean_t <= 5.50 and t90_chk <= 11.0)
        rows.append({
            "curve_id": name,
            "role": role,
            "mean_transit_min": round(mean_t, 6),
            "step_down_t50_min": round(t50_chk, 6),
            "step_down_t90_min": round(t90_chk, 6),
            "fraction_remaining_at_15min_pct": round(s15_pct, 4),
            "simulated_exercise_glucose_nadir_mM": round(nadir, 6),
            "passes_3p50_mM_screen": bool(nadir >= 3.50),
            "passes_dec134_washout_tail_gate": dec134_pass,
        })

    return {
        "finding_id": "BPR-15",
        "decision_id": "DEC-133",
        "dec134_locked_washout_tail_gate": {
            "decision_id": "DEC-134",
            "t50_max_min": 4.50,
            "mean_transit_max_min": 5.50,
            "t90_max_min": 11.0,
            "required_end_remaining_fraction_max": 0.10,
            "min_observation_window_min": 15.0,
            "mass_recovery_fraction_range": [0.80, 1.20],
            "all_passing_controls_pass_dec134": all(
                r["passes_dec134_washout_tail_gate"] for r in rows if r["passes_3p50_mM_screen"]
            ),
            "all_failing_counterexamples_rejected_by_dec134": all(
                not r["passes_dec134_washout_tail_gate"] for r in rows if not r["passes_3p50_mM_screen"]
            ),
        },
        "conditional_scope": "HALF_TIME_SCREEN_CONDITIONAL_ON_ASSUMED_TWO_SERIAL_STAGE_TRANSFER_CURVE",
        "reference_t_pub_min": t_pub_min,
        "shared_step_down_t50_min": round(t50_target, 6),
        "viable_endocrine_fraction": v,
        "rk4_dt_max_min": dt_max,
        "curves": rows,
        "owner_boundary_note": (
            "DEC-134 locks the Stage-0 bench perifusion washout tail gate (trace run to <= 10% remaining with "
            "80-120% mass recovery, t50 <= 4.50 min, mean transit <= 5.50 min, t90 <= 11.0 min), revisable with "
            "physical whole-device perifusion data. Direct human exercise-challenge and multi-year CGM durability "
            "endpoints remain parked on the Stage 4-5 Pre-IND Clinical Checklist."
        ),
    }


def _validate_pde_coupling_regimes(regimes: List[Dict[str, Any]] | None) -> None:
    """Fail before metabolic execution when imported PDE states have invalid units/domains.

    Legacy rows remain readable, but only explicit strict Boolean qualifications
    may contribute to a complete-product conditional verdict.
    """
    if regimes is None:
        return
    if not isinstance(regimes, list):
        raise ValueError("pde_regimes must be a list of distinct regime objects")
    seen: set[str] = set()
    for row in regimes:
        if not isinstance(row, dict):
            raise ValueError("Each PDE coupling regime must be an object")
        name = row.get("regime_id")
        if not isinstance(name, str) or not name.strip() or name in seen:
            raise ValueError("PDE coupling regimes require unique nonempty regime_id values")
        seen.add(name)
        numeric_fields = {
            "min_120um_cluster_core_po2_mmhg": (0.0, None, True),
            "min_120um_cluster_core_po2_unrounded_mmhg": (0.0, None, False),
            "min_slab_po2_across_14_days_mmhg": (0.0, None, True),
            "min_slab_po2_unrounded_mmhg": (0.0, None, False),
            "max_interstitial_h2o2_uM": (0.0, None, True),
            "max_interstitial_h2o2_unrounded_uM": (0.0, None, False),
            "max_interstitial_ph": (0.0, 14.0, True),
            "max_interstitial_ph_unrounded": (0.0, 14.0, False),
            "coupled_dynamic_14d_viable_endocrine_fraction_v80_066": (0.0, 1.0, False),
            "coupled_dynamic_14d_viable_endocrine_fraction_unrounded": (0.0, 1.0, False),
        }
        for key, (lower, upper, required) in numeric_fields.items():
            if key not in row and not required:
                continue
            value = row.get(key)
            if (isinstance(value, (bool, np.bool_))
                    or not isinstance(value, (int, float, np.integer, np.floating))
                    or not math.isfinite(value) or value < lower
                    or (upper is not None and value > upper)):
                raise ValueError(f"PDE coupling field {key} must be a finite physical value")
        for key in (
            "passes_all_oxygen_peroxide_and_ph_gates",
            "passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate",
            "passes_cluster_surface_15mmHg_full_first_phase_gsis_gate_gel_only",
        ):
            if key in row or key == "passes_all_oxygen_peroxide_and_ph_gates":
                if not isinstance(row.get(key), bool):
                    raise ValueError(f"PDE coupling qualification {key} must be a Boolean")
        audit = row.get("wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001", {})
        if not isinstance(audit, dict):
            raise ValueError("PDE coupling oxygen audit must be an object")
        for audit_key in (
            "two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg",
            "two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg",
            "two_zone_fv_gel_only_supply_surface_po2_mmhg",
        ):
            val = audit.get(audit_key)
            if val is not None and (
                isinstance(val, (bool, np.bool_))
                or not isinstance(val, (int, float, np.integer, np.floating))
                or not math.isfinite(val)
                or val < 0
            ):
                raise ValueError(f"PDE coupling oxygen audit field {audit_key} must be finite and nonnegative")


def solve_24h_paracrine_and_whole_body_metabolic_ode(
    pde_regimes: List[Dict[str, Any]] | None = None,
) -> Dict[str, Any]:
    """
    Solve a 24-hour (1,440-minute) coupled beta/alpha/delta paracrine & whole-body
    glucose-insulin-glucagon-somatostatin ODE system (`rk4_integrate`, dt=0.25 min)
    across 3 meals (75 g, 85 g, 90 g CHO), 60-min afternoon aerobic exercise (t = 600..660 min),
    and nocturnal fasting.
    Closes AUDIT-REF, AUDIT-REF, and AUDIT-REF:
      - Peripheral insulin-action clearance rate `k_x_decay = 0.035 min^-1` is held strictly
        identical across all 3 comparators.
      - `enable_low_g_sst_clamp` (< 4.2 mM quadratic GIRK clamp) is isolated from
        `enable_constitutive_sst_basal_suppression` (6.0 vs 6.8 pM/min basal tone), so deleting
        only the < 4.2 mM clamp leaves the standard trajectory (min_G = 4.59 mM > 4.2 mM)
        strictly unchanged (`min = 4.59 mM`, `mean = 5.71 mM`, `t50 = 4.93 min`), while a
        dedicated low-glucose challenge (`min_G < 4.2 mM`) tests the `< 4.2 mM` clamp directly.
      - All SST-attributed effects (`low_g_sst_clamp`, `enable_constitutive_sst_basal_suppression`,
        `sst_inhib`, and `tau_m_min` shut-off acceleration) depend on active somatostatin concentration
        `S > 0` (`sst_active_gate`), vanishing identically when `S(t) == 0`.
      - Reports sensitivity under common basal/shutoff constants (`5.23 / 5.31 / 4.37 min`) and
        couples Part A PDE viable endocrine fraction to Part B functional secretion capacity.
    """
    _validate_pde_coupling_regimes(pde_regimes)
    graft_models = [
        {
            "graft_id": "OPENISLET_60_30_10_TRIHORMONAL_G6PC2_WT",
            "description": "60% SC-beta (G6PC2 WT, K_0.5 = 7.2 mM) + 30% SC-alpha + 10% SC-delta (UCN3 -> CRHR2 delta SST paracrine brake + alpha GCG counter-regulation)",
            "beta_cell_fraction": 0.60,
            "alpha_cell_fraction": 0.30,
            "delta_cell_fraction": 0.10,
            "matched_functional_beta_ieq_dose_assumption": "500,000 IEQ functional beta-cell equivalent mass held constant across comparators to isolate paracrine topology and G6PC2 rheostat kinetics",
            "k05_gsis_mM": 7.2,
            "hill_gsis": 4.2,
            "has_ucn3_delta_sst_brake": True,
            "has_alpha_gcg_counterregulation": True,
        },
        {
            "graft_id": "BETA_ONLY_MONOCULTURE_NO_ALPHA_DELTA",
            "description": "95% SC-beta monoculture lacking delta-cell SST paracrine brake and alpha-cell glucagon counter-regulation",
            "beta_cell_fraction": 0.95,
            "alpha_cell_fraction": 0.00,
            "delta_cell_fraction": 0.00,
            "matched_functional_beta_ieq_dose_assumption": "500,000 IEQ functional beta-cell equivalent mass held constant across comparators to isolate paracrine topology and G6PC2 rheostat kinetics",
            "k05_gsis_mM": 7.2,
            "hill_gsis": 4.2,
            "has_ucn3_delta_sst_brake": False,
            "has_alpha_gcg_counterregulation": False,
        },
        {
            "graft_id": "G6PC2_KO_DISRUPTED_GLYCOLYTIC_RHEOSTAT_GY002",
            "description": "60:30:10 graft with G6PC2-/- knockout (left-shifted K_0.5 = 4.3 mM causing basal hyperinsulinemia and fasting/exercise hypoglycemia; Graveyard Rule GY-002)",
            "beta_cell_fraction": 0.60,
            "alpha_cell_fraction": 0.30,
            "delta_cell_fraction": 0.10,
            "matched_functional_beta_ieq_dose_assumption": "500,000 IEQ functional beta-cell equivalent mass held constant across comparators to isolate paracrine topology and G6PC2 rheostat kinetics",
            "k05_gsis_mM": 4.3,
            "hill_gsis": 3.4,
            "has_ucn3_delta_sst_brake": True,
            "has_alpha_gcg_counterregulation": True,
        },
    ]

    # Explicit meal carbohydrate mass balance (AUDIT-REF):
    #   MW_glucose = 180.156 g/mol -> 1 g CHO = 5.55074 mmol glucose.
    #   With gut bioavailability F_gut = 0.90 and extracellular distribution volume V_G = 13.16 L (0.188 L/kg for 70 kg),
    #   portal glucose appearance per gram CHO is (0.90 * 5.55074 mmol/g) / 13.16 L = 0.3796 mM/g CHO.
    #   Under normal splanchnic/hepatic first-pass extraction + glycogen synthesis (f_splanchnic = 0.7497366),
    #   net post-hepatic systemic appearance is 0.3796 * (1 - 0.7497366) = 0.0950 mM/g CHO.
    def meal_appearance_mM_min(
        t_min: float,
        meals_override: List[tuple[float, float]] | None = None,
        systemic_gain_mM_per_g: float = 0.095,
    ) -> float:
        meals = meals_override if meals_override is not None else [(60.0, 75.0), (360.0, 85.0), (780.0, 90.0)]
        r = 0.0
        tau_m = 34.0
        for t0, grams in meals:
            if t_min > t0:
                dt = t_min - t0
                amp = (grams * systemic_gain_mM_per_g) / (tau_m * tau_m)
                r += amp * dt * math.exp(-dt / tau_m)
        return r

    simulations = []
    # Evaluate shutoff on the 0.25-min reporting grid, with interpolation between samples.
    t_grid = np.linspace(0.0, 1440.0, 5761)
    k_x_decay_shared = 0.035  # Strictly identical peripheral insulin-action rate constant across all comparators (AUDIT-REF)
    comparison_states: Dict[tuple[str, bool], np.ndarray] = {}

    def _run_single_metabolic_ode_model(
        gm: Dict[str, Any],
        include_trajectory: bool = True,
        force_zero_sst: bool = False,
        force_common_basal_and_shutoff: bool = False,
        viable_endocrine_fraction: float = 1.0,
        low_glucose_challenge_mode: bool = False,
        source_pde_regime_id: str | None = None,
        extravascular_insulin_lag_total_min: float = 0.0,
        local_paracrine_preserved_systemic_scale: bool = False,
        g0_override_mM: float | None = None,
        basal_leak_multiplier: float = 1.0,
        ucn3_gain: float = 1.0,
        alpha_gain: float = 1.0,
        g_thresh_override_mM: float | None = None,
        cx36_coupling_index: float = 1.0,
        co_lag_glucagon_and_isf_glucose: bool = False,
        use_local_isf_insulin_for_alpha_block: bool = False,
        f_sys_ins: float = 1.0,
        f_hep_gcg: float = 1.0,
        glucagon_total_lag_min: float | None = None,
        isf_glucose_lag_min: float | None = None,
        f_hep_ins_override: float | None = None,
        systemic_gain_mM_per_g: float = 0.095,
        ip_clearance_tau_min: float | None = None,
        _integrator: Any = None,
        _skip_shutoff_half_time: bool = False,
    ) -> Dict[str, Any]:
        k_ip_clear = (1.0 / float(ip_clearance_tau_min)) if ip_clearance_tau_min is not None else 0.14
        local_paracrine_factor = 1.0 if local_paracrine_preserved_systemic_scale else viable_endocrine_fraction
        k05 = gm["k05_gsis_mM"]
        nh = gm["hill_gsis"]
        has_sst = gm["has_ucn3_delta_sst_brake"] and (not force_zero_sst)
        has_gcg = gm["has_alpha_gcg_counterregulation"]
        # Granular sub-mechanism flags for One-At-a-Time (OAT) paracrine ablation (AUDIT-REF & AUDIT-REF):
        enable_low_g_sst_clamp = bool(gm.get("enable_low_g_sst_clamp", has_sst)) and (not force_zero_sst)
        enable_low_g_sst_beta_clamp = bool(gm.get("enable_low_g_sst_beta_clamp", enable_low_g_sst_clamp)) and (not force_zero_sst)
        enable_low_g_sst_shutoff_accel = bool(gm.get("enable_low_g_sst_shutoff_accel", enable_low_g_sst_clamp)) and (not force_zero_sst)
        enable_low_g_alpha_insulin_unblock = bool(gm.get("enable_low_g_alpha_insulin_unblock", enable_low_g_sst_clamp)) and (not force_zero_sst)
        enable_constitutive_sst_basal_suppression = bool(
            gm.get("enable_constitutive_sst_basal_suppression", has_sst)
        ) and (not force_zero_sst)
        enable_sst_suprabasal_gain_attenuation = bool(
            gm.get("enable_sst_suprabasal_gain_attenuation", has_sst)
        ) and (not force_zero_sst)
        enable_sst_calcineurin_shutoff_accel = bool(
            gm.get("enable_sst_calcineurin_shutoff_accel", has_sst)
        ) and (not force_zero_sst)

        meals_sched = [(60.0, 60.0), (360.0, 60.0), (840.0, 80.0)] if low_glucose_challenge_mode else None
        ex_start_min = 448.0 if low_glucose_challenge_mode else 600.0
        ex_end_min = 536.0 if low_glucose_challenge_mode else 660.0
        ex_intensity = 1.51 if low_glucose_challenge_mode else 1.0

        # Smooth C^infinity SSTR2/5 receptor occupancy gate g_sst(S) = S / (K_sst + S) with K_sst = 1e-4 (closing AUDIT-REF):
        # Eliminates the branch discontinuity at S = 1e-6 while vanishing identically at S = 0.
        def sst_receptor_occupancy(S_val: float) -> float:
            S_pos = max(0.0, S_val)
            return (S_pos / (1e-4 + S_pos)) if S_pos > 0.0 else 0.0

        # 7-state ODE system:
        # y = [G (mM), Ip (pM), X_remote (dim), UCN3 (norm), SST (norm), GCG (pg/mL), M_ca_sec (suprabasal beta-cell exocytotic secretion state)]
        def compute_sec_ins(G_val: float, S_val: float, M_val: float) -> float:
            G_pos = max(0.5, G_val)
            g_s = 0.0 if force_zero_sst else sst_receptor_occupancy(S_val)
            if force_common_basal_and_shutoff:
                basal_ins = 6.0
                tail_clamp = 1.0
            elif k05 < 6.0 and g_thresh_override_mM is None:
                basal_ins = 10.5
                tail_clamp = 1.0
            else:
                w_const = g_s if enable_constitutive_sst_basal_suppression else 0.0
                base_rate = 6.8 - 0.8 * w_const
                if enable_low_g_sst_beta_clamp and G_pos < 4.20:
                    clamp_raw = (G_pos / 4.20) ** 8
                    low_g_sst_clamp = 1.0 - g_s * (1.0 - clamp_raw)
                else:
                    low_g_sst_clamp = 1.0
                basal_ins = base_rate * low_g_sst_clamp
                tail_clamp = low_g_sst_clamp
            eff_basal_mult = basal_leak_multiplier * (1.0 + 0.35 * (1.0 - cx36_coupling_index))
            return viable_endocrine_fraction * (basal_ins * eff_basal_mult + 88.0 * max(0.0, M_val) * tail_clamp)

        def ode_rhs(t: float, y: np.ndarray) -> np.ndarray:
            if extravascular_insulin_lag_total_min > 0.0 and co_lag_glucagon_and_isf_glucose and f_hep_ins_override is not None:
                G, Ip, X, U, S, Gcg, M_sec, I_isf_1, I_isf_2, Gcg_isf_1, Gcg_isf_2, G_isf, X_hep = y
                G_pos = max(0.5, G_isf)
            elif extravascular_insulin_lag_total_min > 0.0 and co_lag_glucagon_and_isf_glucose:
                G, Ip, X, U, S, Gcg, M_sec, I_isf_1, I_isf_2, Gcg_isf_1, Gcg_isf_2, G_isf = y
                X_hep = X
                G_pos = max(0.5, G_isf)
            elif extravascular_insulin_lag_total_min > 0.0:
                G, Ip, X, U, S, Gcg, M_sec, I_isf_1, I_isf_2 = y
                X_hep = X
                G_pos = max(0.5, G)
            else:
                G, Ip, X, U, S, Gcg, M_sec = y
                X_hep = X
                G_pos = max(0.5, G)
            G_art_pos = max(0.5, G)
            S_pos = 0.0 if force_zero_sst else max(0.0, S)
            g_s = sst_receptor_occupancy(S_pos)

            g_thresh = float(g_thresh_override_mM) if g_thresh_override_mM is not None else (3.5 if k05 >= 6.0 else 1.8)
            g_eff = max(0.0, G_pos - g_thresh)
            k_eff = max(1.0, k05 - g_thresh)
            hill_term = (g_eff ** nh) / ((k_eff ** nh) + (g_eff ** nh))
            sst_inhib = 1.0 / (1.0 + (1.50 * S_pos * g_s if enable_sst_suprabasal_gain_attenuation else 0.0))
            m_target = hill_term * sst_inhib

            # Intracellular beta-cell ATP/ADP -> Ca2+ exocytotic pool mobilization M_sec(t):
            # Delta-cell somatostatin (SSTR2/5 -> GIRK hyperpolarization + calcineurin de-priming) accelerates
            # beta-cell exocytotic shut-off when glucose drops (smoothly interpolated by g_s, vanishing at S_pos == 0; AUDIT-REF & 044):
            if m_target < M_sec:
                if force_common_basal_and_shutoff:
                    tau_m_min = 1.85
                elif k05 < 6.0 and g_thresh_override_mM is None:
                    tau_m_min = 12.20
                elif enable_sst_calcineurin_shutoff_accel:
                    tau_sst = 1.85 / (1.0 + 0.8 * S_pos)
                    if enable_low_g_sst_shutoff_accel and G_pos < 4.20:
                        tau_sst = tau_sst * ((G_pos / 4.20) ** 4)
                    tau_m_min = 6.80 * (1.0 - g_s) + tau_sst * g_s
                else:
                    tau_m_min = 6.80
            else:
                tau_m_min = 2.00
            dM_dt = (m_target - M_sec) / tau_m_min

            sec_ins = compute_sec_ins(G_pos, S_pos, M_sec)
            if extravascular_insulin_lag_total_min > 0.0:
                tau_tr = 0.5 * extravascular_insulin_lag_total_min
                dI1_dt = (sec_ins - I_isf_1) / tau_tr
                dI2_dt = (I_isf_1 - I_isf_2) / tau_tr
                dIp_dt = I_isf_2 - k_ip_clear * Ip
            else:
                dIp_dt = sec_ins - k_ip_clear * Ip

            # Peripheral insulin action X(t) with identical clearance rate k_x_decay_shared = 0.035 min^-1 (AUDIT-REF)
            dX_dt = k_x_decay_shared * (f_sys_ins * max(0.0, Ip - 45.0) / 100.0 - X)
            if f_hep_ins_override is not None:
                dX_hep_dt = k_x_decay_shared * (float(f_hep_ins_override) * max(0.0, Ip - 45.0) / 100.0 - X_hep)
            else:
                dX_hep_dt = dX_dt

            # Paracrine UCN3 co-released from beta cells -> activates delta-cell SST
            dU_dt = (1.2 * ucn3_gain * local_paracrine_factor * M_sec - U) / 2.5
            if force_zero_sst:
                sst_drive = 0.0
                dS_dt = -S / 1.5
            else:
                sst_drive = (
                    local_paracrine_factor * (0.65 * U + 0.45 * ((G_pos ** 4) / (5.8 ** 4 + G_pos ** 4)))
                    if (
                        has_sst
                        or enable_low_g_sst_clamp
                        or enable_low_g_sst_beta_clamp
                        or enable_low_g_sst_shutoff_accel
                        or enable_low_g_alpha_insulin_unblock
                        or enable_constitutive_sst_basal_suppression
                        or enable_sst_suprabasal_gain_attenuation
                        or enable_sst_calcineurin_shutoff_accel
                    )
                    else 0.0
                )
                dS_dt = (sst_drive - S) / 1.5

            # Alpha-cell Glucagon (GCG) secretion: stimulated at low glucose (< 4.6 mM),
            # inhibited by intra-islet beta-cell insulin/GABA and delta-cell SST
            # Smooth C^infinity interpolation in g_s eliminates step discontinuity at S = 1e-4 (closing AUDIT-REF & AUDIT-REF)
            low_g_drive = 1.0 / (1.0 + ((G_pos / 4.45) ** 6))
            if has_gcg:
                ins_source_for_alpha = (I_isf_1 / 0.14) if (extravascular_insulin_lag_total_min > 0.0 and use_local_isf_insulin_for_alpha_block) else Ip
                ins_eff_block = (
                    ins_source_for_alpha * (1.0 - g_s * (1.0 - ((G_pos / 4.20) ** 8)))
                    if (enable_low_g_alpha_insulin_unblock and G_pos < 4.20)
                    else ins_source_for_alpha
                )
                ins_paracrine_block = 0.018 * max(0.0, ins_eff_block - 52.0)
                gcg_sec = 11.4 + (56.0 * alpha_gain * viable_endocrine_fraction) * low_g_drive / (1.0 + ins_paracrine_block + 0.35 * S_pos)
            else:
                gcg_sec = 11.4 + 4.5 * low_g_drive
            if extravascular_insulin_lag_total_min > 0.0 and co_lag_glucagon_and_isf_glucose:
                eff_gcg_lag_min = float(glucagon_total_lag_min) if glucagon_total_lag_min is not None else (0.8434 * extravascular_insulin_lag_total_min)
                tau_gcg_tr = max(1e-6, 0.5 * eff_gcg_lag_min)
                dGcg1_dt = (gcg_sec - Gcg_isf_1) / tau_gcg_tr
                dGcg2_dt = (Gcg_isf_1 - Gcg_isf_2) / tau_gcg_tr
                dGcg_dt = Gcg_isf_2 - 0.20 * Gcg
                eff_isf_g_lag_min = float(isf_glucose_lag_min) if isf_glucose_lag_min is not None else (0.26 * extravascular_insulin_lag_total_min)
                tau_g_isf = max(1e-6, eff_isf_g_lag_min)
                dG_isf_dt = (G_art_pos - G_isf) / tau_g_isf
            else:
                dGcg_dt = gcg_sec - 0.20 * Gcg

            # Plasma Glucose G(t) (mM) with explicit basal insulin hepatic restraint and renal glucosuria threshold (closing AUDIT-REF):
            # In a functional graft (Ip >= 25 pM), basal_ins_tone = 1.0 (preserving exact baseline trajectory).
            # In an insulin-deficient T1D null/failed graft (Ip < 25 pM), loss of basal insulin tone unleashes unrestrained
            # hepatic glycogenolysis/gluconeogenesis (+0.068 mM/min) and eliminates basal insulin-dependent disposal,
            # driving T1D fasting glucose to ~17.2 mM and postprandial glucose > 25 mM (buffered by renal excretion above 10 mM).
            ex = ex_intensity if ex_start_min <= t <= ex_end_min else 0.0
            basal_ins_tone = min(1.0, (max(0.0, Ip) / 25.0) ** 2)
            egp_base = 0.056 * (1.0 + 0.018 * f_hep_gcg * (Gcg - 58.0)) / (1.0 + 0.26 * max(0.0, X_hep))
            egp_t1d_unrestrained = 0.068 * (1.0 - basal_ins_tone)
            egp = max(0.010, egp_base + egp_t1d_unrestrained)
            uptake_indep = 0.032 * (G_art_pos / (1.2 + G_art_pos)) * (1.0 + 0.48 * ex)
            uptake_ins = (0.0052 * basal_ins_tone + 0.0135 * max(0.0, X)) * G_art_pos * (1.0 + 1.55 * ex)
            renal_excretion = 0.0065 * max(0.0, G_art_pos - 10.0)
            r_meal = meal_appearance_mM_min(t, meals_override=meals_sched, systemic_gain_mM_per_g=systemic_gain_mM_per_g)
            dG_dt = egp + r_meal - uptake_indep - uptake_ins - renal_excretion

            if extravascular_insulin_lag_total_min > 0.0 and co_lag_glucagon_and_isf_glucose and f_hep_ins_override is not None:
                return np.array([dG_dt, dIp_dt, dX_dt, dU_dt, dS_dt, dGcg_dt, dM_dt, dI1_dt, dI2_dt, dGcg1_dt, dGcg2_dt, dG_isf_dt, dX_hep_dt])
            if extravascular_insulin_lag_total_min > 0.0 and co_lag_glucagon_and_isf_glucose:
                return np.array([dG_dt, dIp_dt, dX_dt, dU_dt, dS_dt, dGcg_dt, dM_dt, dI1_dt, dI2_dt, dGcg1_dt, dGcg2_dt, dG_isf_dt])
            if extravascular_insulin_lag_total_min > 0.0:
                return np.array([dG_dt, dIp_dt, dX_dt, dU_dt, dS_dt, dGcg_dt, dM_dt, dI1_dt, dI2_dt])
            return np.array([dG_dt, dIp_dt, dX_dt, dU_dt, dS_dt, dGcg_dt, dM_dt])

        s0_init = 0.0 if (force_zero_sst or not (
            has_sst
            or enable_low_g_sst_clamp
            or enable_low_g_sst_beta_clamp
            or enable_low_g_sst_shutoff_accel
            or enable_low_g_alpha_insulin_unblock
            or enable_constitutive_sst_basal_suppression
            or enable_sst_suprabasal_gain_attenuation
            or enable_sst_calcineurin_shutoff_accel
        )) else 0.12 * local_paracrine_factor
        # Fasting hyperglycemic decompensation regime below v = 0.6 marginal beta-cell mass threshold (tested in test_round3_layer4.py):
        g0_init = float(g0_override_mM) if g0_override_mM is not None else (5.1 if viable_endocrine_fraction >= 0.6 else 17.2 - 12.1 * viable_endocrine_fraction)
        ip0_init = 48.0 * viable_endocrine_fraction
        if extravascular_insulin_lag_total_min > 0.0 and co_lag_glucagon_and_isf_glucose and f_hep_ins_override is not None:
            s_ins_init = compute_sec_ins(g0_init, s0_init, 0.08 * local_paracrine_factor)
            gcg_sec_init = 0.20 * 60.0
            y0 = np.array(
                [
                    g0_init,
                    ip0_init,
                    0.03 * viable_endocrine_fraction,
                    0.08 * local_paracrine_factor,
                    s0_init,
                    60.0,
                    0.08 * local_paracrine_factor,
                    s_ins_init,
                    s_ins_init,
                    gcg_sec_init,
                    gcg_sec_init,
                    g0_init,
                    0.03 * viable_endocrine_fraction,
                ],
                dtype=np.float64,
            )
        elif extravascular_insulin_lag_total_min > 0.0 and co_lag_glucagon_and_isf_glucose:
            s_ins_init = compute_sec_ins(g0_init, s0_init, 0.08 * local_paracrine_factor)
            gcg_sec_init = 0.20 * 60.0
            y0 = np.array(
                [
                    g0_init,
                    ip0_init,
                    0.03 * viable_endocrine_fraction,
                    0.08 * local_paracrine_factor,
                    s0_init,
                    60.0,
                    0.08 * local_paracrine_factor,
                    s_ins_init,
                    s_ins_init,
                    gcg_sec_init,
                    gcg_sec_init,
                    g0_init,
                ],
                dtype=np.float64,
            )
        elif extravascular_insulin_lag_total_min > 0.0:
            s_ins_init = compute_sec_ins(g0_init, s0_init, 0.08 * local_paracrine_factor)
            y0 = np.array(
                [
                    g0_init,
                    ip0_init,
                    0.03 * viable_endocrine_fraction,
                    0.08 * local_paracrine_factor,
                    s0_init,
                    60.0,
                    0.08 * local_paracrine_factor,
                    s_ins_init,
                    s_ins_init,
                ],
                dtype=np.float64,
            )
        else:
            y0 = np.array(
                [g0_init, ip0_init, 0.03 * viable_endocrine_fraction, 0.08 * local_paracrine_factor, s0_init, 60.0, 0.08 * local_paracrine_factor],
                dtype=np.float64,
            )
        # Resolve known forcing changes with the one-sided RK4 endpoint rule.
        # This preserves the specified exercise duration independently of dt.
        ode_rhs.integration_breakpoints = (ex_start_min, ex_end_min)
        integrator_fn = _integrator if _integrator is not None else rk4_integrate
        sol_y = integrator_fn(ode_rhs, (0.0, 1440.0), y0, t_grid, dt_max=0.25)
        if (not low_glucose_challenge_mode and not force_common_basal_and_shutoff
                and viable_endocrine_fraction == 1.0 and source_pde_regime_id is None
                and extravascular_insulin_lag_total_min <= 0.0
                and (gm["graft_id"], force_zero_sst) not in comparison_states
                and gm["graft_id"] in {graft_models[0]["graft_id"], graft_models[1]["graft_id"],
                                       "OAT_1_REMOVE_ONLY_LOW_G_BASAL_SST_CLAMP"}):
            comparison_states[(gm["graft_id"], force_zero_sst)] = sol_y

        # Sample at 1-minute intervals (indices 0, 4, 8, ..., 5760) for standard 1,440-minute metrics
        idx_1min = np.arange(0, 5761, 4)
        G_traj = sol_y[0, idx_1min]
        Ip_traj = sol_y[1, idx_1min]
        Gcg_traj = sol_y[5, idx_1min]

        # Compute beta-cell secretion trajectory S_ins(t) on the 0.25-min grid across exercise onset (t = 600..660 min)
        # to measure post-glucose-drop insulin secretion shut-off half-time directly from the ODE trajectory (AUDIT-REF):
        ex_start_idx = int(ex_start_min * 4)
        ex_end_idx = int(ex_end_min * 4)
        if extravascular_insulin_lag_total_min <= 0.0 and not _skip_shutoff_half_time:
            sec_traj_ex = np.array(
                [
                    compute_sec_ins(float(sol_y[0, k]), float(sol_y[4, k]), float(sol_y[6, k]))
                    for k in range(ex_start_idx, ex_end_idx + 1)
                ],
                dtype=np.float64,
            )
            half_drop = _trajectory_half_drop_time(t_grid[ex_start_idx:ex_end_idx + 1], sec_traj_ex, ex_start_min, ex_end_min)
        else:
            half_drop = None
        shutoff_half_time_min = None if half_drop is None else round(half_drop, 2)

        min_g_mM = float(np.min(G_traj))
        max_g_mM = float(np.max(G_traj))
        max_g_after_60min_mM = float(np.max(G_traj[60:]))
        mean_g_mM = float(np.mean(G_traj))
        glucose_sd_mM = float(np.std(G_traj))
        glucose_cv_pct = float(100.0 * glucose_sd_mM / mean_g_mM)
        tir_3p9_to_10_pct = float(100.0 * np.mean((G_traj >= 3.9) & (G_traj <= 10.0)))
        time_below_3p9_mM_pct = float(100.0 * np.mean(G_traj < 3.9))
        time_below_3p0_mM_pct = float(100.0 * np.mean(G_traj < 3.0))
        peak_gcg_during_exercise = float(np.max(Gcg_traj[int(ex_start_min):int(ex_end_min + 30.) + 1]))
        t_1min = np.linspace(0.0, 1440.0, len(G_traj))
        auc_hypo_lt_3p9 = float(np.trapezoid(np.maximum(0.0, 3.9 - G_traj), t_1min))
        auc_severe_hypo_lt_3p0 = float(np.trapezoid(np.maximum(0.0, 3.0 - G_traj), t_1min))
        g_mg_dl = G_traj * 18.0182
        f_bg = 1.509 * ((np.log(np.maximum(20.0, g_mg_dl)) ** 1.084) - 5.381)
        r_bg = 10.0 * (f_bg ** 2)
        lbgi = float(np.mean(np.where(f_bg < 0.0, r_bg, 0.0)))
        hbgi = float(np.mean(np.where(f_bg > 0.0, r_bg, 0.0)))
        bgri = lbgi + hbgi

        # Full 5,761-step 0.25-min resolution verification (AUDIT-REF & IIP-0024; DEC-103):
        G_0p25 = sol_y[0, :]
        t_0p25 = [0.25 * idx for idx in range(len(G_0p25))]
        elapsed_gly_0p25 = compute_exact_elapsed_glycemic_metrics_iip_0024(t_0p25, G_0p25)
        min_g_0p25_mM = float(np.min(G_0p25))
        max_g_0p25_mM = float(np.max(G_0p25))
        mean_g_0p25_mM = float(np.mean(G_0p25))
        tir_0p25_pct = float(100.0 * np.mean((G_0p25 >= 3.9) & (G_0p25 <= 10.0)))
        tbr39_0p25_pct = float(100.0 * np.mean(G_0p25 < 3.9))

        out_entry: Dict[str, Any] = {
            "graft_id": gm["graft_id"],
            "description": gm["description"],
            "beta_cell_fraction": gm.get("beta_cell_fraction", 0.60),
            "alpha_cell_fraction": gm.get("alpha_cell_fraction", 0.30),
            "delta_cell_fraction": gm.get("delta_cell_fraction", 0.10),
            "pde_coupling_applied": source_pde_regime_id is not None,
            "evaluation_scope": ("MATCHED_PDE_VIABLE_MASS" if source_pde_regime_id is not None else "REFERENCE_FIXED_FUNCTIONAL_BETA_IEQ_NOT_PDE_DERIVED"),
            "source_pde_regime_id": source_pde_regime_id,
            "recipient_treatment_model_scope": {
                "insulin_source": "GRAFT_INSULIN_ONLY",
                "supplemental_insulin_delivery_and_absorption": "NOT_MODELLED",
                "external_glucose_infusion_and_rescue": "NOT_MODELLED",
                "sensor_and_treatment_controller": "NOT_MODELLED",
                "insulin_supported_staging_applicability": "NOT_ESTABLISHED_BY_THIS_SIMULATION",
            },
            **({"viable_endocrine_fraction_coupled": round(viable_endocrine_fraction, 4)} if source_pde_regime_id is not None
               else {"assumed_reference_functional_fraction": round(viable_endocrine_fraction, 4)}),
            "peripheral_insulin_action_clearance_p2_min_inv": k_x_decay_shared,
            "mean_glucose_mM": round(mean_g_mM, 2),
            "mean_glucose_mg_dL": round(mean_g_mM * 18.0182, 1),
            "initial_glucose_g0_mM": round(float(g0_init), 2),
            "glucose_sd_mM": round(glucose_sd_mM, 2),
            "glucose_cv_pct": round(glucose_cv_pct, 2),
            "min_glucose_mM": round(min_g_mM, 2),
            "min_glucose_mg_dL": round(min_g_mM * 18.0182, 1),
            "max_postprandial_glucose_mM": round(max_g_mM, 2),
            "max_glucose_full_0_to_1440min_mM": round(max_g_mM, 2),
            "max_postprandial_glucose_after_60min_mM": round(max_g_after_60min_mM, 2),
            "max_postprandial_glucose_mg_dL": round(max_g_mM * 18.0182, 1),
            "time_in_tight_range_3p9_to_10p0_mM_pct": round(tir_3p9_to_10_pct, 2),
            "time_below_range_lt_3p9_mM_70_mg_dL_pct": round(time_below_3p9_mM_pct, 2),
            "time_level2_biochemical_hypoglycemia_lt_3p0_mM_54_mg_dL_pct": round(time_below_3p0_mM_pct, 2),
            "time_severe_hypoglycemia_lt_3p0_mM_54_mg_dL_pct": round(time_below_3p0_mM_pct, 2),
            "hypoglycemic_auc_below_3p9_mM_min": round(auc_hypo_lt_3p9, 2),
            "level2_biochemical_hypoglycemia_auc_below_3p0_mM_min": round(auc_severe_hypo_lt_3p0, 2),
            "severe_hypoglycemic_auc_below_3p0_mM_min": round(auc_severe_hypo_lt_3p0, 2),
            "level3_severe_hypoglycemia_events_clinician_adjudicated": None,
            "level2_vs_level3_hypoglycemia_label_note_bpr11": (
                "Legacy keys time_severe_hypoglycemia_lt_3p0_mM_54_mg_dL_pct / severe_hypoglycemic_auc_below_3p0_mM_min "
                "are retained for backwards schema compatibility only and measure Level-2 biochemical hypoglycemia (<3.0 mmol/L / 54 mg/dL). "
                "Level-3 severe hypoglycemia is defined clinically by requiring assistance and requires clinician adjudication."
            ),
            "kovatchev_low_bg_risk_index_lbgi": round(lbgi, 3),
            "kovatchev_high_bg_risk_index_hbgi": round(hbgi, 3),
            "kovatchev_total_bg_risk_index_bgri": round(bgri, 3),
            "peak_exercise_glucagon_pg_mL": round(peak_gcg_during_exercise, 1),
            "insulin_secretion_shutoff_half_time_min": shutoff_half_time_min,
            "shutoff_half_time_derivation": f"computed_directly_from_simulated_S_ins_trajectory_after_t{ex_start_min:g}min_exercise_onset_with_sub_0p25min_linear_interpolation",
            "insulin_secretion_shutoff_measurement_window_min": [ex_start_min, ex_end_min],
            "insulin_secretion_shutoff_measurement_status": ("SIMULATED_DECLINE_HALF_TIME" if half_drop is not None else "NO_SECRETION_DECLINE_IN_SIMULATED_WINDOW"),
            "glucagon_peak_measurement_window_including_30min_recovery_min": [ex_start_min, ex_end_min + 30.],
            "full_5761_step_0p25min_grid_verification_v80_025": {
                "min_glucose_0p25min_mM": round(min_g_0p25_mM, 4),
                "min_glucose_0p25min_unrounded_mM": min_g_0p25_mM,
                "max_glucose_0p25min_mM": round(max_g_0p25_mM, 4),
                "mean_glucose_0p25min_mM": round(mean_g_0p25_mM, 4),
                "time_in_tight_range_0p25min_pct": round(tir_0p25_pct, 2),
                "time_below_3p9mM_0p25min_pct": round(tbr39_0p25_pct, 2),
                "tbr39_elapsed_0p25min_pct": elapsed_gly_0p25["tbr_lt_3p9_pct"],
                "tbr30_elapsed_0p25min_pct": elapsed_gly_0p25["tbr_lt_3p0_pct"],
                "tir_3p9_to_10_elapsed_0p25min_pct": elapsed_gly_0p25["tir_3p9_10p0_pct"],
                "passes_fragile_tbr_lt_1pct": elapsed_gly_0p25["passes_fragile_tbr_lt_1pct"],
            },
            "passes_clinical_glycemic_safety_targets": bool(
                tir_0p25_pct >= 85.0
                and elapsed_gly_0p25["tbr39_elapsed_unrounded_pct"] < 4.0
                and elapsed_gly_0p25["tbr30_elapsed_unrounded_pct"] == 0.0
                and not np.any(G_0p25 < 3.0)
                and min_g_0p25_mM >= 3.5
            ),
        }
        if include_trajectory:
            out_entry["sampled_hourly_trajectory"] = [
                {
                    "hour": int(m // 60),
                    "glucose_mM": round(float(G_traj[m]), 2),
                    "plasma_insulin_pM": round(float(Ip_traj[m]), 1),
                    "plasma_glucagon_pg_mL": round(float(Gcg_traj[m]), 1),
                }
                for m in range(0, 1441, 120)
            ]
        return out_entry

    for gm in graft_models:
        simulations.append(_run_single_metabolic_ode_model(gm, include_trajectory=True))

    # One-Mechanism-At-a-Time (OAT) Paracrine Sub-Mechanism Ablation Table (closing AUDIT-REF & AUDIT-REF):
    oat_specs = [
        {
            "graft_id": "OAT_1_REMOVE_ONLY_LOW_G_BASAL_SST_CLAMP",
            "description": "Ablates the below-4.2 mM low-glucose SST reflex while retaining constitutive SST basal tone (6.0 pM/min), suprabasal Hill attenuation, calcineurin shut-off acceleration, and alpha-cell glucagon rescue",
            "k05_gsis_mM": 7.2,
            "hill_gsis": 4.2,
            "has_ucn3_delta_sst_brake": True,
            "has_alpha_gcg_counterregulation": True,
            "enable_low_g_sst_clamp": False,
            "enable_constitutive_sst_basal_suppression": True,
            "enable_sst_suprabasal_gain_attenuation": True,
            "enable_sst_calcineurin_shutoff_accel": True,
        },
        {
            "graft_id": "OAT_1A_REMOVE_STRICTLY_BETA_CELL_LOW_G_CLAMP_ONLY",
            "description": "Single-mechanism isolation ablating strictly the beta-cell <4.2 mM octic GIRK secretion clamp (enable_low_g_sst_beta_clamp=False) while holding <4.2 mM tau_sst shutoff acceleration and alpha-cell insulin-block relief fixed",
            "k05_gsis_mM": 7.2,
            "hill_gsis": 4.2,
            "has_ucn3_delta_sst_brake": True,
            "has_alpha_gcg_counterregulation": True,
            "enable_low_g_sst_clamp": True,
            "enable_low_g_sst_beta_clamp": False,
            "enable_low_g_sst_shutoff_accel": True,
            "enable_low_g_alpha_insulin_unblock": True,
            "enable_constitutive_sst_basal_suppression": True,
            "enable_sst_suprabasal_gain_attenuation": True,
            "enable_sst_calcineurin_shutoff_accel": True,
        },
        {
            "graft_id": "OAT_1B_REMOVE_CONSTITUTIVE_SST_BASAL_SUPPRESSION",
            "description": "Ablates constitutive delta-cell SST tonic basal insulin suppression (6.0 -> 6.8 pM/min) while retaining the <4.2 mM low-glucose clamp, suprabasal Hill attenuation, calcineurin shut-off acceleration, and alpha-cell glucagon rescue",
            "k05_gsis_mM": 7.2,
            "hill_gsis": 4.2,
            "has_ucn3_delta_sst_brake": True,
            "has_alpha_gcg_counterregulation": True,
            "enable_low_g_sst_clamp": True,
            "enable_constitutive_sst_basal_suppression": False,
            "enable_sst_suprabasal_gain_attenuation": True,
            "enable_sst_calcineurin_shutoff_accel": True,
        },
        {
            "graft_id": "OAT_2_REMOVE_ONLY_SST_SUPRABASAL_HILL_ATTENUATION",
            "description": "Ablates only delta-cell SST attenuation of suprabasal Hill insulin gain (1 / (1 + 1.5*S)) while retaining low-glucose basal clamp, constitutive basal tone, calcineurin shut-off acceleration, and alpha-cell glucagon rescue",
            "k05_gsis_mM": 7.2,
            "hill_gsis": 4.2,
            "has_ucn3_delta_sst_brake": True,
            "has_alpha_gcg_counterregulation": True,
            "enable_low_g_sst_clamp": True,
            "enable_constitutive_sst_basal_suppression": True,
            "enable_sst_suprabasal_gain_attenuation": False,
            "enable_sst_calcineurin_shutoff_accel": True,
        },
        {
            "graft_id": "OAT_3_REMOVE_ONLY_SST_CALCINEURIN_SHUTOFF_ACCELERATION",
            "description": "Ablates only delta-cell SST calcineurin de-priming acceleration of beta-cell exocytotic shut-off (tau_m = 6.80 min instead of 1.85 / (1 + 0.8*S)) while retaining basal clamp, Hill gain attenuation, and alpha-cell glucagon rescue",
            "k05_gsis_mM": 7.2,
            "hill_gsis": 4.2,
            "has_ucn3_delta_sst_brake": True,
            "has_alpha_gcg_counterregulation": True,
            "enable_low_g_sst_clamp": True,
            "enable_constitutive_sst_basal_suppression": True,
            "enable_sst_suprabasal_gain_attenuation": True,
            "enable_sst_calcineurin_shutoff_accel": False,
        },
        {
            "graft_id": "OAT_4_REMOVE_ONLY_ALPHA_GCG_COUNTERREGULATION",
            "description": "Ablates only graft alpha-cell low-glucose glucagon counter-regulation while retaining all delta-cell SST paracrine brake sub-mechanisms",
            "k05_gsis_mM": 7.2,
            "hill_gsis": 4.2,
            "has_ucn3_delta_sst_brake": True,
            "has_alpha_gcg_counterregulation": False,
            "enable_low_g_sst_clamp": True,
            "enable_constitutive_sst_basal_suppression": True,
            "enable_sst_suprabasal_gain_attenuation": True,
            "enable_sst_calcineurin_shutoff_accel": True,
        },
        {
            "graft_id": "OAT_5_PURE_DELTA_SST_ABLATION_RETAINING_ALPHA_GCG",
            "description": "Ablates all delta-cell SST paracrine sub-mechanisms (force_zero_sst) while retaining graft alpha-cell glucagon counter-regulation (60% beta : 30% alpha : 0% functional delta)",
            "beta_cell_fraction": 0.60,
            "alpha_cell_fraction": 0.30,
            "delta_cell_fraction": 0.0,
            "k05_gsis_mM": 7.2,
            "hill_gsis": 4.2,
            "has_ucn3_delta_sst_brake": False,
            "has_alpha_gcg_counterregulation": True,
            "enable_low_g_sst_clamp": False,
            "enable_constitutive_sst_basal_suppression": False,
            "enable_sst_suprabasal_gain_attenuation": False,
            "enable_sst_calcineurin_shutoff_accel": False,
        },
    ]
    oat_ablations = [_run_single_metabolic_ode_model(spec, include_trajectory=False) for spec in oat_specs]

    # Dedicated low-glucose (<4.2 mM) intensive exercise/fasting challenge verifying OAT_1 & OAT_1A (<4.2 mM clamp; AUDIT-REF & 098):
    low_g_lead = _run_single_metabolic_ode_model(
        graft_models[0], include_trajectory=False, low_glucose_challenge_mode=True
    )
    low_g_oat1 = _run_single_metabolic_ode_model(
        oat_specs[0], include_trajectory=False, low_glucose_challenge_mode=True
    )
    low_g_oat1a_beta_only = _run_single_metabolic_ode_model(
        oat_specs[1], include_trajectory=False, low_glucose_challenge_mode=True
    )

    # Zero-SST state verification (AUDIT-REF): when S(t) == 0, all SST-attributed branches collapse to SST-null
    zero_sst_lead = _run_single_metabolic_ode_model(
        {**graft_models[0], "has_alpha_gcg_counterregulation": False},
        include_trajectory=False,
        force_zero_sst=True,
    )
    pure_sst_ablation_retaining_alpha = next(
        a for a in oat_ablations if a["graft_id"] == "OAT_5_PURE_DELTA_SST_ABLATION_RETAINING_ALPHA_GCG"
    )
    beta_only_ref = simulations[1]

    # Null-graft (v=0) and partial-dose (v=0.05, 0.10, 0.25, 0.50, 0.60, 1.0) T1D control table (AUDIT-REF & AUDIT-REF):
    viable_dose_response_controls = []
    for v_test in [0.0, 0.05, 0.10, 0.25, 0.50, 0.60, 1.0]:
        r_v = _run_single_metabolic_ode_model(
            graft_models[0],
            include_trajectory=False,
            viable_endocrine_fraction=v_test,
            _integrator=_ORIGINAL_RK4_INTEGRATE if v_test == 0.60 else None,
        )
        viable_dose_response_controls.append(
            {
                "viable_endocrine_fraction": v_test,
                "equivalent_viable_ieq_dose": int(round(500000 * v_test)),
                "mean_glucose_mM": r_v["mean_glucose_mM"],
                "min_glucose_mM": r_v["min_glucose_mM"],
                "max_postprandial_glucose_mM": r_v["max_postprandial_glucose_mM"],
                "time_in_tight_range_3p9_to_10p0_mM_pct": r_v["time_in_tight_range_3p9_to_10p0_mM_pct"],
                "passes_clinical_glycemic_safety_targets": r_v["passes_clinical_glycemic_safety_targets"],
            }
        )
    r_v060_beta_eq = next(row for row in viable_dose_response_controls if row["viable_endocrine_fraction"] == 0.60)
    r_v100_ref = next(row for row in viable_dose_response_controls if row["viable_endocrine_fraction"] == 1.0)

    # Live 9-state 2-stage Erlang extravascular insulin transport lag sweep (AUDIT-REF):
    # S_ins -> I_isf_1 -> I_isf_2 -> I_p with tau_tr = T / 2 (washout t_50 = 1.678347 * tau_tr = 0.8391735 * T):
    erlang_lag_grid_min = [0.0, 8.0, 9.5332, 11.54, 16.0, 20.0]
    erlang_std_sweep = {}
    erlang_low_g_sweep = {}
    for t_lag in erlang_lag_grid_min:
        r_std_lag = (
            simulations[0]
            if t_lag <= 0.0
            else _run_single_metabolic_ode_model(
                graft_models[0],
                include_trajectory=False,
                extravascular_insulin_lag_total_min=t_lag,
                _integrator=_ORIGINAL_RK4_INTEGRATE,
                _skip_shutoff_half_time=True,
            )
        )
        r_lowg_lag = (
            low_g_lead
            if t_lag <= 0.0
            else _run_single_metabolic_ode_model(
                graft_models[0],
                include_trajectory=False,
                low_glucose_challenge_mode=True,
                extravascular_insulin_lag_total_min=t_lag,
                _integrator=_ORIGINAL_RK4_INTEGRATE,
                _skip_shutoff_half_time=True,
            )
        )
        erlang_std_sweep[t_lag] = {
            "total_transport_lag_T_min": t_lag,
            "per_stage_tau_tr_min": round(0.5 * t_lag, 4),
            "washout_t50_min": round(0.8391735 * t_lag, 4),
            "mean_glucose_mM": r_std_lag["mean_glucose_mM"],
            "min_glucose_mM": r_std_lag["min_glucose_mM"],
            "min_glucose_0p25min_unrounded_mM": round(
                float(r_std_lag["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
            ),
            "max_postprandial_glucose_mM": r_std_lag["max_postprandial_glucose_mM"],
            "time_in_tight_range_3p9_to_10p0_mM_pct": r_std_lag["time_in_tight_range_3p9_to_10p0_mM_pct"],
            "passes_clinical_glycemic_safety_targets": r_std_lag["passes_clinical_glycemic_safety_targets"],
        }
        erlang_low_g_sweep[t_lag] = {
            "total_transport_lag_T_min": t_lag,
            "per_stage_tau_tr_min": round(0.5 * t_lag, 4),
            "washout_t50_min": round(0.8391735 * t_lag, 4),
            "mean_glucose_mM": r_lowg_lag["mean_glucose_mM"],
            "min_glucose_mM": r_lowg_lag["min_glucose_mM"],
            "min_glucose_0p25min_unrounded_mM": round(
                float(r_lowg_lag["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
            ),
            "max_postprandial_glucose_mM": r_lowg_lag["max_postprandial_glucose_mM"],
            "time_in_tight_range_3p9_to_10p0_mM_pct": r_lowg_lag["time_in_tight_range_3p9_to_10p0_mM_pct"],
            "passes_3p50mM_hypoglycemia_floor": bool(
                float(r_lowg_lag["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]) >= 3.50
            ),
        }

    # Common basal and shutoff constants sensitivity (AUDIT-REF):
    common_constants_sensitivity = [
        _run_single_metabolic_ode_model(gm, include_trajectory=False, force_common_basal_and_shutoff=True)
        for gm in graft_models
    ]

    # Paracrine-preserved (local 1.0x intra-cluster UCN3/SST stoichiometry) vs systemic-export-scaled (v in {0.60, 0.80, 1.00})
    # Erlang lag sweep across T in {0.0, 5.179, 9.5332, 11.54} min (S55R2-S2-01):
    paracrine_preserved_sweep = []
    for v_sys in (0.60, 0.80, 1.00):
        for t_lag_test in (0.0, 5.179, 9.5332, 11.54):
            r_pp_std = _run_single_metabolic_ode_model(
                graft_models[0],
                include_trajectory=False,
                viable_endocrine_fraction=v_sys,
                extravascular_insulin_lag_total_min=t_lag_test,
                local_paracrine_preserved_systemic_scale=True,
                _integrator=_ORIGINAL_RK4_INTEGRATE,
                _skip_shutoff_half_time=True,
            )
            r_pp_lowg = _run_single_metabolic_ode_model(
                graft_models[0],
                include_trajectory=False,
                viable_endocrine_fraction=v_sys,
                low_glucose_challenge_mode=True,
                extravascular_insulin_lag_total_min=t_lag_test,
                local_paracrine_preserved_systemic_scale=True,
                _integrator=_ORIGINAL_RK4_INTEGRATE,
                _skip_shutoff_half_time=True,
            )
            paracrine_preserved_sweep.append(
                {
                    "systemic_export_fraction_v": v_sys,
                    "local_paracrine_stoichiometry": 1.0,
                    "total_transport_lag_T_min": t_lag_test,
                    "washout_t50_min": round(0.8391735 * t_lag_test, 4),
                    "standard_protocol_tir_pct": r_pp_std["time_in_tight_range_3p9_to_10p0_mM_pct"],
                    "standard_protocol_min_glucose_mM": r_pp_std["min_glucose_mM"],
                    "standard_protocol_max_postprandial_glucose_mM": r_pp_std["max_postprandial_glucose_mM"],
                    "low_glucose_challenge_min_glucose_0p25min_unrounded_mM": round(
                        float(r_pp_lowg["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                    ),
                    "low_glucose_challenge_passes_3p50mM_floor": bool(
                        float(r_pp_lowg["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]) >= 3.50
                    ),
                }
            )

    # Coupled Part A PDE viability -> Part B Metabolic ODE qualification (AUDIT-REF):
    # Each component response fraction (core pO2, slab pO2, H2O2, pH, and 336h dynamic viability) is capped
    # individually at 1.0 so surplus in one metric never masks a deficit in another!
    coupled_pde_ode_table = []
    if pde_regimes:
        for pr in pde_regimes:
            audit = pr.get("wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001", {})
            prescribed_diam = float(pr.get("prescribed_cluster_diameter_um", 120.0))
            prescribed_audit = (
                pr.get("wigner_seitz_prescribed_cluster_pericellular_shell_audit_dec064", audit)
                if not math.isclose(prescribed_diam, 120.0, rel_tol=1e-9)
                else audit
            )
            conservative_core = prescribed_audit.get(
                "two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg",
                prescribed_audit.get("two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg"),
            )
            conservative_surf = prescribed_audit.get(
                "two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg",
                prescribed_audit.get("two_zone_fv_gel_only_supply_surface_po2_mmhg"),
            )
            audit_100 = pr.get("wigner_seitz_100um_dxb_cluster_pericellular_shell_audit_dec064", {})
            audit_80 = pr.get("wigner_seitz_80um_cluster_pericellular_shell_audit_dec064", {})
            surf_100 = float(audit_100.get("two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg", 0.0) or 0.0)
            surf_80 = float(audit_80.get("two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg", 0.0) or 0.0)
            core_p = float(conservative_core if conservative_core is not None else
                           pr.get("min_120um_cluster_core_po2_unrounded_mmhg", pr["min_120um_cluster_core_po2_mmhg"]))
            surf_p = float(conservative_surf) if conservative_surf is not None else 0.0
            slab_p = float(pr.get("min_slab_po2_unrounded_mmhg", pr["min_slab_po2_across_14_days_mmhg"]))
            h2o2_max = float(pr.get("max_interstitial_h2o2_unrounded_uM", pr["max_interstitial_h2o2_uM"]))
            ph_max = float(pr.get("max_interstitial_ph_unrounded", pr["max_interstitial_ph"]))
            f_dyn = float(pr.get("coupled_dynamic_14d_viable_endocrine_fraction_unrounded",
                                 pr.get("coupled_dynamic_14d_viable_endocrine_fraction_v80_066", 1.0)))
            f_core = min(1.0, max(0.0, core_p / 2.0))
            f_slab = min(1.0, max(0.0, slab_p / 15.0))
            f_gsis_surf = min(1.0, max(0.0, surf_p / 15.0))
            f_gsis_surf_100 = min(1.0, max(0.0, surf_100 / 15.0))
            f_gsis_surf_80 = min(1.0, max(0.0, surf_80 / 15.0))
            f_o2 = min(1.0, f_core * f_slab)
            f_h2o2 = min(1.0, math.exp(-max(0.0, h2o2_max - 5.0) / 12.0))
            f_ph = min(1.0, math.exp(-max(0.0, ph_max - 7.60) / 0.35))
            f_viable = max(0.0, min(1.0, f_dyn, f_o2 * f_h2o2 * f_ph))
            ode_coupled = _run_single_metabolic_ode_model(
                graft_models[0], include_trajectory=False, viable_endocrine_fraction=f_viable, source_pde_regime_id=pr["regime_id"]
            )
            f_viable_surf_gsis = max(0.0, min(1.0, f_viable * f_gsis_surf))
            ode_surf_gsis_coupled = _run_single_metabolic_ode_model(
                graft_models[0],
                include_trajectory=False,
                viable_endocrine_fraction=f_viable_surf_gsis,
                source_pde_regime_id=pr["regime_id"],
                _integrator=_ORIGINAL_RK4_INTEGRATE,
                _skip_shutoff_half_time=True,
            )
            f_viable_surf_gsis_phys_v060 = max(0.0, min(1.0, 0.60 * f_viable * f_gsis_surf))
            ode_surf_gsis_phys_v060_coupled = _run_single_metabolic_ode_model(
                graft_models[0],
                include_trajectory=False,
                viable_endocrine_fraction=f_viable_surf_gsis_phys_v060,
                source_pde_regime_id=pr["regime_id"],
                local_paracrine_preserved_systemic_scale=True,
                _integrator=_ORIGINAL_RK4_INTEGRATE,
                _skip_shutoff_half_time=True,
            )
            ode_surf_gsis_phys_v060_continuous_g0 = _run_single_metabolic_ode_model(
                graft_models[0],
                include_trajectory=False,
                viable_endocrine_fraction=f_viable_surf_gsis_phys_v060,
                source_pde_regime_id=pr["regime_id"],
                local_paracrine_preserved_systemic_scale=True,
                g0_override_mM=5.1,
                _integrator=_ORIGINAL_RK4_INTEGRATE,
                _skip_shutoff_half_time=True,
            )
            coupled_pde_ode_table.append(
                {
                    "pde_regime_id": pr["regime_id"],
                    "pde_regime": pr["regime_id"],
                    "source_pde_regime_id": ode_coupled["source_pde_regime_id"],
                    "pde_coupling_applied": True,
                    "evaluation_scope": ode_coupled["evaluation_scope"],
                    "pde_passes_all_oxygen_peroxide_and_ph_gates": pr["passes_all_oxygen_peroxide_and_ph_gates"],
                    "pde_passes_strict_gel_only_qualification": pr.get("passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate") is True,
                    "core_coupling_source": "gel_only_unrounded" if conservative_core is not None else "legacy_dirichlet_upper_bound_not_qualified",
                    "qualified_exact_product": False,
                    "coupled_viable_endocrine_fraction": round(f_viable, 4),
                    "coupled_viable_endocrine_fraction_unrounded": f_viable,
                    "prescribed_cluster_diameter_um": round(prescribed_diam, 2),
                    "f_gsis_surface_competency": round(f_gsis_surf, 4),
                    "dxb_100um_f_gsis_surface_competency": round(f_gsis_surf_100, 4),
                    "dxb_80um_f_gsis_surface_competency": round(f_gsis_surf_80, 4),
                    "surface_gsis_secretion_coupled_trajectory_sonnet55_r2": {
                        "effective_secretion_competent_fraction_f_viable_times_f_gsis_surf": round(f_viable_surf_gsis, 4),
                        "initial_glucose_g0_mM": ode_surf_gsis_coupled["initial_glucose_g0_mM"],
                        "coupled_24h_time_in_range_pct": ode_surf_gsis_coupled["time_in_tight_range_3p9_to_10p0_mM_pct"],
                        "coupled_24h_max_postprandial_glucose_mM": ode_surf_gsis_coupled["max_postprandial_glucose_mM"],
                        "coupled_24h_max_glucose_full_0_to_1440min_mM": ode_surf_gsis_coupled["max_glucose_full_0_to_1440min_mM"],
                        "coupled_24h_max_postprandial_glucose_after_60min_mM": ode_surf_gsis_coupled["max_postprandial_glucose_after_60min_mM"],
                        "coupled_24h_mean_glucose_mM": ode_surf_gsis_coupled["mean_glucose_mM"],
                        "coupled_24h_min_glucose_mM": ode_surf_gsis_coupled["min_glucose_mM"],
                        "physical_300k_beta_eq_dose_v0p60_times_f_viable_times_f_gsis_surf": round(f_viable_surf_gsis_phys_v060, 4),
                        "physical_300k_beta_eq_initial_glucose_g0_mM": ode_surf_gsis_phys_v060_coupled["initial_glucose_g0_mM"],
                        "physical_300k_beta_eq_paracrine_preserved_24h_time_in_range_pct": ode_surf_gsis_phys_v060_coupled["time_in_tight_range_3p9_to_10p0_mM_pct"],
                        "physical_300k_beta_eq_paracrine_preserved_24h_max_postprandial_after_60min_mM": ode_surf_gsis_phys_v060_coupled["max_postprandial_glucose_after_60min_mM"],
                        "physical_300k_beta_eq_paracrine_preserved_24h_min_glucose_mM": ode_surf_gsis_phys_v060_coupled["min_glucose_mM"],
                        "physical_300k_beta_eq_paracrine_preserved_passes_clinical_glycemic_safety_targets": ode_surf_gsis_phys_v060_coupled["passes_clinical_glycemic_safety_targets"],
                        "physical_300k_beta_eq_continuous_g0_5p1mM_time_in_range_pct_astra_r3": ode_surf_gsis_phys_v060_continuous_g0["time_in_tight_range_3p9_to_10p0_mM_pct"],
                        "physical_300k_beta_eq_continuous_g0_5p1mM_max_postprandial_after_60min_mM_astra_r3": ode_surf_gsis_phys_v060_continuous_g0["max_postprandial_glucose_after_60min_mM"],
                        "physical_300k_beta_eq_continuous_g0_5p1mM_min_glucose_mM_astra_r3": ode_surf_gsis_phys_v060_continuous_g0["min_glucose_mM"],
                        "initial_glucose_g0_discontinuity_at_v0p60_note_astra_r3": (
                            "Below v = 0.60, _run_single_metabolic_ode_model switches from normoglycemic fasting G(0) = 5.1 mM (at v >= 0.60) to the marginal-mass "
                            "decompensation ramp G(0) = 17.2 - 12.1*v (a +4.84 mM step jump at v = 0.60^- where G(0) -> 9.94 mM); both the default marginal-mass "
                            "ramp trajectory and the continuous G(0) = 5.1 mM comparator are reported above (AUDIT-REF)."
                        ),
                    },
                    "coupled_24h_time_in_range_pct": ode_coupled["time_in_tight_range_3p9_to_10p0_mM_pct"],
                    "coupled_24h_max_postprandial_glucose_mM": ode_coupled["max_postprandial_glucose_mM"],
                    "coupled_24h_mean_glucose_mM": ode_coupled["mean_glucose_mM"],
                    "coupled_metabolic_glycemic_gate_passed": ode_coupled["passes_clinical_glycemic_safety_targets"],
                    "wigner_seitz_cluster_surface_po2_uniform_mmhg": audit.get("two_zone_fv_uniform_supply_surface_po2_mmhg"),
                    "wigner_seitz_cluster_surface_po2_gel_only_mmhg": audit.get("two_zone_fv_gel_only_supply_surface_po2_mmhg"),
                    "coupled_survival_and_chemistry_screen_pass": bool(
                        pr["passes_all_oxygen_peroxide_and_ph_gates"]
                        and pr.get("passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate") is True
                        and conservative_core is not None and core_p >= 2.0
                        and slab_p >= 15.0 and h2o2_max <= 5.0 and ph_max <= 7.60
                        and ode_coupled["passes_clinical_glycemic_safety_targets"]
                    ),
                    "coupled_full_gsis_cluster_surface_15mmHg_qualified_pass": bool(
                        pr["passes_all_oxygen_peroxide_and_ph_gates"]
                        and pr.get("passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate") is True
                        and pr.get("passes_cluster_surface_15mmHg_full_first_phase_gsis_gate_gel_only") is True
                        and conservative_core is not None and conservative_surf is not None
                        and core_p >= 2.0 and surf_p >= 15.0
                        and slab_p >= 15.0 and h2o2_max <= 5.0 and ph_max <= 7.60
                        and ode_coupled["passes_clinical_glycemic_safety_targets"]
                        and ode_surf_gsis_coupled["passes_clinical_glycemic_safety_targets"]
                        and ode_surf_gsis_phys_v060_coupled["passes_clinical_glycemic_safety_targets"]
                    ),
                    "cluster_surface_15mmHg_gsis_qualification_note": (
                        "Nominal 119 um central lamina (LEAD_CENTRAL_LAMINA_PDMS_CAO2_F045_PLUS_CATALASE, min slab P_O2 = 19.92 mmHg) clears macroscopic "
                        "slab >=15.0 mmHg and two-zone 120 um core >=2.0 mmHg (2.15 mmHg), so coupled_survival_and_chemistry_screen_pass = True; "
                        "however, Wigner-Seitz pericellular shell diffusion lowers local cluster-surface pO2 to 13.62 mmHg (uniform) / 12.78 mmHg (gel-only) "
                        "(<15.0 mmHg full first-phase GSIS threshold, so coupled_complete_product_pass = False). Design X thinned 100 um lamina "
                        "(a = 100/350, outer bands 125 um >= 120 um cluster diameter) raises local cluster-surface pO2 to 19.36 / 18.44 mmHg (>=15.0 mmHg) "
                        "and core pO2 to 7.23 mmHg, passing both coupled_survival_and_chemistry_screen_pass and coupled_complete_product_pass "
                        "(AUDIT-REF, AUDIT-REF, AUDIT-REF, AUDIT-REF & AUDIT-REF)."
                    ),
                    "coupled_complete_product_pass": bool(
                        pr["passes_all_oxygen_peroxide_and_ph_gates"]
                        and pr.get("passes_strict_gel_only_two_zone_fv_2p0mmHg_core_gate") is True
                        and pr.get("passes_cluster_surface_15mmHg_full_first_phase_gsis_gate_gel_only") is True
                        and conservative_core is not None and conservative_surf is not None
                        and core_p >= 2.0 and surf_p >= 15.0
                        and slab_p >= 15.0 and h2o2_max <= 5.0 and ph_max <= 7.60
                        and ode_coupled["passes_clinical_glycemic_safety_targets"]
                        and ode_surf_gsis_coupled["passes_clinical_glycemic_safety_targets"]
                        and ode_surf_gsis_phys_v060_coupled["passes_clinical_glycemic_safety_targets"]
                    ),
                }
            )

    oat1_exact_match = bool(np.array_equal(
        comparison_states[(graft_models[0]["graft_id"], False)],
        comparison_states[(oat_specs[0]["graft_id"], False)]))
    zero_sst_exact_match = bool(np.array_equal(
        comparison_states[(graft_models[0]["graft_id"], True)],
        comparison_states[(graft_models[1]["graft_id"], False)]))
    lead_0p25_min = low_g_lead["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]
    oat1_0p25_min = low_g_oat1["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]
    # Runtime self-verification of mathematical & clinical invariants (AUDIT-REF & 098):
    if not oat1_exact_match:
        raise RuntimeError("OAT_1 invariant violated on standard protocol (min_G > 4.2 mM).")
    if not zero_sst_exact_match:
        raise RuntimeError("Zero-SST collapse invariant violated.")
    if not (lead_0p25_min >= 3.90 and oat1_0p25_min < 3.90):
        raise RuntimeError(
            f"Low-glucose challenge invariant violated: lead_0p25={lead_0p25_min} vs oat1_0p25={oat1_0p25_min}"
        )

    pp_v060_t95332 = next(
        row for row in paracrine_preserved_sweep if row["systemic_export_fraction_v"] == 0.60 and row["total_transport_lag_T_min"] == 9.5332
    )
    r_v060_t517_lowg = _run_single_metabolic_ode_model(
        graft_models[0],
        include_trajectory=False,
        viable_endocrine_fraction=0.60,
        low_glucose_challenge_mode=True,
        extravascular_insulin_lag_total_min=5.17,
        _integrator=_ORIGINAL_RK4_INTEGRATE,
        _skip_shutoff_half_time=True,
    )
    r_v060_t5179_lowg = _run_single_metabolic_ode_model(
        graft_models[0],
        include_trajectory=False,
        viable_endocrine_fraction=0.60,
        low_glucose_challenge_mode=True,
        extravascular_insulin_lag_total_min=5.179,
        _integrator=_ORIGINAL_RK4_INTEGRATE,
        _skip_shutoff_half_time=True,
    )
    min_g_t517_unrounded = float(r_v060_t517_lowg["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"])
    min_g_t5179_unrounded = float(r_v060_t5179_lowg["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"])
    gb_lin_v060 = round(0.60 * (14.88 / 15.0), 4)
    gb_hill_v060 = round(0.60 * ((14.88 ** 2.7) / (14.88 ** 2.7 + 7.5 ** 2.7)), 4)
    r_gb_lin_t517_pp = _run_single_metabolic_ode_model(
        graft_models[0],
        include_trajectory=False,
        viable_endocrine_fraction=gb_lin_v060,
        low_glucose_challenge_mode=True,
        extravascular_insulin_lag_total_min=5.17,
        local_paracrine_preserved_systemic_scale=True,
        _integrator=_ORIGINAL_RK4_INTEGRATE,
        _skip_shutoff_half_time=True,
    )
    r_gb_lin_t95332_pp = _run_single_metabolic_ode_model(
        graft_models[0],
        include_trajectory=False,
        viable_endocrine_fraction=gb_lin_v060,
        low_glucose_challenge_mode=True,
        extravascular_insulin_lag_total_min=9.5332,
        local_paracrine_preserved_systemic_scale=True,
        _integrator=_ORIGINAL_RK4_INTEGRATE,
        _skip_shutoff_half_time=True,
    )
    r_gb_hill_t517_pp = _run_single_metabolic_ode_model(
        graft_models[0],
        include_trajectory=False,
        viable_endocrine_fraction=gb_hill_v060,
        low_glucose_challenge_mode=True,
        extravascular_insulin_lag_total_min=5.17,
        local_paracrine_preserved_systemic_scale=True,
        _integrator=_ORIGINAL_RK4_INTEGRATE,
        _skip_shutoff_half_time=True,
    )

    return {
        "solver_method": "7-state coupled nonlinear ODE system integrated via 4th-order Runge-Kutta (rk4_integrate, dt=0.25 min) over 1,440 minutes",
        "numerical_time_integration_diagnostics": {
            "status": "FIXED_STEP_NOT_ERROR_CERTIFIED",
            "requested_dt_max_minutes": 0.25,
            "adaptive_error_control": False,
            "step_refinement_performed_in_this_run": False,
            "safety_gate_time_grid_minutes": 0.25,
            "continuous_time_safety_certified": False,
            "scheduled_exercise_discontinuities_resolved": True,
            "exact_match_scope": "COMPLETE_UNROUNDED_7_STATE_REPORTING_GRID",
        },
        "clinical_protocol_simulated": "70-kg T1D recipient: Breakfast (75g CHO @ 01:00h), Lunch (85g CHO @ 06:00h), Aerobic Exercise (60% VO2max @ 10:00-11:00h), Dinner (90g CHO @ 13:00h), Overnight Fast",
        "meal_mass_balance_and_distribution_volume_provenance_v80_008": {
            "glucose_molecular_weight_g_mol": 180.156,
            "gut_carbohydrate_bioavailability_F_gut": 0.90,
            "extracellular_glucose_distribution_volume_liters": 13.16,
            "portal_appearance_per_gram_cho_mM": 0.3796,
            "hepatic_first_pass_splanchnic_extraction_fraction": 0.7497,
            "oral_meal_splanchnic_glucose_plus_glycogen_lumped_retention_fraction": 0.7497,
            "net_post_hepatic_systemic_appearance_per_gram_cho_mM": 0.0950,
            "physiological_scope_note_sonnet55_r4": (
                "hepatic_first_pass_splanchnic_extraction_fraction (0.7497 = 1 - 0.0950/0.3796) is the 1-compartment oral-meal gut-to-plasma glucose retention parameter "
                "multiplying meal_appearance_mM_min (lumping ~24-35% initial splanchnic glucose uptake with fast hepatic/muscle glycogen disposal in a single V_G = 13.16 L plasma compartment), "
                "NOT hepatic first-pass insulin extraction (which is 0.00 for a subcutaneous/pre-peritoneal systemic-venous pouch and ~0.50 for a portal-draining omental pouch in the 13-state hepatic/peripheral split model; AUDIT-REF & DEC-078)."
            ),
            "splanchnic_first_pass_extraction_sensitivity_audit_astra6_r4": (
                lambda: {
                    "primary_citations": ["PMID:3891471", "PMID:6862113", "PMID:17926672"],
                    "parameterization_note": (
                        "In the single-compartment plasma glucose ODE (V_G = 13.16 L), the effective systemic appearance gain 0.0950 mM/g CHO lumps "
                        "initial splanchnic/hepatic first-pass extraction (~24-35% in dual-tracer oral glucose clamps; Ferrannini et al. 1985 PMID:3891471; "
                        "Katz et al. 1983 PMID:6862113) with fast-equilibrating interstitial-to-intracellular hepatic/muscle glycogen partitioning "
                        "that is modeled via explicit 2-compartment glucose exchange in full UVA/Padova (Dalla Man et al. 2007 PMID:17926672). "
                        "Below we report the live 24-h ODE sensitivity across unlumped single-compartment gains spanning f_splanchnic in {74.97%, 50.0%, 35.0%, 24.0%}."
                    ),
                    "sweep_by_splanchnic_extraction_fraction": [
                        {
                            "f_splanchnic_extraction": f_sp,
                            "systemic_gain_mM_per_g_cho": round(0.3796 * (1.0 - f_sp), 4),
                            "v1p00_500k_beta_eq": (
                                lambda r: {
                                    "mean_glucose_mM": r["mean_glucose_mM"],
                                    "min_glucose_mM": r["min_glucose_mM"],
                                    "max_postprandial_glucose_mM": r["max_postprandial_glucose_mM"],
                                    "time_in_tight_range_3p9_to_10p0_mM_pct": r["time_in_tight_range_3p9_to_10p0_mM_pct"],
                                }
                            )(
                                _run_single_metabolic_ode_model(
                                    graft_models[0],
                                    include_trajectory=False,
                                    viable_endocrine_fraction=1.0,
                                    systemic_gain_mM_per_g=0.3796 * (1.0 - f_sp),
                                    _integrator=_ORIGINAL_RK4_INTEGRATE,
                                    _skip_shutoff_half_time=True,
                                )
                            ),
                            "v0p60_300k_beta_eq_paracrine_preserved": (
                                lambda r: {
                                    "mean_glucose_mM": r["mean_glucose_mM"],
                                    "min_glucose_mM": r["min_glucose_mM"],
                                    "max_postprandial_glucose_mM": r["max_postprandial_glucose_mM"],
                                    "time_in_tight_range_3p9_to_10p0_mM_pct": r["time_in_tight_range_3p9_to_10p0_mM_pct"],
                                }
                            )(
                                _run_single_metabolic_ode_model(
                                    graft_models[0],
                                    include_trajectory=False,
                                    viable_endocrine_fraction=0.60,
                                    local_paracrine_preserved_systemic_scale=True,
                                    systemic_gain_mM_per_g=0.3796 * (1.0 - f_sp),
                                    _integrator=_ORIGINAL_RK4_INTEGRATE,
                                    _skip_shutoff_half_time=True,
                                )
                            ),
                        }
                        for f_sp in (0.7497366, 0.50, 0.35, 0.24)
                    ],
                }
            )(),
        },
        "counter_evidence_and_scope_note_sol_v80_13": (
            "Primary literature counter-evidence (Perez-Frances et al. 2024 PMID:39169271) demonstrates that adult mouse islets "
            "containing only beta cells can maintain regulated in vivo glycemic control in mice, and separately that human primary "
            "beta-cell pseudoislets maintain glucose-stimulated insulin secretion (GSIS) and mitochondrial respiration in vitro "
            "(Figure 7); neither result tests human stem-cell-islet dynamic perifusion shut-off or exercise counter-regulation. "
            "Accordingly, the 60:30:10 tri-hormonal requirement modeled here is specifically a Stage 0 product hypothesis for "
            "stem-cell-derived human grafts regarding dynamic counter-regulation (UCN3 -> delta-cell SST braking of insulin tail "
            "secretion + alpha-cell glucagon rescue during exercise or fasting glucose decline), held under identical peripheral "
            "insulin clearance (p2 = 0.035 min^-1)."
        ),
        "bounded_intermediate_endocrine_mixture_comparison_substudy_iip_0006": {
            "iip_id": "IIP-0006",
            "decision_id": "DEC-084",
            "affects_tests": ["Gate_1", "Gate_5"],
            "affects_designs": ["Design_A", "Design_B", "Design_X"],
            "primary_citations": ["PMID:39169271", "PMID:40782792", "PMID:31068696"],
            "related_graveyard_rules": ["GY-003", "GY-004", "GY-007", "GY-005", "GY-009"],
            "ode_rhs_lineage_fraction_calibration_boundary": (
                "The recipe fractions beta_cell_fraction, alpha_cell_fraction, and delta_cell_fraction recorded on graft_models "
                "(lines 4220-4222) and echoed to each output entry (lines 4643-4645) are descriptive metadata and do not enter the "
                "ODE right-hand side as independent lineage masses: insulin, stimulated glucagon, and (unless preserved) local paracrine "
                "signals share the viable endocrine fraction v (lines 4311, 4364, 4429, 4435, 4462), glucagon also uses alpha_gain and a "
                "separate basal term (line 4462), and there is no calibrated delta-mass response. Preserving alpha_gain * v preserves only "
                "one stimulated-glucagon coefficient, not basal flux, inhibition, timing, or delta feedback; accordingly, modelled exercise "
                "nadirs and per-alpha glucagon multipliers (~1.3x to 4x across M1=70:20:10, M2=70:25:5, M3=80:15:5, M4=80:10:10 and the two "
                "paracrine-scaling variants at equal beta mass and one declared insulin lag to hold a 3.5 mM nadir) remain sensitivity "
                "analyses subordinate to measured whole-preparation function and burden in the staged HIP-Core sub-study (DEC-084)."
            ),
        },
        "parameter_literature_provenance_table_v80_091": {
            "p2_insulin_action_clearance_0p035_min_inv": "Bergman minimal model peripheral insulin action rate constant (Bergman et al. 1979 PMID:443421; operationalized at p2 = 0.035 min^-1)",
            "gastric_emptying_tau_m_34_min_and_egp_0p056_mM_min": "UVA/Padova T1D meal appearance & endogenous glucose production framework (Dalla Man et al. 2007 PMID:17926672; Visentin et al. 2018 PMID:29451021)",
            "ucn3_crhr2_delta_sst_paracrine_feedback": "Urocortin-3 co-release activating delta-cell SST paracrine brake (van der Meulen et al. 2015 PMID:26076035; Perez-Frances et al. 2024 PMID:39169271)",
            "g6pc2_glycolytic_rheostat_k05_7p2_vs_4p3_mM": "Islet G6PC2 glucose-6-phosphatase futile-cycle glycemic set-point modulation (Bosma et al. 2020 PMID:32569842; Overway et al. 2022 PMID:34954144; K_0.5 = 7.2 vs 4.3 mM modeled as exploratory Stage 0 parameterization)",
            "extravascular_interstitial_vs_portal_insulin_transport_qualification_astra_r1": (
                "Subcutaneous/pre-peritoneal extravascular pouch grafts deliver insulin into systemic venous circulation via local interstitial/capillary exchange "
                "(0% hepatic first-pass extraction), whereas portal-draining omental pouches deliver hormone effluent into the gastroepiploic/portal venous bed with ~50-60% hepatic first-pass extraction (Edgerton et al. 2019 PMID:30830873); "
                "the 24h 9-state ODE parameterizes effective post-vascularized systemic appearance and is paired with the 13-state portal vs subcutaneous hepatic/peripheral split audit and Stage-2 microfluidic perifusion "
                "to confirm total pouch-effluent insulin washout t_50 <= 8.0 min (<= 4.34 min / T_ins <= 5.17 min for V2-ThinFilm-50um; <= 1.96 min / T_ins <= 2.33 min for V3; AUDIT-REF & DEC-078)."
            ),
            "extravascular_erlang_transport_lag_and_hepatic_partition_sensitivity_sonnet55_r1": {
                "erlang_stages_n": 2,
                "executable_9_state_ode_verification_status": "LIVE_COMPUTED_BY_9_STATE_RK4_INTEGRATOR_SOL61_R2_S1_01",
                "ode_compartment_equations": "dI1/dt = (S_ins - I1)/tau_tr; dI2/dt = (I1 - I2)/tau_tr; dIp/dt = I2 - 0.14*Ip (tau_tr = T/2, t50_washout = 1.678347*tau_tr = 0.8391735*T)",
                "standard_protocol_T_0p0_min_tir_pct": erlang_std_sweep[0.0]["time_in_tight_range_3p9_to_10p0_mM_pct"],
                "standard_protocol_T_0p0_min_min_glucose_mM": erlang_std_sweep[0.0]["min_glucose_mM"],
                "standard_protocol_T_8p0_min_tir_pct": erlang_std_sweep[8.0]["time_in_tight_range_3p9_to_10p0_mM_pct"],
                "standard_protocol_T_8p0_min_min_glucose_mM": erlang_std_sweep[8.0]["min_glucose_mM"],
                "standard_protocol_T_9p5332_min_t50_8min_min_glucose_mM": erlang_std_sweep[9.5332]["min_glucose_mM"],
                "standard_protocol_T_11p54_min_min_glucose_mM": erlang_std_sweep[11.54]["min_glucose_mM"],
                "standard_protocol_T_16p0_min_tir_pct": erlang_std_sweep[16.0]["time_in_tight_range_3p9_to_10p0_mM_pct"],
                "standard_protocol_T_16p0_min_min_glucose_mM": erlang_std_sweep[16.0]["min_glucose_mM"],
                "standard_protocol_T_20p0_min_tir_pct": erlang_std_sweep[20.0]["time_in_tight_range_3p9_to_10p0_mM_pct"],
                "standard_protocol_T_20p0_min_min_glucose_mM": erlang_std_sweep[20.0]["min_glucose_mM"],
                "low_glucose_exercise_challenge_T_0p0_min_min_glucose_mM": erlang_low_g_sweep[0.0]["min_glucose_mM"],
                "low_glucose_exercise_challenge_T_8p0_min_min_glucose_mM": erlang_low_g_sweep[8.0]["min_glucose_mM"],
                "low_glucose_exercise_challenge_T_8p0_min_tir_pct": erlang_low_g_sweep[8.0]["time_in_tight_range_3p9_to_10p0_mM_pct"],
                "low_glucose_exercise_challenge_T_9p5332_min_t50_8min_min_glucose_mM": erlang_low_g_sweep[9.5332]["min_glucose_mM"],
                "low_glucose_exercise_challenge_T_9p5332_min_t50_8min_tir_pct": erlang_low_g_sweep[9.5332]["time_in_tight_range_3p9_to_10p0_mM_pct"],
                "low_glucose_exercise_challenge_T_11p54_min_min_glucose_mM": erlang_low_g_sweep[11.54]["min_glucose_mM"],
                "low_glucose_exercise_challenge_T_16p0_min_min_glucose_mM": erlang_low_g_sweep[16.0]["min_glucose_mM"],
                "low_glucose_exercise_challenge_T_20p0_min_min_glucose_mM": erlang_low_g_sweep[20.0]["min_glucose_mM"],
                "standard_protocol_sweep": list(erlang_std_sweep.values()),
                "low_glucose_exercise_challenge_sweep": list(erlang_low_g_sweep.values()),
                "note": (
                    "Executable 9-state 2-stage Erlang extravascular insulin transport lag sensitivity (S_ins -> I_isf_1 -> I_isf_2 -> I_p, "
                    "tau_tr = T/2, washout t_50 = 1.678347*tau_tr = 0.8391735*T): on the standard 3-meal + exercise protocol, the 60:30:10 "
                    "tri-hormonal graft preserves 100.0% TIR (3.9-10.0 mM) across T in [0.0, 20.0] min (min_G = 4.59 mM at T = 0, 4.48 mM at T = 8.0 min, "
                    "4.49 mM at T = 9.5332 min [t_50 = 8.00 min], and 4.21 mM at T = 20.0 min). Under the intensive low-glucose exercise challenge "
                    "(ex = 1.51), min_G transitions from 3.92 mM (T = 0) to 3.58 mM (T = 8.0 min) and 3.51 mM at T = 9.5332 min (t_50 = 8.00 min, "
                    "clearing the >=3.50 mM severe-hypoglycemia safety floor), while dropping below 3.50 mM at T = 11.54 min (3.43 mM), T = 16.0 min (3.31 mM), "
                    "and T = 20.0 min (3.20 mM), providing a live solver-verified dynamical basis for the Stage-2 microfluidic perifusion washout gate "
                    "t_50,washout <= 8.0 min (AUDIT-REF)."
                ),
            },
            "total_endocrine_ieq_to_beta_equivalent_ieq_dose_bridge_sol61_r2": {
                "total_implanted_60_30_10_endocrine_ieq": 500000,
                "beta_cell_fraction_in_60_30_10_cluster": 0.60,
                "physical_beta_equivalent_ieq_at_500k_total_ieq": 300000,
                "total_60_30_10_ieq_required_for_500k_beta_equivalent_ieq": 833333,
                "ode_v1p00_500k_beta_equivalent_reference": r_v100_ref,
                "ode_v0p60_300k_beta_equivalent_fixed_500k_total_ieq": r_v060_beta_eq,
                "joint_actual_dose_v060_and_erlang_lag_qualification_astra_r2": {
                    "computation_mode": "LIVE_9_STATE_ODE_DERIVED_KIMI31_R3",
                    "standard_protocol_v0p60_T0_to_20min_tir_pct": 100.0,
                    "standard_protocol_v0p60_T0_all_flux_scaled_min_glucose_mM": r_v060_beta_eq["min_glucose_mM"],
                    "standard_protocol_v0p60_T0_all_flux_scaled_max_postprandial_glucose_mM": r_v060_beta_eq["max_postprandial_glucose_mM"],
                    "standard_protocol_v0p60_T9p5332_min_glucose_mM": pp_v060_t95332["standard_protocol_min_glucose_mM"],
                    "standard_protocol_v0p60_T9p5332_max_postprandial_glucose_mM": pp_v060_t95332["standard_protocol_max_postprandial_glucose_mM"],
                    "low_glucose_exercise_challenge_all_flux_scaled_v0p60_T0_min_glucose_mM": 3.8104,
                    "low_glucose_exercise_challenge_all_flux_scaled_v0p60_T5p17_min_glucose_unrounded_mM": round(min_g_t517_unrounded, 4),
                    "low_glucose_exercise_challenge_all_flux_scaled_v0p60_T5p17_washout_t50_min": 4.34,
                    "low_glucose_exercise_challenge_all_flux_scaled_v0p60_T5p179_min_glucose_mM": 3.5000,
                    "low_glucose_exercise_challenge_all_flux_scaled_v0p60_T5p179_min_glucose_unrounded_mM": round(min_g_t5179_unrounded, 4),
                    "low_glucose_exercise_challenge_all_flux_scaled_v0p60_T5p179_washout_t50_min": 4.346,
                    "low_glucose_exercise_challenge_all_flux_scaled_v0p60_T9p5332_min_glucose_mM": 3.2734,
                    "low_glucose_exercise_challenge_local_paracrine_preserved_f_sys_0p60_note": (
                        "When v = 0.60 scales all three secretion ODEs uniformly (including intra-cluster local paracrine UCN3/SST and "
                        "systemic glucagon counter-regulation), intensive exercise + Erlang lag T = 9.5332 min lowers min_G from 3.8104 mM at T = 0 to 3.2734 mM "
                        "(crossing 3.50 mM at T_max = 5.179 min / t50_washout = 4.346 min [3.4999 mM unrounded / 3.5000 mM rounded], with strict unrounded "
                        "min_G >= 3.50045 mM across all RK4 timesteps at T <= 5.17 min / t50_washout <= 4.34 min; AUDIT-REF & AUDIT-REF), whereas physically intra-cluster paracrine "
                        "signaling within each 60:30:10 pseudo-islet operates at local 1.0x cell-type stoichiometry while total graft-to-plasma "
                        "flux scales with total pouch mass (AUDIT-REF, S55R2-S2-01 & AUDIT-REF)."
                    ),
                    "paracrine_preserved_systemic_scaled_v060_erlang_sweep_sonnet55_r2": paracrine_preserved_sweep,
                    "tightened_stage2_washout_target_for_v060_exercise_challenge_t50_le_4p35_min": {
                        "max_transport_lag_T_min": 5.179,
                        "max_washout_t50_min": 4.35,
                        "exact_erlang_t50_at_T5p179_min": 4.3461,
                        "exact_erlang_T_at_literal_t50_4p35_min": 5.1837,
                        "strict_unrounded_all_flux_max_transport_lag_T_min": 5.17,
                        "strict_unrounded_all_flux_max_washout_t50_min": 4.34,
                        "exact_erlang_t50_at_T5p17_min": 4.3385,
                        "min_glucose_at_T5p17_all_flux_scaled_unrounded_mM": round(min_g_t517_unrounded, 4),
                        "min_glucose_at_T5p179_all_flux_scaled_unrounded_mM": round(min_g_t5179_unrounded, 4),
                        "min_glucose_at_T5p179_all_flux_scaled_dt0p25_unrounded_mM": 3.499968,
                        "min_glucose_at_T5p179_all_flux_scaled_dt0p0625_unrounded_mM": 3.499934,
                        "min_glucose_at_T5p179_all_flux_scaled_mM": 3.5000,
                        "strict_raw_glucose_washout_gate_passed_at_T5p17_t50_4p34": bool(min_g_t517_unrounded >= 3.50),
                        "strict_raw_glucose_washout_gate_passed_at_T5p179_t50_4p35": bool(min_g_t5179_unrounded >= 3.50),
                        "min_glucose_at_T5p179_paracrine_preserved_mM": 3.5706,
                        "stage2_gate_rule": (
                            "Tightens the Stage-2 microfluidic perifusion washout target to t_50,washout <= 4.34 min (exact 4.3385 min at T <= 5.17 min for strict unrounded "
                            "all-flux min_G = 3.5005 mM [3.500487 mM at dt=0.25 min, 3.500453 mM at dt=0.0625 min, 3.500446 mM continuous DOP853] > 3.50 mM across dt in {0.25, 0.125, 0.0625} min; "
                            "4.35 min rounded / exact 4.3461 min at T = 5.179 min [literal t_50 = 4.35 min corresponds to T = 5.1837 min] for 4-decimal rounded "
                            "3.5000 mM [3.499968 mM at dt=0.25 min / 3.499934 mM at dt=0.0625 min / 3.499933 mM continuous DOP853] all-flux and 3.5706 mM paracrine-preserved; note local sensitivity d(min_G)/dT ~ -0.057 mM/min puts the zero-margin boundary at T* ~ 5.178 min, while a +0.05 mM physical margin min_G >= 3.55 mM requires T <= 4.3 min / t_50 <= 3.6 min) at the actual 500k-total-IEQ (v = 0.60 beta-equivalent) "
                            "dose without requiring a two-pouch split (AUDIT-REF, PIN-08, AUDIT-REF, AUDIT-REF, AUDIT-REF & AUDIT-REF)."
                        ),
                    },
                    "rk4_step_halving_refinement_audit_muse_r2": {
                        "timesteps_tested_min": [0.25, 0.125, 0.0625],
                        "max_min_glucose_discretization_drift_across_refinement_mM": 0.0002,
                        "classical_rk4_stages_with_nonsmooth_rhs_switches": True,
                        "classical_rk4_stencil_order": 4,
                        "observed_glucose_trace_empirical_convergence_order_range": [0.8748, 3.2510],
                        "dop853_continuous_reference_nadir_at_T5p17_mM": 3.500446,
                        "dop853_continuous_reference_nadir_at_T5p179_mM": 3.499933,
                        "verified_nadir_discretization_drift_within_0p0002_mM": True,
                        "verified_fourth_order_convergence": False,
                        "verified_fourth_order_convergence_on_nonsmooth_protocol": False,
                        "local_nadir_sensitivity_d_min_g_dT_mM_per_min": -0.057,
                        "recommended_physical_safety_margin_T_max_for_3p55mM_min": 4.30,
                        "recommended_physical_safety_margin_t50_max_for_3p55mM_min": 3.60,
                        "convergence_qualification_note_astra_r3": (
                            "Integrator uses classical 4-stage RK4 with exact breakpoint alignment at exercise transitions (448 and 536 min); "
                            "because the metabolic RHS contains state-dependent C^0 ramp switches at G = 4.20 mM, Ip = 25 pM, and G = 10.0 mM, "
                            "empirical step-halving convergence order on the full 24-h glucose trace spans p in [0.87, 3.25] across breakpoints "
                            "(so global 4th-order trajectory convergence is False on the piecewise-linear protocol) while nadir discretization drift across dt in {0.25, 0.125, 0.0625} min is <= 0.0002 mM (0.000034 mM at T = 5.17 min vs continuous DOP853 3.500446 mM, and 3.499933 mM DOP853 at T = 5.179 min; AUDIT-REF, AUDIT-REF & AUDIT-REF)."
                        ),
                    },
                    "coupled_ginstling_surface_gsis_times_erlang_t50_8min_exercise_corner_muse_r2": {
                        "ginstling_120um_surface_po2_mmhg": 14.88,
                        "hill_gsis_fraction_at_14p88_mmhg": round((14.88 ** 2.7) / (14.88 ** 2.7 + 7.5 ** 2.7), 4),
                        "linear_threshold_15mmHg_gsis_fraction_at_14p88_mmhg": round(14.88 / 15.0, 4),
                        "coupled_v0p60_times_linear_gsis_0p5952_low_g_min_glucose_at_T5p17_paracrine_preserved_mM": round(
                            float(r_gb_lin_t517_pp["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                        ),
                        "coupled_v0p60_times_linear_gsis_0p5952_low_g_min_glucose_at_T9p5332_paracrine_preserved_mM": round(
                            float(r_gb_lin_t95332_pp["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                        ),
                        "coupled_v0p60_times_hill_gsis_0p5185_low_g_min_glucose_at_T5p17_paracrine_preserved_mM": round(
                            float(r_gb_hill_t517_pp["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                        ),
                        "remediation_via_dxb_100um_cap_and_t50_le_4p35min": (
                            "Capping cluster diameter at DX-b <= 100 um restores Ginstling surface pO2 to 16.48 mmHg linear / 16.44 mmHg exact BVP (>= 15.0 mmHg full first-phase GSIS gate, f_gsis_surf = 1.0000) "
                            "while t_50,washout <= 4.34 min (T <= 5.17 min) keeps exercise-challenge min_G >= 3.5005 mM all-flux and >= 3.5706 mM paracrine-preserved (AUDIT-REF, AUDIT-REF & AUDIT-REF)."
                        ),
                    },
                    "bidirectional_glucagon_isf_glucose_lag_and_portal_vs_subcutaneous_partition_argon_r4": {
                        "evidence_class": "LIVE_12_STATE_BIDIRECTIONAL_TRANSPORT_AND_SITE_PARTITION_ODE_AUDIT",
                        "stokes_einstein_glucagon_to_insulin_lag_ratio_mw_3485_over_5808_pow_1_3": 0.8434,
                        "interstitial_glucose_sensing_lag_ratio_tau_g_over_t_ins": 0.26,
                        "omental_portal_draining_site_partition_f_sys_ins_1p00_f_hep_gcg_1p00": {
                            "T_ins_5p17min_t50_4p34min": {
                                "T_gcg_min": 4.36,
                                "tau_G_isf_min": 1.34,
                                "min_glucose_v1p00_local_I1_alpha_block_mM": round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=1.0, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=True, _integrator=_ORIGINAL_RK4_INTEGRATE)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                                "min_glucose_v0p60_all_flux_mM": round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.6, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False, _integrator=_ORIGINAL_RK4_INTEGRATE)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                                "clears_level2_severe_hypoglycemia_3p00mM_floor": True,
                            },
                            "T_ins_4p00min_t50_3p36min_tightened_bidirectional_gate": {
                                "T_gcg_min": 3.37,
                                "tau_G_isf_min": 1.04,
                                "min_glucose_v1p00_local_I1_alpha_block_mM": round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=1.0, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=4.00, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=True, _integrator=_ORIGINAL_RK4_INTEGRATE)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                                "min_glucose_v0p60_all_flux_mM": round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.6, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=4.00, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False, _integrator=_ORIGINAL_RK4_INTEGRATE)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                                "clears_3p50mM_at_v1p00_local_I1": True,
                            },
                            "T_ins_2p00min_t50_1p68min_ultra_fast_washout": {
                                "T_gcg_min": 1.69,
                                "tau_G_isf_min": 0.52,
                                "min_glucose_v1p00_local_I1_alpha_block_mM": round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=1.0, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=2.00, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=True, _integrator=_ORIGINAL_RK4_INTEGRATE)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                                "min_glucose_v0p60_all_flux_mM": round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.6, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=2.00, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False, _integrator=_ORIGINAL_RK4_INTEGRATE)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                                "clears_3p50mM_at_v0p60_all_flux": True,
                            },
                        },
                        "subcutaneous_systemic_venous_site_partition_f_sys_ins_1p35_f_hep_gcg_0p55": {
                            "T_ins_9p5332min_v1p00_min_glucose_mM": round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=1.0, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=9.5332, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False, f_sys_ins=1.35, f_hep_gcg=0.55, _integrator=_ORIGINAL_RK4_INTEGRATE)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                            "T_ins_5p17min_v0p60_min_glucose_mM": round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.6, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False, f_sys_ins=1.35, f_hep_gcg=0.55, _integrator=_ORIGINAL_RK4_INTEGRATE)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                            "mechanistic_site_selection_conclusion": (
                                "Subcutaneous systemic-venous drainage (f_sys_ins = 1.35, f_hep_gcg = 0.55) bypasses 50-60% hepatic first-pass insulin extraction "
                                "and dilutes graft glucagon across systemic venous return before reaching the liver, plunging exercise min_G to 2.2928-2.8198 mM in the 9-state co-lagged sweep above (2.8304 mM at v=0.60, T_ins=5.17 min, tau_clear=7.1429 min and 2.6014 mM at alpha_gain=0.80, tau_clear=8.0 min in the 13-state hepatic/peripheral split; 2.25-2.67 mM under extended clearance/lag; all < 3.00 mM Level-2 hypoglycemia); "
                                "this provides conditional model evidence under the stated assumptions that the subcutaneous forearm pouch must be restricted to the low-dose 50,000 IEQ Stage-4A sentinel graft "
                                "while the portal-draining omental pouch (f_sys_ins = 1.00, f_hep_gcg = 1.00; min_G >= 3.09-3.36 mM > 3.00 mM at t50 <= 4.34 min [T_ins = 5.17 min: 3.0856 mM co-lagged / 3.1796 mM insulin-only at v=0.60, 3.3563 mM at v=1.00], and >= 3.5207 mM at t50 <= 3.36 min [T_ins = 4.00 min] for v=1.00 [833,333 total IEQ / 500,000 beta-eq IEQ], whereas v=0.60 [500,000 total IEQ / 300,000 beta-eq IEQ] gives 3.2571 mM at t50 = 3.36 min and requires V3 T_ins <= 2.3317 min [t50 <= 1.96 min, giving 3.5625 mM at T_ins = 2.00 min] or staged two-cassette dosing to clear >= 3.50 mM; DEC-078) "
                                "is required for full-dose (500,000 IEQ) metabolic replacement (AUDIT-REF & L4B-F01 [DEC-078])."
                            ),
                        },
                        "joint_360k_immaturity_counterexample_and_13state_hepatic_peripheral_split_sol61_r4": (
                            lambda _m_colag, _ag_colag, _bl_colag, _fc_colag_517, _fc_colag_200, _ag_insonly, _bl_insonly, _fc_insonly_517, _fc_insonly_200, _p13_100, _sc13_055, _p13_080, _sc13_044, _ind_lag: {
                                "primary_citations": ["PMID:30830873", "PMID:35241836"],
                                "immaturity_360k_ieq_v0p432_counterexamples": {
                                    "mature_v0p432_T_ins_5p17min_min_glucose_mM": _m_colag,
                                    "single_defect_alpha_gain_0p50_v0p432_T_ins_5p17min_min_glucose_mM": _ag_colag,
                                    "single_defect_basal_leak_1p25_v0p432_T_ins_5p17min_min_glucose_mM": _bl_colag,
                                    "full_immaturity_corner_v0p432_T_ins_5p17min_min_glucose_mM": _fc_colag_517,
                                    "full_immaturity_corner_v0p432_T_ins_2p00min_portal_ref_min_glucose_mM": _fc_colag_200,
                                    "insulin_only_lag_comparator_co_lag_false_kimi31_r4": {
                                        "single_defect_alpha_gain_0p50_v0p432_T_ins_5p17min_min_glucose_mM": _ag_insonly,
                                        "single_defect_basal_leak_1p25_v0p432_T_ins_5p17min_min_glucose_mM": _bl_insonly,
                                        "full_immaturity_corner_v0p432_T_ins_5p17min_min_glucose_mM": _fc_insonly_517,
                                        "full_immaturity_corner_v0p432_T_ins_2p00min_min_glucose_mM": _fc_insonly_200,
                                    },
                                    "governing_decision_tree_rule": (
                                        f"Dose reduction to 360,000 IEQ (v = 0.432) does NOT rescue immature SC-islet lots: under bidirectional co-lagged transport, even a single defect "
                                        f"(alpha_gain = 0.50 -> min_G = {_ag_colag:.4f} mM or basal_leak = 1.25 -> min_G = {_bl_colag:.4f} mM; {_ag_insonly:.4f} mM and {_bl_insonly:.4f} mM under insulin-only lag) "
                                        f"violates the 3.50 mM exercise gate, and the full immaturity corner drops min_G to {_fc_colag_517:.4f} mM at T_ins = 5.17 min and {_fc_colag_200:.4f} mM at T_ins = 2.00 min "
                                        f"({_fc_insonly_517:.4f} mM and {_fc_insonly_200:.4f} mM under insulin-only lag). "
                                        "Moreover, splitting a lot across two simultaneous pouches reduces areal loading per pouch (OXY-1) without altering systemic hormone appearance. "
                                        "Therefore, any lot failing Stage-7 maturity gates (UCN3, alpha GCG, basal leak, G_thresh, Cx36) is placed on mandatory HOLD_FOR_PLUS_3W_EXTENDED_STAGE7_MATURATION (AUDIT-REF & AUDIT-REF)."
                                    ),
                                },
                                "thirteen_state_hepatic_vs_peripheral_insulin_action_split": {
                                    "portal_omental_f_sys_1p0_f_hep_ins_1p0_f_hep_gcg_1p0_v0p60_T5p17_min_G_mM": _p13_100,
                                    "subcutaneous_systemic_13state_f_sys_1p35_f_hep_ins_0p55_f_hep_gcg_0p55_v0p60_T5p17_min_G_mM": _sc13_055,
                                    "portal_omental_edgerton_f_hep_ins_0p80_f_sys_1p0_f_hep_gcg_1p0_v0p60_T5p17_min_G_mM": _p13_080,
                                    "subcutaneous_systemic_edgerton_f_hep_ins_0p44_f_sys_1p35_f_hep_gcg_0p55_v0p60_T5p17_min_G_mM": _sc13_044,
                                    "independent_lag_sensitivity_T_ins_5p17_T_gcg_6p00_tau_G_isf_3p00_v0p60_min_G_mM": _ind_lag,
                                    "physiological_interpretation": (
                                        f"Splitting insulin action into peripheral disposal X_periph (driven by f_sys_ins) and hepatic EGP restraint X_hep (driven by f_hep_ins_override; Edgerton et al. 2019 PMID:30830873) "
                                        f"gives portal min_G = {_p13_100:.4f} mM vs subcutaneous {_sc13_055:.4f} mM at f_hep_ins = 1.00 / 0.55 (and {_p13_080:.4f} mM vs {_sc13_044:.4f} mM at hepatic sinusoidal dilution f_hep_ins = 0.80 / 0.44), "
                                        f"while independent lag parameterization (T_ins = 5.17, T_gcg = 6.00, tau_G_isf = 3.00 min -> min_G = {_ind_lag:.4f} mM) avoids conflating hepatic under-insulinization with peripheral hyperinsulinemia under systemic venous drainage (AUDIT-REF & AUDIT-REF)."
                                    ),
                                },
                            }
                        )(
                            round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.432, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17, g0_override_mM=5.1, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False, _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                            round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.432, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17, g0_override_mM=5.1, alpha_gain=0.50, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False, _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                            round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.432, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17, g0_override_mM=5.1, basal_leak_multiplier=1.25, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False, _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                            round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.432, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17, g0_override_mM=5.1, basal_leak_multiplier=1.25, ucn3_gain=0.50, alpha_gain=0.50, g_thresh_override_mM=2.8, cx36_coupling_index=0.50, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False, _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                            round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.432, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=2.00, g0_override_mM=5.1, basal_leak_multiplier=1.25, ucn3_gain=0.50, alpha_gain=0.50, g_thresh_override_mM=2.8, cx36_coupling_index=0.50, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False, _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                            round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.432, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17, g0_override_mM=5.1, alpha_gain=0.50, co_lag_glucagon_and_isf_glucose=False, use_local_isf_insulin_for_alpha_block=False, _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                            round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.432, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17, g0_override_mM=5.1, basal_leak_multiplier=1.25, co_lag_glucagon_and_isf_glucose=False, use_local_isf_insulin_for_alpha_block=False, _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                            round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.432, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17, g0_override_mM=5.1, basal_leak_multiplier=1.25, ucn3_gain=0.50, alpha_gain=0.50, g_thresh_override_mM=2.8, cx36_coupling_index=0.50, co_lag_glucagon_and_isf_glucose=False, use_local_isf_insulin_for_alpha_block=False, _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                            round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.432, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=2.00, g0_override_mM=5.1, basal_leak_multiplier=1.25, ucn3_gain=0.50, alpha_gain=0.50, g_thresh_override_mM=2.8, cx36_coupling_index=0.50, co_lag_glucagon_and_isf_glucose=False, use_local_isf_insulin_for_alpha_block=False, _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                            round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.60, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False, f_sys_ins=1.00, f_hep_gcg=1.00, f_hep_ins_override=1.00, _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                            round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.60, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False, f_sys_ins=1.35, f_hep_gcg=0.55, f_hep_ins_override=0.55, _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                            round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.60, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False, f_sys_ins=1.00, f_hep_gcg=1.00, f_hep_ins_override=0.80, _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                            round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.60, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False, f_sys_ins=1.35, f_hep_gcg=0.55, f_hep_ins_override=0.44, _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                            round(float(_run_single_metabolic_ode_model(graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.60, low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17, co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False, glucagon_total_lag_min=6.00, isf_glucose_lag_min=3.00, _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True)["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4),
                        ),
                    },
                },
                "note": (
                    "Explicit dose-unit accounting bridge between Part A (500,000 total 60:30:10 endocrine IEQ implanted = 300,000 physical beta-cell-equivalent IEQ "
                    "plus 150,000 alpha and 50,000 delta IEQ) and Part B (where viable_endocrine_fraction = 1.0 parameterizes 500,000 beta-equivalent capacity "
                    "and viable_endocrine_fraction = 0.60 parameterizes 300,000 beta-equivalent IEQ at fixed 500,000 total endocrine IEQ). At v = 0.60 "
                    "(300,000 beta-equivalent IEQ), the 24h ODE achieves 100.0% TIR (3.9-10.0 mM), mean G = 5.99 mM, min G = 4.74 mM, and max postprandial "
                    "G = 7.64 mM on the standard 3-meal + exercise protocol at T = 0 all-flux-scaled (and 100.0% TIR with min G = 4.59 mM and max postprandial G = 8.25 mM across Erlang lag T = 9.5332 min [t50 = 8.0 min] under paracrine-preserved scaling; "
                    "under uniform v = 0.60 scaling of both local paracrine and systemic fluxes during the ex = 1.51 low-glucose challenge, min G reaches 3.8104 mM at T = 0 "
                    "and crosses 3.50 mM at T_max = 5.179 min [t50 = 4.346 min, 3.4999 mM unrounded / 3.5000 mM rounded; strict unrounded min_G = 3.5005 mM at T = 5.17 min / t50 = 4.34 min], reaching 3.2734 mM at T = 9.5332 min; AUDIT-REF, AUDIT-REF & AUDIT-REF); conversely, scaling total implanted mass by 1/0.60 = 1.6667x to 833,333 total IEQ "
                    "is audited in fixed_inventory_two_scale_ocr_headroom_sensitivity_astra_r1 (min slab pO2 = 3.9240 mmHg at 28.57% loading, requiring "
                    "a two-pouch split if 500,000 pure beta-equivalent IEQ is desired; AUDIT-REF & AUDIT-REF)."
                ),
            },
            "catalase_unit_to_capacity_bridge_qualification": (
                "In decomposition = catalytic_rate_s_inv * h / (1 + h / km_uM), catalytic_rate_s_inv is the pseudo-first-order rate constant "
                "k_1 = V_max / K_m = 18.0 s^-1 (giving 13.05 uM/s local clearance at peak 0.725 uM H2O2 and 18.0 uM/s at 1.0 uM H2O2). "
                "With K_m = 25,000 uM (25 mM), saturating V_max = k_1 * K_m = 0.45 M/s = 27,000 IU/mL of reference volume; "
                "the 5-denominator saturation-equivalence ledger spans 11,271.2 IU (0.41745 cm3 lamina pore water), 22,680 IU (0.8400 cm3 Design X pore water), "
                "64,260 IU (2.3800 cm3 central lamina envelope), 108,575.1 IU (4.0213 cm3 total hydrogel pore water), and 189,000 IU (7.00 cm3 bulk slab). "
                "Direct Hour-0 Newton BVP spatial controls verify that central-lamina-masked k_1 = 18.0 s^-1 (64,260 IU) yields 0.7256 uM (vs 0.7248 uM at nz=51 / 0.7249 uM at nz=201 uniform), "
                "co-localizing 11,271.2 IU inside the 2.38 cm3 central lamina (k_1 = 3.1572 s^-1 * mask) yields 4.0599 uM at nz=51 (4.0607 uM at nz=201; <=5.0 uM gate), "
                "and co-localizing 22,680.0 IU inside the 2.00 cm3 Design X 100-um central lamina (k_1 = 7.5600 s^-1 * mask) yields 2.0458 uM at nz=51 (2.0459 uM at nz=201; 2.046 uM 336-h PDE max under first-order, 3.3032 uM under clamped Ginstling-Brounshtein, and 3.5569 uM under exact-piecewise-conserving GB; keeping 336-h peak H2O2 <= 2.50 uM at nz=201 on the standard hourly grid requires localized k_1 >= 6.1678 s^-1 [0.81584 of 7.56 s^-1, >= 18,503.3 IU] under first-order, k_1 >= 10.0155 s^-1 [1.32480x, >= 30,046.5 IU] under clamped GB, and k_1 >= 10.7912 s^-1 [1.42741x, >= 32,373.5 IU] under exact-piecewise-conserving GB, while the continuous-time supremum across the early-time transition [t = 4.0674 h clamped / t = 7.9037 h exact piecewise shell-exhaustion transition, sampled at step 131/32 = 4.09375 h on the dt = 1/32 h grid where discrete thresholds are 6.1678 / 10.0180 / 10.8299 s^-1] requires k_1 >= 6.1678 / 10.0182 / 10.8312 s^-1 [>= 18,503.3 / 30,054.7 / 32,493.5 IU]; AUDIT-REF, AUDIT-REF & AUDIT-REF), "
                "whereas spreading 11,271.2 IU uniformly across 7.00 cm3 (k_1 = 1.0734 s^-1) yields 9.8210 uM at nz=51 (9.8158 uM at nz=201; <10.0 uM damage gate but >5.0 uM screen), "
                "requiring Catalase co-localization on/within the central PDMS-CaO2 lamina beads (79,149-158,298 U input at 100-200 U/mg CaO2; AUDIT-REF & AUDIT-REF)."
            ),
        },
        "reference_architecture_comparison_scope": "Reference architecture/OAT/challenge curves hold assumed functional beta-cell IEQ fixed and are explicitly independent of the PDE. Complete-product conditional verdicts occur only in the table with matched PDE identifiers and viability.",
        "matched_pde_ode_qualification_scenarios": coupled_pde_ode_table,
        "graft_architectures_compared": simulations,
        "paracrine_submechanism_oat_ablation_table_sol_v80_r2_11": oat_ablations,
        "device_insulin_transit_shape_sensitivity_bpr15": evaluate_device_insulin_transit_shape_sensitivity_bpr15(dt_max=0.25),
        "t1d_null_graft_and_viable_dose_response_controls_v80_008": viable_dose_response_controls,
        "low_glucose_challenge_below_4p2mM_oat1_verification_ultracode_v80_15": {
            "protocol": (
                "Intensive 88-min morning/midday exercise (exercise_intensity_parameter = 1.51 -> 1.7248x insulin-independent "
                "and 3.3405x insulin-dependent glucose uptake multipliers, t=448..536 min) + 60g CHO breakfast/lunch driving "
                "nadir glucose into the 3.88-3.92 mM window (< 4.2 mM octic GIRK clamp active; lead stays >= 3.90 mM on both "
                "1-min and 0.25-min grids while OAT_1 drops below 3.90 mM)"
            ),
            "exercise_intensity_parameter": 1.51,
            "effective_insulin_independent_uptake_multiplier": round(1.0 + 0.48 * 1.51, 4),
            "effective_insulin_dependent_uptake_multiplier": round(1.0 + 1.55 * 1.51, 4),
            "standard_protocol_lead_min_glucose_mM": simulations[0]["min_glucose_mM"],
            "standard_protocol_oat1_min_glucose_mM": oat_ablations[0]["min_glucose_mM"],
            "standard_protocol_oat1_exact_match_when_above_4p2mM": oat1_exact_match,
            "low_glucose_challenge_lead_with_lt_4p2mM_clamp_min_glucose_mM": low_g_lead["min_glucose_mM"],
            "low_glucose_challenge_lead_with_lt_4p2mM_clamp_min_glucose_0p25min_mM": lead_0p25_min,
            "low_glucose_challenge_lead_time_below_3p9mM_pct": low_g_lead["time_below_range_lt_3p9_mM_70_mg_dL_pct"],
            "low_glucose_challenge_lead_time_below_3p9mM_0p25min_pct": low_g_lead[
                "full_5761_step_0p25min_grid_verification_v80_025"
            ]["time_below_3p9mM_0p25min_pct"],
            "low_glucose_challenge_oat1_without_lt_4p2mM_clamp_min_glucose_mM": low_g_oat1["min_glucose_mM"],
            "low_glucose_challenge_oat1_without_lt_4p2mM_clamp_min_glucose_0p25min_mM": oat1_0p25_min,
            "low_glucose_challenge_oat1a_beta_clamp_only_min_glucose_mM": low_g_oat1a_beta_only["min_glucose_mM"],
            "low_glucose_challenge_oat1a_beta_clamp_only_min_glucose_0p25min_mM": low_g_oat1a_beta_only[
                "full_5761_step_0p25min_grid_verification_v80_025"
            ]["min_glucose_0p25min_mM"],
            "low_glucose_challenge_oat1_time_below_3p9mM_pct": low_g_oat1["time_below_range_lt_3p9_mM_70_mg_dL_pct"],
            "low_glucose_challenge_oat1_time_below_3p9mM_0p25min_pct": low_g_oat1[
                "full_5761_step_0p25min_grid_verification_v80_025"
            ]["time_below_3p9mM_0p25min_pct"],
            "low_glucose_nadir_protection_delta_mM": round(
                low_g_lead["min_glucose_mM"] - low_g_oat1["min_glucose_mM"], 3
            ),
            "low_glucose_nadir_protection_delta_0p25min_unrounded_mM": round(lead_0p25_min - oat1_0p25_min, 4),
        },
        "zero_sst_and_common_constants_qualification_ultracode_v80_10": {
            "zero_sst_collapse_exact_match_to_beta_only": zero_sst_exact_match,
            "zero_sst_lead_without_gcg_metrics": {
                "min_glucose_mM": zero_sst_lead["min_glucose_mM"],
                "mean_glucose_mM": zero_sst_lead["mean_glucose_mM"],
                "insulin_secretion_shutoff_half_time_min": zero_sst_lead["insulin_secretion_shutoff_half_time_min"],
            },
            "pure_delta_sst_ablation_retaining_alpha_gcg_metrics": {
                "min_glucose_mM": pure_sst_ablation_retaining_alpha["min_glucose_mM"],
                "mean_glucose_mM": pure_sst_ablation_retaining_alpha["mean_glucose_mM"],
                "insulin_secretion_shutoff_half_time_min": pure_sst_ablation_retaining_alpha["insulin_secretion_shutoff_half_time_min"],
            },
            "common_basal_and_shutoff_constants_sensitivity": [
                {
                    "graft_id": c["graft_id"],
                    "min_glucose_mM": c["min_glucose_mM"],
                    "mean_glucose_mM": c["mean_glucose_mM"],
                    "time_in_tight_range_3p9_to_10p0_mM_pct": c["time_in_tight_range_3p9_to_10p0_mM_pct"],
                    "insulin_secretion_shutoff_half_time_min": c["insulin_secretion_shutoff_half_time_min"],
                    "passes_clinical_glycemic_safety_targets": c["passes_clinical_glycemic_safety_targets"],
                }
                for c in common_constants_sensitivity
            ],
            "coupled_pde_viability_to_metabolic_ode_scenarios": coupled_pde_ode_table,
        },
        "er_load_viability_discount_coupling_note_muse_r3": {
            "er_load_viability_discount": None,
            "er_coupling_applied": False,
            "note": (
                "Layer 2 models IFN-stimulated orphan HLA-A/B/C heavy-chain ERAD flux (578-8,664 chains/min, central 200,000 retained chains/cell; PMID:12006653) "
                "in B2M-/- grafts; until Stage-0 Gate 0E-ER measures post-cytokine sXBP1/uXBP1, BiP, CHOP, and proinsulin/insulin ratio, "
                "er_load_viability_discount is explicitly None (er_coupling_applied=False) so no unmeasured ER viability discount is fabricated in Layer 4 (AUDIT-REF)."
            ),
        },
        "sc_islet_immaturity_paracrine_corner_sweep_muse_r3": (lambda: {
            "evidence_class": "STAGE7_SC_ISLET_PARACRINE_IMMATURITY_ODE_SENSITIVITY_SWEEP_REQUIRES_GATE_0M_MATURITY",
            "primary_citations": ["PMID:35241836", "PMID:22371083"],
            "baseline_reference_protocol": "v=0.60 (300,000 beta-equivalent IEQ), Erlang lag T=5.17 min (t50=4.34 min), paracrine-preserved scaling, ex=1.51 low-glucose exercise challenge",
            "adult_islet_reference_min_glucose_mM": round(
                float(_run_single_metabolic_ode_model(
                    graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.60,
                    low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17,
                    local_paracrine_preserved_systemic_scale=True, _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True,
                )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
            ),
            "corners": {
                "basal_leak_1p5x_30pct_ucn3": {
                    "min_glucose_0p25min_mM": round(
                        float(_run_single_metabolic_ode_model(
                            graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.60,
                            low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17,
                            local_paracrine_preserved_systemic_scale=True, basal_leak_multiplier=1.5, ucn3_gain=0.30,
                            _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True,
                        )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                    ),
                    "passes_3p50mM_exercise_floor": False,
                },
                "basal_leak_2p0x_0pct_ucn3": {
                    "min_glucose_0p25min_mM": round(
                        float(_run_single_metabolic_ode_model(
                            graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.60,
                            low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17,
                            local_paracrine_preserved_systemic_scale=True, basal_leak_multiplier=2.0, ucn3_gain=0.0,
                            _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True,
                        )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                    ),
                    "passes_3p50mM_exercise_floor": False,
                },
                "alpha_gcg_gain_0p50x_blunted_counterregulation": {
                    "min_glucose_0p25min_mM": round(
                        float(_run_single_metabolic_ode_model(
                            graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.60,
                            low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17,
                            local_paracrine_preserved_systemic_scale=True, alpha_gain=0.50,
                            _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True,
                        )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                    ),
                    "passes_3p50mM_exercise_floor": False,
                },
                "left_shifted_k05_5p5mM_gthresh_2p5mM": {
                    "min_glucose_0p25min_mM": round(
                        float(_run_single_metabolic_ode_model(
                            {**graft_models[0], "k05_gsis_mM": 5.5}, include_trajectory=False, viable_endocrine_fraction=0.60,
                            low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17,
                            local_paracrine_preserved_systemic_scale=True, g_thresh_override_mM=2.5,
                            _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True,
                        )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                    ),
                    "passes_3p50mM_exercise_floor": False,
                },
                "moderate_sc_islet_immaturity_combo_1p5x_leak_0p30_ucn3_0p50_alpha": {
                    "min_glucose_0p25min_mM": round(
                        float(_run_single_metabolic_ode_model(
                            graft_models[0], include_trajectory=False, viable_endocrine_fraction=0.60,
                            low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17,
                            local_paracrine_preserved_systemic_scale=True, basal_leak_multiplier=1.5, ucn3_gain=0.30, alpha_gain=0.50,
                            _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True,
                        )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                    ),
                    "passes_3p50mM_exercise_floor": False,
                },
                "full_sc_islet_immaturity_combo_with_k05_5p8mM_gthresh_2p5mM": {
                    "min_glucose_0p25min_mM": round(
                        float(_run_single_metabolic_ode_model(
                            {**graft_models[0], "k05_gsis_mM": 5.8}, include_trajectory=False, viable_endocrine_fraction=0.60,
                            low_glucose_challenge_mode=True, extravascular_insulin_lag_total_min=5.17,
                            local_paracrine_preserved_systemic_scale=True, basal_leak_multiplier=1.5, ucn3_gain=0.30, alpha_gain=0.50, g_thresh_override_mM=2.5,
                            _integrator=_ORIGINAL_RK4_INTEGRATE, _skip_shutoff_half_time=True,
                        )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                    ),
                    "passes_3p50mM_exercise_floor": False,
                },
            },
            "stage0_gate_0m_maturity_pass_criteria": {
                "basal_2p8mM_insulin_leak_fraction_of_20mM_max_cap": 0.08,
                "shutoff_half_time_20mM_to_2p8mM_min_cap": 6.0,
                "stage0_decision_tree_s8_basal_insulin_frac_of_16p7mM_peak_cap": 0.15,
                "stage0_decision_tree_s8_shutoff_t90_16p7mM_to_2p8mM_min_cap": 3.0,
                "stage0_decision_tree_s8_glucose_threshold_mM_min": 4.5,
                "stage0_decision_tree_s8_immaturity_corner_min_glucose_mM_min": 3.50,
                "low_glucose_2p8mM_to_1p5mM_glucagon_fold_increase_min": 2.0,
                "alpha_counterregulatory_gain_ratio_min": 0.80,
                "ucn3_mrna_or_protein_fraction_of_primary_human_islets_min": 0.70,
                "gate_0f_maturity_vs_decision_tree_s8_gate_0m_reconciliation_note": (
                    "Reconciles the two complementary perifusion protocols (L4B-F02 [DEC-078]): "
                    "(a) Gate 0F-maturity (20.0 -> 2.8 mM maximal-step perifusion sub-gate) requires basal 2.8 mM leak <= 8% (0.08) of 20 mM max secretion and 20->2.8 mM shut-off half-time t_1/2 <= 6.0 min; "
                    "whereas (b) stage0_decision_tree_v1.json Switch S8 (S8_SC_Islet_Paracrine_Maturity_Gate_0M, standard 16.7 -> 2.8 mM perifusion) requires obs_basal_insulin_frac_peak <= 0.15, "
                    "90% shut-off time obs_gate0m_shutoff_t90_min <= 3.0 min (with 8->2 mM residual ratio <= 0.20), obs_glucose_threshold_mM >= 4.5 mM, obs_immaturity_corner_min_glucose_mM >= 3.50 mM, "
                    "obs_alpha_glucagon_low_glc_fold >= 2.0, obs_alpha_counterregulatory_gain_ratio >= 0.80, and obs_ucn3_maturity_ratio >= 0.70 (while Switch S8b evaluates TYK2 P1104A x inducible-promoter epistasis under Gate 0E)."
                ),
                "challenged_v0p60_300k_beta_eq_exercise_margin_audit_sol61_r5": {
                    "finding_id": "AUDIT-REF",
                    "primary_citations": ["PMID:8971076", "PMID:30830873"],
                    "nominal_v1p00_500k_beta_eq_min_glucose_mM": 4.2348,
                    "nominal_v1p00_zero_sst_min_glucose_mM": 3.9001,
                    "challenged_v0p60_300k_beta_eq_adult_ref_min_glucose_mM": 3.5710,
                    "challenged_v0p60_300k_beta_eq_adult_ref_1min_sample_min_glucose_mM": 3.5715,
                    "challenged_v0p60_300k_beta_eq_adult_ref_historical_r5_probe_min_glucose_mM": 3.5707,
                    "challenged_v0p60_300k_beta_eq_adult_ref_literal_tau7p14_min_glucose_mM": 3.5713,
                    "challenged_v0p60_300k_beta_eq_alpha_gain_0p50_min_glucose_mM": 3.1277,
                    "challenged_v0p60_300k_beta_eq_alpha_gain_0p50_1min_sample_min_glucose_mM": 3.1277,
                    "challenged_v0p60_300k_beta_eq_alpha_gain_0p50_historical_r5_dt1min_min_glucose_mM": 3.1282,
                    "challenged_v0p60_300k_beta_eq_combined_immaturity_min_glucose_mM": 2.9523,
                    "challenged_v0p60_300k_beta_eq_combined_immaturity_1min_sample_min_glucose_mM": 2.9523,
                    "challenged_v0p60_300k_beta_eq_combined_immaturity_historical_r5_probe_min_glucose_mM": 2.9522,
                    "bidirectional_13state_and_site_drainage_partition_audit_astra6_r5": {
                        "symmetric_13state_bidirectional_v0p60_alpha1p0_tau12_min_glucose_mM": 2.7160,
                        "symmetric_13state_bidirectional_v0p60_alpha1p0_baseline_tau7p14_min_glucose_mM": 3.1775,
                        "symmetric_13state_bidirectional_v0p60_alpha1p0_literal_tau7p14_min_glucose_mM": 3.1779,
                        "single_compartment_9state_v0p60_alpha1p0_baseline_kI0p14_min_glucose_mM": 3.5710,
                        "single_compartment_9state_v0p60_alpha1p0_tau12_min_glucose_mM": 3.1257,
                        "single_compartment_9state_v0p60_alpha1p0_tau18_min_glucose_mM": 2.7554,
                        "single_compartment_9state_v0p60_alpha0p50_tau18_min_glucose_mM": 2.1294,
                        "subcutaneous_systemic_venous_partition_f_sys_ins_1p35_f_hep_gcg_0p55_f_hep_ins_0p44_min_glucose_mM": 2.8304,
                        "subcutaneous_systemic_venous_partition_alpha0p80_tau8_min_glucose_mM": 2.6014,
                        "omental_portal_venous_drainage_required_to_avoid_systemic_hyperinsulinemia_and_hepatic_glucagon_blunting": True,
                    },
                    "tau_clear_min_and_alpha_fraction_sensitivity_grid_kimi31_r5": {
                        f"tau_clear_{int(tau_c)}min_alpha_gain_{str(a_gain).replace('.', 'p')}": {
                            "ip_clearance_tau_min": float(tau_c),
                            "alpha_counterregulatory_gain_fraction": float(a_gain),
                            "min_glucose_0p25min_mM": round(
                                float(
                                    _run_single_metabolic_ode_model(
                                        graft_models[0],
                                        include_trajectory=False,
                                        viable_endocrine_fraction=0.60,
                                        low_glucose_challenge_mode=True,
                                        extravascular_insulin_lag_total_min=5.17,
                                        local_paracrine_preserved_systemic_scale=True,
                                        alpha_gain=float(a_gain),
                                        ip_clearance_tau_min=float(tau_c),
                                        _integrator=_ORIGINAL_RK4_INTEGRATE,
                                        _skip_shutoff_half_time=True,
                                    )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]
                                ),
                                4,
                            ),
                        }
                        for tau_c in (8, 12, 18)
                        for a_gain in (1.0, 0.5, 0.25)
                    },
                    "portal_drainage_lag_by_clearance_exercise_envelope_astra6_r6": {
                        "lag_5p17min_tau_8min_min_glucose_mM": 3.0722,
                        "lag_5p17min_tau_12min_min_glucose_mM": 2.7160,
                        "lag_4p0min_tau_12min_min_glucose_mM": 2.8721,
                        "lag_2p0min_tau_12min_min_glucose_mM": 3.1506,
                        "mandatory_joint_staged_dose_and_lag_clearance_rule": (
                            "In the 13-state bidirectional hormone-transport exercise challenge (v = 0.60, adult alpha/UCN3, portal_partitions = 1), "
                            "portal venous drainage with tau_clear = 12 min and 5.17 min insulin lag yields min_G = 2.7160 mM (3.0722 mM at tau_clear = 8 min; "
                            "2.8721 mM at T_ins = 4.0 min, tau = 12 min; 3.1506 mM at T_ins = 2.0 min, tau = 12 min), showing in this simulation that portal drainage + tau_clear <= 12 min "
                            "alone does not guarantee the 3.50 mM exercise floor at full 300k beta-eq IEQ load; high-exercise/slow-clearance recipients therefore require "
                            "staged modular functional dose titration (initial single 100 cm^2 sentinel cassette loaded with 150,000 total IEQ = 90,000 beta-eq IEQ [30% of the 500,000 total / 300,000 beta-eq full dose, v = 0.18 per cassette; 50% of a two-cassette 300,000-total-IEQ v = 0.36 intermediate load] + Day-28 clamp-verified step-up; in the live 13-state portal ODE at tau_clear = 8.0 min and T_ins = 5.17 min, v = 0.18 yields exercise min_G = 4.6372 mM [4.6361 mM at matched G(0) = 5.10 mM], v = 0.36 yields 3.3217 mM [3.3238 mM at matched G(0) = 5.10 mM, already below 3.50 mM at tau_clear = 8.0 min], and v = 0.60 yields 3.0722 mM, giving a simulated additive full-dose drop of 1.5639-1.5650 mM [projected clamp baseline 5.0639-5.0650 mM to remain >= 3.50 mM at v = 0.60 without lag reduction], with >= 3.90 mM as the conservative normoglycemic single-cassette release floor) jointly constrained by device lag T_ins and recipient tau_clear (AUDIT-REF, L4B-GAP3-F1 & R9S8-L4B-01 [DEC-052/DEC-078/DEC-080])."
                        ),
                        "coupled_13state_portal_vs_subcutaneous_immaturity_and_lag_audit_sonnet55_r9": (lambda: {
                            "finding_ids": ["L4B-F01", "L4B-F03", "GAP-L4A-3-F1", "GAP-L4A-3-F2", "R9S8-L4B-01"],
                            "computation_mode": "LIVE_PARAMETERIZED_12_AND_13_STATE_METABOLIC_ODE_SOLVER_R9S8_L4B_01",
                            "standard_protocol_12state_v0p72_360k_beta_eq_lag10_alpha0p50_min_glucose_mM": round(
                                float(_run_single_metabolic_ode_model(
                                    graft_models[0], include_trajectory=False, co_lag_glucagon_and_isf_glucose=True,
                                    use_local_isf_insulin_for_alpha_block=False, _skip_shutoff_half_time=True,
                                    viable_endocrine_fraction=0.72, extravascular_insulin_lag_total_min=10.0,
                                    glucagon_total_lag_min=10.0, isf_glucose_lag_min=5.0, alpha_gain=0.50,
                                    local_paracrine_preserved_systemic_scale=True, _integrator=_ORIGINAL_RK4_INTEGRATE,
                                )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                            ),
                            "standard_protocol_portal_13state_v0p72_360k_beta_eq_lag10_alpha0p50_canonical_kI0p14_min_glucose_mM": round(
                                float(_run_single_metabolic_ode_model(
                                    graft_models[0], include_trajectory=False, co_lag_glucagon_and_isf_glucose=True,
                                    use_local_isf_insulin_for_alpha_block=False, _skip_shutoff_half_time=True,
                                    viable_endocrine_fraction=0.72, extravascular_insulin_lag_total_min=10.0,
                                    glucagon_total_lag_min=10.0, isf_glucose_lag_min=5.0, alpha_gain=0.50,
                                    local_paracrine_preserved_systemic_scale=True, f_hep_ins_override=1.0,
                                    _integrator=_ORIGINAL_RK4_INTEGRATE,
                                )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                            ),
                            "standard_protocol_portal_13state_v0p72_360k_beta_eq_lag10_alpha0p50_literal_tau7p14_min_glucose_mM": round(
                                float(_run_single_metabolic_ode_model(
                                    graft_models[0], include_trajectory=False, co_lag_glucagon_and_isf_glucose=True,
                                    use_local_isf_insulin_for_alpha_block=False, _skip_shutoff_half_time=True,
                                    viable_endocrine_fraction=0.72, extravascular_insulin_lag_total_min=10.0,
                                    glucagon_total_lag_min=10.0, isf_glucose_lag_min=5.0, alpha_gain=0.50,
                                    local_paracrine_preserved_systemic_scale=True, f_hep_ins_override=1.0,
                                    ip_clearance_tau_min=7.14, _integrator=_ORIGINAL_RK4_INTEGRATE,
                                )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                            ),
                            "standard_protocol_portal_13state_v0p72_360k_beta_eq_lag10_alpha0p50_tau8p0_min_glucose_mM": round(
                                float(_run_single_metabolic_ode_model(
                                    graft_models[0], include_trajectory=False, co_lag_glucagon_and_isf_glucose=True,
                                    use_local_isf_insulin_for_alpha_block=False, _skip_shutoff_half_time=True,
                                    viable_endocrine_fraction=0.72, extravascular_insulin_lag_total_min=10.0,
                                    glucagon_total_lag_min=10.0, isf_glucose_lag_min=5.0, alpha_gain=0.50,
                                    local_paracrine_preserved_systemic_scale=True, f_hep_ins_override=1.0,
                                    ip_clearance_tau_min=8.0, _integrator=_ORIGINAL_RK4_INTEGRATE,
                                )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                            ),
                            "standard_protocol_subcutaneous_13state_v0p72_360k_beta_eq_lag9p5332_alpha0p50_min_glucose_mM": round(
                                float(_run_single_metabolic_ode_model(
                                    graft_models[0], include_trajectory=False, co_lag_glucagon_and_isf_glucose=True,
                                    use_local_isf_insulin_for_alpha_block=False, _skip_shutoff_half_time=True,
                                    viable_endocrine_fraction=0.72, extravascular_insulin_lag_total_min=9.5332,
                                    glucagon_total_lag_min=10.0, isf_glucose_lag_min=5.0, alpha_gain=0.50,
                                    local_paracrine_preserved_systemic_scale=True, f_hep_ins_override=0.44,
                                    f_sys_ins=1.35, f_hep_gcg=0.55, _integrator=_ORIGINAL_RK4_INTEGRATE,
                                )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                            ),
                            "low_glucose_challenge_13state_portal_v0p72_360k_beta_eq_lag10_alpha0p50_min_glucose_mM": round(
                                float(_run_single_metabolic_ode_model(
                                    graft_models[0], include_trajectory=False, low_glucose_challenge_mode=True,
                                    co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False,
                                    _skip_shutoff_half_time=True, viable_endocrine_fraction=0.72,
                                    extravascular_insulin_lag_total_min=10.0, glucagon_total_lag_min=10.0,
                                    isf_glucose_lag_min=5.0, alpha_gain=0.50,
                                    local_paracrine_preserved_systemic_scale=True, f_hep_ins_override=1.0,
                                    _integrator=_ORIGINAL_RK4_INTEGRATE,
                                )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                            ),
                            "portal_12state_to_13state_trajectory_identity_and_hepatic_extraction_note": (
                                "In the 12/13-state ODE (lines 3807-3812), peripheral X(t) and hepatic X_hep(t) share relaxation rate k_x_decay_shared = 0.035 min^-1 and equal initial conditions X(0) = X_hep(0); "
                                "therefore at portal partitions f_sys_ins = f_hep_ins_override = 1.0, d(X_hep - X)/dt = -0.035*(X_hep - X) implies X_hep(t) == X(t) identically, so the 12-state and portal 13-state standard-protocol trajectories both yield min_G = 3.5059 mM (3.505875 mM unrounded; 3.5065 mM at literal tau_clear = 7.14 min; dropping to 3.3399 mM [3.339921 mM] at tau_clear = 8.0 min, and 1.8651 mM under the ex = 1.51 low-glucose exercise challenge). "
                                "First-pass splanchnic carbohydrate extraction is parameterized via meal_appearance_mM_min systemic_gain_mM_per_g = 0.095 mM/g rather than a dynamic state-dependent k_splanchnic * G(t) * X_hep(t) uptake term, and dose-escalation to v = 0.72 (360k beta-eq IEQ) with T_ins = T_gln = 10 min, T_isf = 5 min, alpha_gain = 0.50 breaches the 3.50 mM floor at tau_clear = 8.0 min (3.3399 mM standard / 1.8651 mM challenge), reinforcing DEC-038 retirement of dose-escalation rescue (R9S8-L4B-01 [DEC-080])."
                            ),
                        })(),
                    },
                    "summary_note": (
                        "At the matched 60:30:10 trihormonal graft dose v = 0.60 (500,000 total IEQ = 300,000 beta-equivalent IEQ) with 5.17 min Erlang insulin lag "
                        "and ex = 1.51 low-glucose exercise challenge, adult reference paracrine function on the canonical 0.25-min RK4 grid gives min_G = 3.5710 mM (3.570985 mM unrounded, +0.0710 mM margin above 3.50 mM; 3.5715 mM [3.571541 mM unrounded] on the 1-min subsample grid idx_1min = np.arange(0, 5761, 4), 3.5707 mM in the historical Round-5 AUDIT-REF standalone probe, and 3.5713 mM if literal tau_clear = 7.14 min is passed instead of exact k_I = 0.14 min^-1 [tau_clear = 1/0.14 = 7.1429 min]; isolated zero-input plasma half-life t_1/2 = ln(2)/k_I = 4.9511 min) at alpha_gain = 1.0, "
                        "crosses the 3.50 mM floor at tau_clear ~= 7.745 min, and drops in the 9-state single-compartment reference to 3.4723 mM at tau_clear = 8.0 min, 3.1257 mM at tau_clear = 12.0 min (2.7160 mM in the 13-state portal co-lagged model), and 2.7554 mM at tau_clear = 18.0 min (< 3.50 mM); "
                        "isolated 50% alpha-cell counter-regulatory blunting (alpha_gain = 0.50) drops min_G to 3.1277 mM on both the 0.25-min and 1-min subsample grids (3.127747 mM unrounded; 3.1282 mM under historical dt = 1.0 min step integration) at baseline k_I = 0.14 min^-1 (2.9853 mM at tau_clear = 8.0 min, 2.5150 mM at tau_clear = 12.0 min, and 2.1294 mM at tau_clear = 18.0 min in the 9-state single-compartment grid), "
                        "combined moderate SC-islet immaturity drops min_G to 2.9523 mM on both the 0.25-min and 1-min subsample grids (2.952340 mM unrounded; 2.9522 mM in the historical Round-5 probe), and in the 13-state bidirectional hormone-transport solver min_G is 3.1775 mM (symmetric co-lagged at default k_I = 0.14 min^-1 [tau_clear = 7.1429 min], or 3.1779 mM at literal tau_clear = 7.14 min; 3.0722 mM at tau_clear = 8.0 min and 2.7160 mM at tau_clear = 12.0 min under portal drainage) or 2.8304 mM (2.6014 mM at alpha_gain = 0.80, tau_clear = 8.0 min) under subcutaneous systemic venous drainage where hepatic first-pass insulin extraction and portal glucagon delivery are lost (Edgerton et al. 2019 Diabetes PMID:30830873 for portal vs peripheral insulin/glucagon delivery; Kendall et al. 1997 Diabetes PMID:8971076 for blunted alpha-cell glucagon counter-regulation in intrahepatic islet grafts compared with extrahepatic/systemic sites; AUDIT-REF, AUDIT-REF, AUDIT-REF, AUDIT-REF, R9-S1-L4B-01, R9-S1-L4B-01-RESIDUAL, L4B-N1 & L4B-F03 [DEC-044/045/046/071/074/075/076/078]). "
                        "Stage-0 Gate 0M-maturity and Rule S8 therefore trigger staged two-cassette functional dose titration (150,000 IEQ initial sentinel cap) whenever recipient insulin clearance upper95 >= 8.0 min (obs_recipient_insulin_clearance_tau_min upper95 >= 8.0 min) unless omental portal-venous drainage + staged dosing is explicitly qualified (s8_staged_dose_and_omental_portal_drainage_qualified = True)."
                    ),
                },
                "icasp9_ap1903_ablation_insulin_dump_and_staged_cassette_excision_ode_audit_sonnet55_r5": {
                    "finding_ids": ["AUDIT-REF", "AUDIT-REF", "AUDIT-REF", "MW-R5-S2-F03", "AUDIT-REF", "AUDIT-REF", "AUDIT-REF"],
                    "primary_citations": ["PMID:22047558", "PMID:26052521", "PMID:26022733", "PMID:27626039"],
                    "citation_provenance_reconciliation_r6": (
                        "Replaces prior misattributed Round-5 PMIDs "
                        "with clinical and preclinical iCasp9/AP1903 provenance: Di Stasi et al. 2011 NEJM PMID:22047558, Wu et al. 2014 Mol Ther Methods Clin Dev PMID:26052521, "
                        "Yagyu et al. 2015 Mol Ther PMID:26022733, and Yagyu et al. 2016 Mol Ther Methods Clin Dev PMID:27626039 (AUDIT-REF [DEC-050/DEC-078])."
                    ),
                    "intracellular_granule_insulin_pool_300k_beta_eeq_to_500k_total_ieq": {
                        "insulin_content_per_total_ieq_mU_range": [0.083, 0.277],
                        "insulin_content_per_beta_eeq_mU_at_300k_beta_eeq_range": [0.138, 0.461],
                        "insulin_content_per_beta_eeq_mU_range": [0.138, 0.461],
                        "denominator_reconciliation_note": (
                            "Total stored insulin pool [41.5, 138.3] IU across the 500,000-total-IEQ graft (60% beta = 300,000 beta-equivalent IEQ) "
                            "equals [0.083, 0.277] mU per total IEQ (41,500-138,300 mU / 500,000 total IEQ) and [0.138, 0.461] mU per beta-equivalent IEQ "
                            "(41,500-138,300 mU / 300,000 beta-EEQ = [0.083/0.60, 0.277/0.60]; AUDIT-REF [DEC-076])."
                        ),
                        "total_stored_insulin_pool_IU_range": [41.5, 138.3],
                        "dose_per_kg_in_70kg_recipient_IU_kg_range": [0.59, 1.98],
                        "ap1903_dimerizer_mw_g_mol": 1412.7,
                        "ap1903_50pct_protein_unbound_free_fraction_diffuses_into_pouch_within_min": 18.5,
                    },
                    "unmitigated_single_bolus_0p4mg_kg_ap1903_hazard": {
                        "secondary_necrosis_fraction_under_macrophage_exclusion_or_cd47_persistence": 0.30,
                        "acute_released_insulin_bolus_IU_at_30pct_necrosis_range": [12.45, 41.49],
                        "mass_balance_derivation": "At 12.45 IU acute dump into V_G = 13.16 L without D10W clamp, systemic insulin disposal (0.28 mM/IU) exceeds endogenous glycogenolysis by 3.48 mM, driving fasting 5.0 mM glucose to < 1.52 mM (1.12 mM = 20.2 mg/dL at 13.86 IU).",
                        "simulated_unclamped_nadir_glucose_mM": round(max(0.5, 5.0 - 13.86 * 0.28), 2),
                        "simulated_unclamped_nadir_glucose_mg_dL": 20.2,
                        "clinical_status": "PROHIBITED_UNCLAMPED_OUTPATIENT_BOLUS",
                    },
                    "mandatory_two_step_clinical_ablation_and_d10w_clamp_protocol": {
                        "step_1_non_emergent_en_bloc_laparoscopic_cassette_excision": (
                            "Because the graft is housed inside macro-retrievable micro-fenestrated ePTFE/PDMS omental cassettes (qualified at obs_explant_en_bloc_recovery_fraction >= 0.99), "
                            "primary graft removal is surgical/laparoscopic en-bloc cassette explantation, physically removing >= 99% of the 41.5-138.3 IU intracellular insulin pool without cell lysis."
                        ),
                        "step_2_stepped_inpatient_ap1903_with_d10w_clamp_and_basal_insulin_restart": (
                            "For the <= 1% residual unretrieved cells after en-bloc surgical excision (leaving 0.415-1.383 IU total stored insulin), or for emergent non-surgical ablation under high-capacity ICU central-venous D20W/D50W + glucagon clamp, "
                            "AP1903 is administered solely in an inpatient ICU/step-down setting under continuous arterial/CGM glucose monitoring using a stepped 3-dose titration (0.01 mg/kg at t=0h -> 0.05 mg/kg at t=24h -> 0.40 mg/kg at t=48h) that caps peak hourly insulin release at <= 2.8 IU/h (clamped min_G >= 4.20 mM; obs_gate0s_ap1903_1h_insulin_burst_iu <= 2.8 IU/h), paired with immediate initiation of exogenous basal/bolus insulin as C-peptide decays."
                        ),
                        "elective_excision_first_vs_emergency_drug_first_protocol_separation_r6": {
                            "elective_step1_en_bloc_excision_removes_fraction_min": 0.99,
                            "post_excision_residual_1pct_stored_insulin_pool_iu_range": [0.415, 1.383],
                            "post_excision_step2_ap1903_peak_hourly_insulin_release_iu_h_max": 0.42,
                            "emergency_in_situ_full_graft_ablation_requires_central_venous_d20w_d50w_icu_clamp": True,
                            "stage0_gate_0s_acute_1h_insulin_burst_limit_iu": 2.8,
                            "wetlab_contract_endpoint_1h_burst": "obs_gate0s_ap1903_1h_insulin_burst_iu",
                            "wetlab_contract_endpoint_24h_dump_fraction": "obs_gate0s_ap1903_supernatant_insulin_dump_fraction_24h",
                        },
                        "clamped_two_step_min_glucose_mM": 4.20,
                        "stage0_gate_0s_supernatant_insulin_dump_limit_24h": 0.15,
                    },
                    "staged_sentinel_functional_dosing_and_paediatric_exercise_derating_muse_r6": (lambda: {
                        "finding_ids": ["MW-R6-S1-16", "MW-R6-S1-17", "MW-R6-S1-18", "R9S8-L4B-01"],
                        "initial_sentinel_cassette_functional_dose_cap_ieq": 150000.0,
                        "initial_sentinel_beta_equivalent_ieq": 90000.0,
                        "initial_sentinel_fraction_of_500k_full_dose": 0.30,
                        "initial_sentinel_viable_endocrine_fraction_v": 0.18,
                        "two_100cm2_cassettes_intermediate_total_ieq": 300000.0,
                        "two_100cm2_cassettes_intermediate_beta_equivalent_ieq": 180000.0,
                        "two_100cm2_cassettes_intermediate_viable_endocrine_fraction_v": 0.36,
                        "full_500k_total_ieq_at_1500_ieq_cm2_total_area_cm2": 333.33,
                        "step_up_second_cassette_requires_day28_clamp_and_exercise_nadir_ge_3p9mM": True,
                        "simulated_v0p18_portal_tau8_default_g0_min_glucose_mM": round(
                            float(_run_single_metabolic_ode_model(
                                graft_models[0], include_trajectory=False, low_glucose_challenge_mode=True,
                                co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False,
                                _skip_shutoff_half_time=True, viable_endocrine_fraction=0.18,
                                extravascular_insulin_lag_total_min=5.17, f_hep_ins_override=1.0,
                                ip_clearance_tau_min=8.0, local_paracrine_preserved_systemic_scale=True,
                                _integrator=_ORIGINAL_RK4_INTEGRATE,
                            )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                        ),
                        "simulated_v0p18_portal_tau8_matched_g0_5p1_min_glucose_mM": round(
                            float(_run_single_metabolic_ode_model(
                                graft_models[0], include_trajectory=False, low_glucose_challenge_mode=True,
                                co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False,
                                _skip_shutoff_half_time=True, viable_endocrine_fraction=0.18,
                                extravascular_insulin_lag_total_min=5.17, f_hep_ins_override=1.0,
                                ip_clearance_tau_min=8.0, g0_override_mM=5.1,
                                local_paracrine_preserved_systemic_scale=True, _integrator=_ORIGINAL_RK4_INTEGRATE,
                            )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                        ),
                        "simulated_v0p36_portal_tau8_default_g0_min_glucose_mM": round(
                            float(_run_single_metabolic_ode_model(
                                graft_models[0], include_trajectory=False, low_glucose_challenge_mode=True,
                                co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False,
                                _skip_shutoff_half_time=True, viable_endocrine_fraction=0.36,
                                extravascular_insulin_lag_total_min=5.17, f_hep_ins_override=1.0,
                                ip_clearance_tau_min=8.0, local_paracrine_preserved_systemic_scale=True,
                                _integrator=_ORIGINAL_RK4_INTEGRATE,
                            )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                        ),
                        "simulated_v0p36_portal_tau8_matched_g0_5p1_min_glucose_mM": round(
                            float(_run_single_metabolic_ode_model(
                                graft_models[0], include_trajectory=False, low_glucose_challenge_mode=True,
                                co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False,
                                _skip_shutoff_half_time=True, viable_endocrine_fraction=0.36,
                                extravascular_insulin_lag_total_min=5.17, f_hep_ins_override=1.0,
                                ip_clearance_tau_min=8.0, g0_override_mM=5.1,
                                local_paracrine_preserved_systemic_scale=True, _integrator=_ORIGINAL_RK4_INTEGRATE,
                            )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                        ),
                        "simulated_v0p60_portal_tau8_min_glucose_mM": round(
                            float(_run_single_metabolic_ode_model(
                                graft_models[0], include_trajectory=False, low_glucose_challenge_mode=True,
                                co_lag_glucagon_and_isf_glucose=True, use_local_isf_insulin_for_alpha_block=False,
                                _skip_shutoff_half_time=True, viable_endocrine_fraction=0.60,
                                extravascular_insulin_lag_total_min=5.17, f_hep_ins_override=1.0,
                                ip_clearance_tau_min=8.0, g0_override_mM=5.1,
                                local_paracrine_preserved_systemic_scale=True, _integrator=_ORIGINAL_RK4_INTEGRATE,
                            )["full_5761_step_0p25min_grid_verification_v80_025"]["min_glucose_0p25min_unrounded_mM"]), 4
                        ),
                        "first_cassette_v0p18_simulated_exercise_nadir_mM": 4.6372,
                        "additive_nadir_delta_v0p18_to_v0p60_matched_g0_mM": 1.5639,
                        "additive_clamp_baseline_to_offset_1p5639mM_full_dose_drop_mM": 5.0639,
                        "paediatric_and_low_body_mass_weight_indexed_dose_cap_ieq_per_kg": 4000.0,
                        "dose_staging_geometry_and_nadir_projection_note": (
                            "Each 100 cm^2 modular sentinel cassette loaded at 1,500 IEQ/cm^2 carries 150,000 total IEQ (90,000 beta-equivalent IEQ = 30% of the 500,000-total / 300,000-beta-eq curative dose, corresponding to v = 0.18 in the ODE; "
                            "two 100 cm^2 cassettes provide 300,000 total IEQ / 180,000 beta-eq IEQ [v = 0.36, so the first cassette is 50% of the two-cassette intermediate step], whereas full 500,000 total IEQ at 1,500 IEQ/cm^2 requires 333.33 cm^2 [e.g., two 166.67 cm^2 pouches or three 111.11 cm^2 cassettes]). "
                            "In the live 13-state portal-drainage ODE at tau_clear = 8.0 min and T_ins = 5.17 min (preserved local paracrine scaling), v = 0.18 (150k total IEQ) gives exercise min_G = 4.6372 mM (4.637162 mM at default G(0) = 15.02 mM; 4.6361 mM [4.636082 mM] at matched G(0) = 5.10 mM; 3.5296 mM if local paracrine signals scale down with v), "
                            "v = 0.36 (300k total IEQ) gives min_G = 3.3217 mM (3.321672 mM at default G(0) = 12.84 mM; 3.3238 mM [3.323800 mM] at matched G(0) = 5.10 mM, already crossing below 3.50 mM at tau_clear = 8.0 min), and v = 0.60 (500k total IEQ) gives 3.0722 mM (3.072152 mM). "
                            "Thus 3.90 mM is the necessary normoglycemic single-cassette floor, the simulated v = 0.18 nadir itself is 4.6372 mM (~4.64 mM), and the simulated nonlinear nadir drop from v = 0.18 to v = 0.60 at tau_clear = 8.0 min is 1.5639-1.5650 mM (requiring an additive baseline of 3.50 + 1.5639 = 5.0639 mM if extrapolated additively, or qualifying V3 T_ins <= 2.33 min / empirical post-step-up exercise clamp verification; R9S8-L4B-01 [DEC-080])."
                        ),
                        "wt_iapp_pouch_accumulation_and_pramlintide_lead_promotion_rule_muse_r6": {
                            "finding_id": "MW-R6-S1-13",
                            "wt_iapp_confined_hydrogel_supersaturation_risk": "At 1,500 IEQ/cm^2 inside a 350 um slab, 1:100 IAPP:insulin co-secretion with slower hexameric/monomeric washout creates local human IAPP supersaturation if WT IAPP is retained.",
                            "automatic_lead_promotion_rule": "If 14-day high-glucose (16.7 mM) microfluidic pouch challenge yields Thioflavin-T amyloid area > 1.0% or caspase-3 > 3.0% (obs_thioflavin_t_amyloid_area_pct > 1.0), promote ISLET1_A4_IAPP_PRAM (Pramlintide-like A25P/S28P/S29P at Locus 5) to default Track-1 lead.",
                        },
                    })(),
                },
                "pivot_rule_S8": (
                    "Hold Stage-1 progression if Gate 0M-maturity (S8_SC_Islet_Paracrine_Maturity_Gate_0M) fails; "
                    "extend ALK5i-free Stage-7 maturation (+1-3 weeks; Balboa et al. 2022 PMID:35241836; Barsby et al. 2022 PMID:36136756; "
                    "zero terminal ALK5i II / TGFb-inhibitor continuation per Velazco-Cruz et al. 2019 PMID:30661993 Fig. 5F; "
                    "retaining 10 nM T3 + 1 mM NAC and logged ZM447439 regimen [0.0 uM S7w0-only vs 0.45-0.55 uM continuous endocrine Stage 7] "
                    "with analytical LC-MS/MS washout <= LLOQ <= 0.005 uM across >= 3 washes plus pre-co-assembly iEC/pericyte vascular function verification) "
                    "and re-verify two-clock two-pulse Readout 2, Gate 0M, and stored-insulin conservation before device loading (IIP-0029; DEC-108)."
                ),
                "legacy_pivot_rule_key_reconciled_from": "pivot_rule_S6",
            },
        })(),
    }



# === BEGIN_IIP_0019_EXPLICIT_3D_TRANSPORT_AUDIT ===
_IIP0019_RSA_PRECOMPUTED_TILE_METRICS: List[Dict[str, Any]] = [{'tile_index': 0, 'fail_count_fv_harmonic_face_lt15': 9, 'fail_count_shell_0p95_1p05_lt15': 10, 'fail_count_shell_0p95_1p06_lt15': 9, 'fail_count_shell_0p85_1p04_lt15': 11, 'fail_count_shell_0p85_1p06_lt15': 11, 'fail_count_core_lt5': 8, 'clusters_with_any_voxel_lt0p5mmhg': 0, 'min_fv_harmonic_face_mmhg': 11.7631, 'min_shell_0p95_1p06_mmhg': 11.8799, 'min_core_mmhg': 2.9344}, {'tile_index': 1, 'fail_count_fv_harmonic_face_lt15': 3, 'fail_count_shell_0p95_1p05_lt15': 3, 'fail_count_shell_0p95_1p06_lt15': 3, 'fail_count_shell_0p85_1p04_lt15': 6, 'fail_count_shell_0p85_1p06_lt15': 4, 'fail_count_core_lt5': 1, 'clusters_with_any_voxel_lt0p5mmhg': 0, 'min_fv_harmonic_face_mmhg': 13.3275, 'min_shell_0p95_1p06_mmhg': 13.2569, 'min_core_mmhg': 4.3693}, {'tile_index': 2, 'fail_count_fv_harmonic_face_lt15': 8, 'fail_count_shell_0p95_1p05_lt15': 8, 'fail_count_shell_0p95_1p06_lt15': 8, 'fail_count_shell_0p85_1p04_lt15': 9, 'fail_count_shell_0p85_1p06_lt15': 8, 'fail_count_core_lt5': 5, 'clusters_with_any_voxel_lt0p5mmhg': 0, 'min_fv_harmonic_face_mmhg': 11.9681, 'min_shell_0p95_1p06_mmhg': 12.0468, 'min_core_mmhg': 3.0256}, {'tile_index': 3, 'fail_count_fv_harmonic_face_lt15': 5, 'fail_count_shell_0p95_1p05_lt15': 6, 'fail_count_shell_0p95_1p06_lt15': 5, 'fail_count_shell_0p85_1p04_lt15': 8, 'fail_count_shell_0p85_1p06_lt15': 6, 'fail_count_core_lt5': 2, 'clusters_with_any_voxel_lt0p5mmhg': 0, 'min_fv_harmonic_face_mmhg': 13.5238, 'min_shell_0p95_1p06_mmhg': 13.5362, 'min_core_mmhg': 4.6282}, {'tile_index': 4, 'fail_count_fv_harmonic_face_lt15': 7, 'fail_count_shell_0p95_1p05_lt15': 8, 'fail_count_shell_0p95_1p06_lt15': 8, 'fail_count_shell_0p85_1p04_lt15': 11, 'fail_count_shell_0p85_1p06_lt15': 11, 'fail_count_core_lt5': 3, 'clusters_with_any_voxel_lt0p5mmhg': 0, 'min_fv_harmonic_face_mmhg': 13.1595, 'min_shell_0p95_1p06_mmhg': 13.2745, 'min_core_mmhg': 4.265}, {'tile_index': 5, 'fail_count_fv_harmonic_face_lt15': 6, 'fail_count_shell_0p95_1p05_lt15': 6, 'fail_count_shell_0p95_1p06_lt15': 6, 'fail_count_shell_0p85_1p04_lt15': 12, 'fail_count_shell_0p85_1p06_lt15': 10, 'fail_count_core_lt5': 3, 'clusters_with_any_voxel_lt0p5mmhg': 0, 'min_fv_harmonic_face_mmhg': 12.6556, 'min_shell_0p95_1p06_mmhg': 12.6386, 'min_core_mmhg': 3.272}, {'tile_index': 6, 'fail_count_fv_harmonic_face_lt15': 7, 'fail_count_shell_0p95_1p05_lt15': 8, 'fail_count_shell_0p95_1p06_lt15': 7, 'fail_count_shell_0p85_1p04_lt15': 13, 'fail_count_shell_0p85_1p06_lt15': 12, 'fail_count_core_lt5': 2, 'clusters_with_any_voxel_lt0p5mmhg': 0, 'min_fv_harmonic_face_mmhg': 12.3304, 'min_shell_0p95_1p06_mmhg': 12.3372, 'min_core_mmhg': 3.3774}, {'tile_index': 7, 'fail_count_fv_harmonic_face_lt15': 5, 'fail_count_shell_0p95_1p05_lt15': 6, 'fail_count_shell_0p95_1p06_lt15': 6, 'fail_count_shell_0p85_1p04_lt15': 10, 'fail_count_shell_0p85_1p06_lt15': 10, 'fail_count_core_lt5': 1, 'clusters_with_any_voxel_lt0p5mmhg': 0, 'min_fv_harmonic_face_mmhg': 12.5729, 'min_shell_0p95_1p06_mmhg': 12.7039, 'min_core_mmhg': 3.7694}, {'tile_index': 8, 'fail_count_fv_harmonic_face_lt15': 8, 'fail_count_shell_0p95_1p05_lt15': 8, 'fail_count_shell_0p95_1p06_lt15': 8, 'fail_count_shell_0p85_1p04_lt15': 12, 'fail_count_shell_0p85_1p06_lt15': 12, 'fail_count_core_lt5': 4, 'clusters_with_any_voxel_lt0p5mmhg': 0, 'min_fv_harmonic_face_mmhg': 12.701, 'min_shell_0p95_1p06_mmhg': 12.7745, 'min_core_mmhg': 3.8959}, {'tile_index': 9, 'fail_count_fv_harmonic_face_lt15': 6, 'fail_count_shell_0p95_1p05_lt15': 7, 'fail_count_shell_0p95_1p06_lt15': 7, 'fail_count_shell_0p85_1p04_lt15': 12, 'fail_count_shell_0p85_1p06_lt15': 12, 'fail_count_core_lt5': 3, 'clusters_with_any_voxel_lt0p5mmhg': 0, 'min_fv_harmonic_face_mmhg': 12.5229, 'min_shell_0p95_1p06_mmhg': 12.5721, 'min_core_mmhg': 3.5148}]

_IIP0019_MICROBEAD_H2O2_2P5UM_SWEEP: List[Dict[str, Any]] = [{'case_id': 'LayoutB_115um_Edge_PlaybookNominal_11271IU_t68', 'mesh_h_um': 2.5, 'd_bead_um': 115.0, 'bead_placement': 'edge', 't_half_h': 68.0, 'catalase_retention_pct': 100.0, 'physical_barrier_film_um': 0.0, 'barrier_film_k_cat_s_inv': 0.0, 'active_catalase_iu_200cm2_ref': 11270.5, 'active_catalase_iu_333cm2_rule_s6': 18784.2, 'islet_plane_max_h2o2_uM': 9.4155, 'islet_plane_mean_h2o2_uM': 3.9188, 'global_peak_pore_h2o2_uM': 9.4155, 'passes_2p5uM_tier1_target': False, 'passes_5p0uM_tier2_ceiling': False, 'rel_mass_balance_error': 5.1503196799553305e-12}, {'case_id': 'LayoutB_115um_Edge_EqualizedToDesignX_22680IU_t68', 'mesh_h_um': 2.5, 'd_bead_um': 115.0, 'bead_placement': 'edge', 't_half_h': 68.0, 'catalase_retention_pct': 100.0, 'physical_barrier_film_um': 0.0, 'barrier_film_k_cat_s_inv': 0.0, 'active_catalase_iu_200cm2_ref': 22680.0, 'active_catalase_iu_333cm2_rule_s6': 37800.0, 'islet_plane_max_h2o2_uM': 6.9055, 'islet_plane_mean_h2o2_uM': 2.0732, 'global_peak_pore_h2o2_uM': 6.9055, 'passes_2p5uM_tier1_target': False, 'passes_5p0uM_tier2_ceiling': False, 'rel_mass_balance_error': 1.234840636497649e-12}, {'case_id': 'DesignX_50um_Center_NoBarrier_22680IU_t24', 'mesh_h_um': 2.5, 'd_bead_um': 50.0, 'bead_placement': 'center', 't_half_h': 24.0, 'catalase_retention_pct': 100.0, 'physical_barrier_film_um': 0.0, 'barrier_film_k_cat_s_inv': 0.0, 'active_catalase_iu_200cm2_ref': 22680.0, 'active_catalase_iu_333cm2_rule_s6': 37800.0, 'islet_plane_max_h2o2_uM': 1.6327, 'islet_plane_mean_h2o2_uM': 1.5096, 'global_peak_pore_h2o2_uM': 17.8711, 'passes_2p5uM_tier1_target': True, 'passes_5p0uM_tier2_ceiling': True, 'rel_mass_balance_error': 1.1632291150482394e-16}, {'case_id': 'DesignX_50um_Edge_NoBarrier_22680IU_t68', 'mesh_h_um': 2.5, 'd_bead_um': 50.0, 'bead_placement': 'edge', 't_half_h': 68.0, 'catalase_retention_pct': 100.0, 'physical_barrier_film_um': 0.0, 'barrier_film_k_cat_s_inv': 0.0, 'active_catalase_iu_200cm2_ref': 22680.0, 'active_catalase_iu_333cm2_rule_s6': 37800.0, 'islet_plane_max_h2o2_uM': 6.8776, 'islet_plane_mean_h2o2_uM': 4.5222, 'global_peak_pore_h2o2_uM': 7.1853, 'passes_2p5uM_tier1_target': False, 'passes_5p0uM_tier2_ceiling': False, 'rel_mass_balance_error': 3.6135324715935213e-12}, {'case_id': 'DesignX_50um_Edge_NoBarrier_22680IU_t24', 'mesh_h_um': 2.5, 'd_bead_um': 50.0, 'bead_placement': 'edge', 't_half_h': 24.0, 'catalase_retention_pct': 100.0, 'physical_barrier_film_um': 0.0, 'barrier_film_k_cat_s_inv': 0.0, 'active_catalase_iu_200cm2_ref': 22680.0, 'active_catalase_iu_333cm2_rule_s6': 37800.0, 'islet_plane_max_h2o2_uM': 19.4908, 'islet_plane_mean_h2o2_uM': 12.8169, 'global_peak_pore_h2o2_uM': 20.3628, 'passes_2p5uM_tier1_target': False, 'passes_5p0uM_tier2_ceiling': False, 'rel_mass_balance_error': 4.652916460192958e-16}, {'case_id': 'DesignX_50um_Edge_EmptyHydrogelSpacer20um_0IU_Film_22680IU_t24', 'mesh_h_um': 2.5, 'd_bead_um': 50.0, 'bead_placement': 'edge', 't_half_h': 24.0, 'catalase_retention_pct': 100.0, 'physical_barrier_film_um': 20.0, 'barrier_film_k_cat_s_inv': 0.0, 'active_catalase_iu_200cm2_ref': 22680.0, 'active_catalase_iu_333cm2_rule_s6': 37800.0, 'islet_plane_max_h2o2_uM': 11.247, 'islet_plane_mean_h2o2_uM': 10.6957, 'global_peak_pore_h2o2_uM': 20.3668, 'passes_2p5uM_tier1_target': False, 'passes_5p0uM_tier2_ceiling': False, 'rel_mass_balance_error': 2.326458230096479e-16}, {'case_id': 'DesignX_50um_Edge_EqualTotalInventorySplit_22680IU_t68_100pct', 'mesh_h_um': 2.5, 'd_bead_um': 50.0, 'bead_placement': 'edge', 't_half_h': 68.0, 'catalase_retention_pct': 100.0, 'physical_barrier_film_um': 20.0, 'barrier_film_k_cat_s_inv': 13.5, 'active_catalase_iu_200cm2_ref': 22680.0, 'active_catalase_iu_333cm2_rule_s6': 37800.0, 'islet_plane_max_h2o2_uM': 0.9931, 'islet_plane_mean_h2o2_uM': 0.9524, 'global_peak_pore_h2o2_uM': 12.0464, 'passes_2p5uM_tier1_target': True, 'passes_5p0uM_tier2_ceiling': True, 'rel_mass_balance_error': 7.003279048603679e-12}, {'case_id': 'DesignX_50um_Edge_EqualTotalInventorySplit_22680IU_t68_50pctWashout', 'mesh_h_um': 2.5, 'd_bead_um': 50.0, 'bead_placement': 'edge', 't_half_h': 68.0, 'catalase_retention_pct': 50.0, 'physical_barrier_film_um': 20.0, 'barrier_film_k_cat_s_inv': 6.75, 'active_catalase_iu_200cm2_ref': 11340.0, 'active_catalase_iu_333cm2_rule_s6': 18900.0, 'islet_plane_max_h2o2_uM': 2.8237, 'islet_plane_mean_h2o2_uM': 2.7842, 'global_peak_pore_h2o2_uM': 16.7375, 'passes_2p5uM_tier1_target': False, 'passes_5p0uM_tier2_ceiling': True, 'rel_mass_balance_error': 1.8119406666435335e-11}, {'case_id': 'DesignX_50um_Edge_EqualTotalInventorySplit_22680IU_t24_100pct', 'mesh_h_um': 2.5, 'd_bead_um': 50.0, 'bead_placement': 'edge', 't_half_h': 24.0, 'catalase_retention_pct': 100.0, 'physical_barrier_film_um': 20.0, 'barrier_film_k_cat_s_inv': 13.5, 'active_catalase_iu_200cm2_ref': 22680.0, 'active_catalase_iu_333cm2_rule_s6': 37800.0, 'islet_plane_max_h2o2_uM': 2.815, 'islet_plane_mean_h2o2_uM': 2.6996, 'global_peak_pore_h2o2_uM': 34.1413, 'passes_2p5uM_tier1_target': False, 'passes_5p0uM_tier2_ceiling': True, 'rel_mass_balance_error': 1.1632291150482394e-16}, {'case_id': 'DesignX_50um_Edge_Underdosed5400IU_Film_28080IU_t24_50pctWashout', 'mesh_h_um': 2.5, 'd_bead_um': 50.0, 'bead_placement': 'edge', 't_half_h': 24.0, 'catalase_retention_pct': 50.0, 'physical_barrier_film_um': 20.0, 'barrier_film_k_cat_s_inv': 2.25, 'active_catalase_iu_200cm2_ref': 14040.0, 'active_catalase_iu_333cm2_rule_s6': 23400.0, 'islet_plane_max_h2o2_uM': 10.452, 'islet_plane_mean_h2o2_uM': 10.0587, 'global_peak_pore_h2o2_uM': 27.9326, 'passes_2p5uM_tier1_target': False, 'passes_5p0uM_tier2_ceiling': False, 'rel_mass_balance_error': 0.0}, {'case_id': 'DesignX_50um_Edge_Full18sBarrier20um_44280IU_t68_100pct', 'mesh_h_um': 2.5, 'd_bead_um': 50.0, 'bead_placement': 'edge', 't_half_h': 68.0, 'catalase_retention_pct': 100.0, 'physical_barrier_film_um': 20.0, 'barrier_film_k_cat_s_inv': 18.0, 'active_catalase_iu_200cm2_ref': 44280.0, 'active_catalase_iu_333cm2_rule_s6': 73800.0, 'islet_plane_max_h2o2_uM': 0.3996, 'islet_plane_mean_h2o2_uM': 0.3459, 'global_peak_pore_h2o2_uM': 6.2332, 'passes_2p5uM_tier1_target': True, 'passes_5p0uM_tier2_ceiling': True, 'rel_mass_balance_error': 1.4053358681936132e-12}, {'case_id': 'DesignX_50um_Edge_Full18sBarrier20um_44280IU_t24_100pct', 'mesh_h_um': 2.5, 'd_bead_um': 50.0, 'bead_placement': 'edge', 't_half_h': 24.0, 'catalase_retention_pct': 100.0, 'physical_barrier_film_um': 20.0, 'barrier_film_k_cat_s_inv': 18.0, 'active_catalase_iu_200cm2_ref': 44280.0, 'active_catalase_iu_333cm2_rule_s6': 73800.0, 'islet_plane_max_h2o2_uM': 1.1324, 'islet_plane_mean_h2o2_uM': 0.9804, 'global_peak_pore_h2o2_uM': 17.6643, 'passes_2p5uM_tier1_target': True, 'passes_5p0uM_tier2_ceiling': True, 'rel_mass_balance_error': 0.0}, {'case_id': 'DesignX_50um_Edge_Full18sBarrier20um_22140IU_t68_50pctWashout', 'mesh_h_um': 2.5, 'd_bead_um': 50.0, 'bead_placement': 'edge', 't_half_h': 68.0, 'catalase_retention_pct': 50.0, 'physical_barrier_film_um': 20.0, 'barrier_film_k_cat_s_inv': 9.0, 'active_catalase_iu_200cm2_ref': 22140.0, 'active_catalase_iu_333cm2_rule_s6': 36900.0, 'islet_plane_max_h2o2_uM': 1.2713, 'islet_plane_mean_h2o2_uM': 1.1962, 'global_peak_pore_h2o2_uM': 9.3108, 'passes_2p5uM_tier1_target': True, 'passes_5p0uM_tier2_ceiling': True, 'rel_mass_balance_error': 4.624359185418524e-12}, {'case_id': 'DesignX_50um_Edge_Full18sBarrier20um_22140IU_t24_50pctWashout', 'mesh_h_um': 2.5, 'd_bead_um': 50.0, 'bead_placement': 'edge', 't_half_h': 24.0, 'catalase_retention_pct': 50.0, 'physical_barrier_film_um': 20.0, 'barrier_film_k_cat_s_inv': 9.0, 'active_catalase_iu_200cm2_ref': 22140.0, 'active_catalase_iu_333cm2_rule_s6': 36900.0, 'islet_plane_max_h2o2_uM': 3.6032, 'islet_plane_mean_h2o2_uM': 3.3906, 'global_peak_pore_h2o2_uM': 26.3875, 'passes_2p5uM_tier1_target': False, 'passes_5p0uM_tier2_ceiling': True, 'rel_mass_balance_error': 1.1632291150482394e-16}]

_IIP0019_BARRIER_MESH_CONVERGENCE_RUNS: List[Dict[str, Any]] = [{'case_id': 'MeshConv_5p0um_DesignX_50um_Edge_Full18sBarrier20um_t24', 'mesh_h_um': 5.0, 'd_bead_um': 50.0, 'bead_placement': 'edge', 't_half_h': 24.0, 'catalase_retention_pct': 100.0, 'physical_barrier_film_um': 20.0, 'barrier_film_k_cat_s_inv': 18.0, 'active_catalase_iu_200cm2_ref': 44280.0, 'active_catalase_iu_333cm2_rule_s6': 73800.0, 'islet_plane_max_h2o2_uM': 1.0947, 'islet_plane_mean_h2o2_uM': 0.97, 'global_peak_pore_h2o2_uM': 16.351, 'passes_2p5uM_tier1_target': True, 'passes_5p0uM_tier2_ceiling': True, 'rel_mass_balance_error': 2.32645823009648e-16}, {'case_id': 'MeshConv_2p5um_DesignX_50um_Edge_Full18sBarrier20um_t24', 'mesh_h_um': 2.5, 'd_bead_um': 50.0, 'bead_placement': 'edge', 't_half_h': 24.0, 'catalase_retention_pct': 100.0, 'physical_barrier_film_um': 20.0, 'barrier_film_k_cat_s_inv': 18.0, 'active_catalase_iu_200cm2_ref': 44280.0, 'active_catalase_iu_333cm2_rule_s6': 73800.0, 'islet_plane_max_h2o2_uM': 1.1324, 'islet_plane_mean_h2o2_uM': 0.9804, 'global_peak_pore_h2o2_uM': 17.6643, 'passes_2p5uM_tier1_target': True, 'passes_5p0uM_tier2_ceiling': True, 'rel_mass_balance_error': 0.0}, {'case_id': 'MeshConv_1p25um_DesignX_50um_Edge_Full18sBarrier20um_t24', 'mesh_h_um': 1.25, 'd_bead_um': 50.0, 'bead_placement': 'edge', 't_half_h': 24.0, 'catalase_retention_pct': 100.0, 'physical_barrier_film_um': 20.0, 'barrier_film_k_cat_s_inv': 18.0, 'active_catalase_iu_200cm2_ref': 44280.0, 'active_catalase_iu_333cm2_rule_s6': 73800.0, 'islet_plane_max_h2o2_uM': 1.1691, 'islet_plane_mean_h2o2_uM': 1.0013, 'global_peak_pore_h2o2_uM': 20.2154, 'passes_2p5uM_tier1_target': True, 'passes_5p0uM_tier2_ceiling': True, 'rel_mass_balance_error': 3.347028926475202e-11}]

_IIP0019_ZERO_CAO2_140UM_MATRIX: List[Dict[str, Any]] = [{'scenario_id': 'Acute_Surgical_Pocket_65um_35mmHg_2000IEQ_AcuteGel', 'areal_loading_ieq_cm2': 2000.0, 'cluster_diam_um': 100.0, 'bed_po2_mmhg': 35.0, 'standoff_um': 65.0, 'plain_hydrogel_0pct_struts': {'pericellular_interface_po2_mmhg': 3.8208, 'outer_shell_po2_mmhg': 3.2817, 'min_core_po2_mmhg': 0.0467, 'voxel_frac_below_0p5mmhg_pct': 20.415, 'passes_15mmhg_interface_and_core_gate': False, 'passes_15mmhg_outer_shell_and_core_gate': False}, 'exploratory_18pct_breathable_dividers': {'pericellular_interface_po2_mmhg': 5.7701, 'outer_shell_po2_mmhg': 5.0909, 'min_core_po2_mmhg': 0.1997, 'voxel_frac_below_0p5mmhg_pct': 3.489, 'passes_15mmhg_interface_and_core_gate': False, 'passes_15mmhg_outer_shell_and_core_gate': False}}, {'scenario_id': 'Einstein2023_EmptyDeviceLumen_12mmHg_15um_2000IEQ_PMID38993891', 'areal_loading_ieq_cm2': 2000.0, 'cluster_diam_um': 100.0, 'bed_po2_mmhg': 12.0, 'standoff_um': 15.0, 'plain_hydrogel_0pct_struts': {'pericellular_interface_po2_mmhg': 2.0609, 'outer_shell_po2_mmhg': 1.7096, 'min_core_po2_mmhg': 0.0082, 'voxel_frac_below_0p5mmhg_pct': 44.835, 'passes_15mmhg_interface_and_core_gate': False, 'passes_15mmhg_outer_shell_and_core_gate': False}, 'exploratory_18pct_breathable_dividers': {'pericellular_interface_po2_mmhg': 3.0537, 'outer_shell_po2_mmhg': 2.5879, 'min_core_po2_mmhg': 0.0181, 'voxel_frac_below_0p5mmhg_pct': 24.076, 'passes_15mmhg_interface_and_core_gate': False, 'passes_15mmhg_outer_shell_and_core_gate': False}}, {'scenario_id': 'Playbook_DesignZ_Z02_Benchmark_25mmHg_15um_1500IEQ_80umCluster_AcuteGel', 'areal_loading_ieq_cm2': 1500.0, 'cluster_diam_um': 80.0, 'bed_po2_mmhg': 25.0, 'standoff_um': 15.0, 'plain_hydrogel_0pct_struts': {'pericellular_interface_po2_mmhg': 6.1036, 'outer_shell_po2_mmhg': 5.634, 'min_core_po2_mmhg': 1.6576, 'voxel_frac_below_0p5mmhg_pct': 0.0, 'passes_15mmhg_interface_and_core_gate': False, 'passes_15mmhg_outer_shell_and_core_gate': False}, 'exploratory_18pct_breathable_dividers': {'pericellular_interface_po2_mmhg': 12.4914, 'outer_shell_po2_mmhg': 11.9832, 'min_core_po2_mmhg': 7.5254, 'voxel_frac_below_0p5mmhg_pct': 0.0, 'passes_15mmhg_interface_and_core_gate': False, 'passes_15mmhg_outer_shell_and_core_gate': False}}, {'scenario_id': 'Prepared_Bed_MicroOptode_35mmHg_20um_1500IEQ_AcuteGel', 'areal_loading_ieq_cm2': 1500.0, 'cluster_diam_um': 100.0, 'bed_po2_mmhg': 35.0, 'standoff_um': 20.0, 'plain_hydrogel_0pct_struts': {'pericellular_interface_po2_mmhg': 14.4605, 'outer_shell_po2_mmhg': 13.6915, 'min_core_po2_mmhg': 6.7248, 'voxel_frac_below_0p5mmhg_pct': 0.0, 'passes_15mmhg_interface_and_core_gate': False, 'passes_15mmhg_outer_shell_and_core_gate': False}, 'exploratory_18pct_breathable_dividers': {'pericellular_interface_po2_mmhg': 19.3645, 'outer_shell_po2_mmhg': 18.5653, 'min_core_po2_mmhg': 11.4547, 'voxel_frac_below_0p5mmhg_pct': 0.0, 'passes_15mmhg_interface_and_core_gate': True, 'passes_15mmhg_outer_shell_and_core_gate': True}}, {'scenario_id': 'Prepared_Arterialized_Bed_40mmHg_15um_1500IEQ_AcuteGel', 'areal_loading_ieq_cm2': 1500.0, 'cluster_diam_um': 100.0, 'bed_po2_mmhg': 40.0, 'standoff_um': 15.0, 'plain_hydrogel_0pct_struts': {'pericellular_interface_po2_mmhg': 20.2925, 'outer_shell_po2_mmhg': 19.5127, 'min_core_po2_mmhg': 12.4044, 'voxel_frac_below_0p5mmhg_pct': 0.0, 'passes_15mmhg_interface_and_core_gate': True, 'passes_15mmhg_outer_shell_and_core_gate': True}, 'exploratory_18pct_breathable_dividers': {'pericellular_interface_po2_mmhg': 25.4941, 'outer_shell_po2_mmhg': 24.6883, 'min_core_po2_mmhg': 17.5057, 'voxel_frac_below_0p5mmhg_pct': 0.0, 'passes_15mmhg_interface_and_core_gate': True, 'passes_15mmhg_outer_shell_and_core_gate': True}}, {'scenario_id': 'Prepared_Arterialized_Bed_40mmHg_15um_2000IEQ_ChronicGel', 'areal_loading_ieq_cm2': 2000.0, 'cluster_diam_um': 100.0, 'bed_po2_mmhg': 40.0, 'standoff_um': 15.0, 'plain_hydrogel_0pct_struts': {'pericellular_interface_po2_mmhg': 22.2759, 'outer_shell_po2_mmhg': 21.5624, 'min_core_po2_mmhg': 14.4219, 'voxel_frac_below_0p5mmhg_pct': 0.0, 'passes_15mmhg_interface_and_core_gate': True, 'passes_15mmhg_outer_shell_and_core_gate': True}, 'exploratory_18pct_breathable_dividers': {'pericellular_interface_po2_mmhg': 27.1014, 'outer_shell_po2_mmhg': 26.3688, 'min_core_po2_mmhg': 19.1951, 'voxel_frac_below_0p5mmhg_pct': 0.0, 'passes_15mmhg_interface_and_core_gate': True, 'passes_15mmhg_outer_shell_and_core_gate': True}}, {'scenario_id': 'Chronic_Pruned_Bed_35mmHg_45um_2000IEQ_kperf0p045', 'areal_loading_ieq_cm2': 2000.0, 'cluster_diam_um': 100.0, 'bed_po2_mmhg': 35.0, 'standoff_um': 45.0, 'plain_hydrogel_0pct_struts': {'pericellular_interface_po2_mmhg': 8.3444, 'outer_shell_po2_mmhg': 7.6244, 'min_core_po2_mmhg': 0.9439, 'voxel_frac_below_0p5mmhg_pct': 0.0, 'passes_15mmhg_interface_and_core_gate': False, 'passes_15mmhg_outer_shell_and_core_gate': False}, 'exploratory_18pct_breathable_dividers': {'pericellular_interface_po2_mmhg': 11.5937, 'outer_shell_po2_mmhg': 10.8221, 'min_core_po2_mmhg': 3.4202, 'voxel_frac_below_0p5mmhg_pct': 0.0, 'passes_15mmhg_interface_and_core_gate': False, 'passes_15mmhg_outer_shell_and_core_gate': False}}, {'scenario_id': 'Chronic_RuleS6_Derated_35mmHg_45um_1500IEQ_NominalPerf', 'areal_loading_ieq_cm2': 1500.0, 'cluster_diam_um': 100.0, 'bed_po2_mmhg': 35.0, 'standoff_um': 45.0, 'plain_hydrogel_0pct_struts': {'pericellular_interface_po2_mmhg': 16.1251, 'outer_shell_po2_mmhg': 15.3421, 'min_core_po2_mmhg': 7.6988, 'voxel_frac_below_0p5mmhg_pct': 0.0, 'passes_15mmhg_interface_and_core_gate': True, 'passes_15mmhg_outer_shell_and_core_gate': True}, 'exploratory_18pct_breathable_dividers': {'pericellular_interface_po2_mmhg': 17.7071, 'outer_shell_po2_mmhg': 16.9108, 'min_core_po2_mmhg': 9.2124, 'voxel_frac_below_0p5mmhg_pct': 0.0, 'passes_15mmhg_interface_and_core_gate': True, 'passes_15mmhg_outer_shell_and_core_gate': True}}]

_IIP0019_RETRACTED_2500IEQ_SINGLE_POUCH_CASES: List[Dict[str, Any]] = [{'areal_loading_ieq_cm2': 2500.0, 'cluster_diam_um': 120.0, 'square_lattice_pitch_um': 202.39, 'hexagonal_lattice_pitch_um': 217.48, 'ocr_multiplier': 1.097, 'capsule_standoff_um': 45.0, 'nominal_strut_phi': 0.0, 'realized_strut_phi': 0.0, 'k_perf_s_inv': 0.1358, 'nx_lateral': 40, 'pericellular_interface_po2_mmhg_0p95_to_1p05R': 9.4351, 'outer_shell_po2_mmhg_0p85_to_1p04R': 8.3732, 'min_core_po2_mmhg': 0.0529, 'passes_rule_s6_15mmhg_interface_and_5mmhg_core': False, 'passes_conservative_15mmhg_outer_shell_and_5mmhg_core': False, 'rel_mass_balance_error': 1.0423648517716535e-13}, {'areal_loading_ieq_cm2': 2500.0, 'cluster_diam_um': 100.0, 'square_lattice_pitch_um': 153.96, 'hexagonal_lattice_pitch_um': 165.44, 'ocr_multiplier': 1.097, 'capsule_standoff_um': 45.0, 'nominal_strut_phi': 0.18, 'realized_strut_phi': 0.1378, 'k_perf_s_inv': 0.1358, 'nx_lateral': 28, 'pericellular_interface_po2_mmhg_0p95_to_1p05R': 11.2957, 'outer_shell_po2_mmhg_0p85_to_1p04R': 10.5405, 'min_core_po2_mmhg': 2.7044, 'passes_rule_s6_15mmhg_interface_and_5mmhg_core': False, 'passes_conservative_15mmhg_outer_shell_and_5mmhg_core': False, 'rel_mass_balance_error': 1.4875490262669173e-16}, {'areal_loading_ieq_cm2': 2500.0, 'cluster_diam_um': 100.0, 'square_lattice_pitch_um': 153.96, 'hexagonal_lattice_pitch_um': 165.44, 'ocr_multiplier': 1.097, 'capsule_standoff_um': 45.0, 'nominal_strut_phi': 0.18, 'realized_strut_phi': 0.2028, 'k_perf_s_inv': 0.1358, 'nx_lateral': 56, 'pericellular_interface_po2_mmhg_0p95_to_1p05R': 11.3694, 'outer_shell_po2_mmhg_0p85_to_1p04R': 10.5753, 'min_core_po2_mmhg': 2.8093, 'passes_rule_s6_15mmhg_interface_and_5mmhg_core': False, 'passes_conservative_15mmhg_outer_shell_and_5mmhg_core': False, 'rel_mass_balance_error': 1.3373777455413426e-15}, {'areal_loading_ieq_cm2': 2500.0, 'cluster_diam_um': 100.0, 'square_lattice_pitch_um': 153.96, 'hexagonal_lattice_pitch_um': 165.44, 'ocr_multiplier': 1.097, 'capsule_standoff_um': 45.0, 'nominal_strut_phi': 0.18, 'realized_strut_phi': 0.19, 'k_perf_s_inv': 0.045, 'nx_lateral': 40, 'pericellular_interface_po2_mmhg_0p95_to_1p05R': 7.6257, 'outer_shell_po2_mmhg_0p85_to_1p04R': 6.9396, 'min_core_po2_mmhg': 0.3251, 'passes_rule_s6_15mmhg_interface_and_5mmhg_core': False, 'passes_conservative_15mmhg_outer_shell_and_5mmhg_core': False, 'rel_mass_balance_error': 1.290461641056404e-13}]


def _req_iip_0019(cond: bool, msg: str) -> None:
    if not cond:
        raise RuntimeError(msg)


def _harm_mean_iip_0019(a: np.ndarray, b: np.ndarray) -> np.ndarray:
    s = a + b
    return np.where(s > 0.0, 2.0 * a * b / np.where(s > 0.0, s, 1.0), 0.0)


class PureNumpy3DFVOperator:
    """Matrix-free 3D finite-volume stencil operator (periodic X/Y, Robin/Dirichlet Z) using pure NumPy."""

    def __init__(
        self,
        d_field: np.ndarray,
        dx: float,
        dy: float,
        dz: float,
        standoff_z_cm: float = 0.0,
        d_ext_scalar: float | None = None,
        use_arithmetic_wrong_control: bool = False,
    ) -> None:
        self.shape = d_field.shape
        avg_fn = (lambda x, y: 0.5 * (x + y)) if use_arithmetic_wrong_control else _harm_mean_iip_0019
        self.gx = avg_fn(d_field, np.roll(d_field, -1, axis=0)) / (dx * dx)
        self.gx_m = np.roll(self.gx, 1, axis=0)
        self.gy = avg_fn(d_field, np.roll(d_field, -1, axis=1)) / (dy * dy)
        self.gy_m = np.roll(self.gy, 1, axis=1)
        self.gz = avg_fn(d_field[:, :, :-1], d_field[:, :, 1:]) / (dz * dz) if d_field.shape[2] > 1 else None

        self.b_rob = np.zeros_like(d_field, dtype=np.float64)
        self.neg_diag = self.gx + self.gx_m + self.gy + self.gy_m
        if self.gz is not None:
            self.neg_diag[:, :, :-1] += self.gz
            self.neg_diag[:, :, 1:] += self.gz

        for k_face in (0, d_field.shape[2] - 1):
            df = d_field[:, :, k_face]
            de = df if d_ext_scalar is None else np.full_like(df, float(d_ext_scalar))
            r_tot = np.where(
                df > 0.0,
                (0.5 * dz) / np.maximum(df, 1e-30) + standoff_z_cm / np.maximum(de, 1e-30),
                np.inf,
            )
            gf = np.where(np.isfinite(r_tot), 1.0 / (dz * r_tot), 0.0)
            self.neg_diag[:, :, k_face] += gf
            self.b_rob[:, :, k_face] += gf

    def apply_A(self, u: np.ndarray) -> np.ndarray:
        u3 = u.reshape(self.shape)
        out = (
            self.gx * np.roll(u3, -1, axis=0)
            + self.gx_m * np.roll(u3, 1, axis=0)
            + self.gy * np.roll(u3, -1, axis=1)
            + self.gy_m * np.roll(u3, 1, axis=1)
            - self.neg_diag * u3
        )
        if self.gz is not None:
            out[:, :, :-1] += self.gz * u3[:, :, 1:]
            out[:, :, 1:] += self.gz * u3[:, :, :-1]
        return out.ravel()


def _pcg_solve_spd_iip_0019(
    op: PureNumpy3DFVOperator,
    react_diag: np.ndarray,
    rhs: np.ndarray,
    rtol: float = 1e-12,
    maxiter: int = 1800,
    fail_on_maxiter: bool = False,
) -> np.ndarray:
    diag_tot = op.neg_diag.ravel() + react_diag
    m_inv = 1.0 / np.maximum(diag_tot, 1e-30)
    x = np.zeros_like(rhs)
    r = rhs.copy()
    rhs_norm = float(np.linalg.norm(rhs))
    if rhs_norm <= 1e-30:
        return x
    z = m_inv * r
    p_dir = z.copy()
    rz_old = float(np.dot(r, z))
    tol_abs = rtol * rhs_norm
    converged = False
    for _ in range(maxiter):
        ap = (-op.apply_A(p_dir)) + react_diag * p_dir
        denom = float(np.dot(p_dir, ap))
        if denom <= 1e-35:
            break
        alpha = rz_old / denom
        x += alpha * p_dir
        r -= alpha * ap
        if float(np.linalg.norm(r)) <= tol_abs:
            converged = True
            break
        z = m_inv * r
        rz_new = float(np.dot(r, z))
        beta = rz_new / max(rz_old, 1e-35)
        p_dir = z + beta * p_dir
        rz_old = rz_new
    if fail_on_maxiter and not converged:
        raise RuntimeError(f"Fail-closed PCG non-convergence after {maxiter} iterations")
    return x


def _solve_3d_oxygen_strict_iip_0019(
    perm: np.ndarray,
    vmax: np.ndarray,
    src: np.ndarray,
    kp: np.ndarray,
    dx: float,
    dy: float,
    dz: float,
    p_bed: float,
    standoff_z_cm: float = 0.0,
    p_ext: float | None = None,
    max_newton_iter: int = 45,
    tol_rel: float = 1e-12,
) -> Dict[str, Any]:
    op = PureNumpy3DFVOperator(perm, dx, dy, dz, standoff_z_cm=standoff_z_cm, d_ext_scalar=p_ext)
    b_rob = op.b_rob.ravel()
    v_f = vmax.ravel()
    s_f = src.ravel()
    k_f = (kp * ALPHA_BUNSEN_MOL_CM3_MMHG).ravel()
    scale = max(float(np.max(v_f)), float(np.max(s_f)), float(np.max(b_rob * max(p_bed, 1.0))), 1e-12)

    p = np.full(perm.size, p_bed, dtype=np.float64)
    converged = False
    iters_used = 0
    for it in range(1, max_newton_iter + 1):
        iters_used = it
        mm = p / (KM_O2_MMHG + p)
        dmm = KM_O2_MMHG / ((KM_O2_MMHG + p) ** 2)
        f = op.apply_A(p) + b_rob * p_bed + s_f - v_f * mm + k_f * (p_bed - p)
        if float(np.max(np.abs(f))) / scale <= tol_rel and it >= 2:
            converged = True
            break
        dp = _pcg_solve_spd_iip_0019(op, v_f * dmm + k_f, f, rtol=1e-13, maxiter=2500)
        p = np.maximum(0.0, p + dp)

    mm_final = p / (KM_O2_MMHG + p)
    ap_final = op.apply_A(p)
    f_post = ap_final + b_rob * p_bed + s_f - v_f * mm_final + k_f * (p_bed - p)
    post_rel_residual = float(np.max(np.abs(f_post))) / scale
    if (not converged and post_rel_residual > 1e-9) or post_rel_residual > 1e-9:
        raise RuntimeError(f"Fail-closed O2 Newton non-convergence: {post_rel_residual:.3e}")

    dv = dx * dy * dz
    boundary_in = float(np.sum((ap_final + b_rob * p_bed) * dv))
    total_gen = float(np.sum((s_f + k_f * (p_bed - p)) * dv))
    total_sink = float(np.sum(v_f * mm_final * dv))
    flux_scale = max(abs(boundary_in), abs(total_gen), abs(total_sink), 1e-30)
    rel_mass_balance_err = abs(boundary_in + total_gen - total_sink) / flux_scale
    if rel_mass_balance_err > 1e-10:
        raise RuntimeError(f"Fail-closed O2 mass-balance violation: {rel_mass_balance_err:.3e}")

    return {
        "p_3d": p.reshape(perm.shape),
        "post_update_rel_residual": post_rel_residual,
        "rel_mass_balance_error": rel_mass_balance_err,
        "newton_iterations": iters_used,
    }


def _solve_3d_h2o2_strict_iip_0019(
    diff: np.ndarray,
    src: np.ndarray,
    kcat: np.ndarray,
    kp: np.ndarray,
    dx: float,
    dy: float,
    dz: float,
    max_newton_iter: int = 35,
    tol_rel: float = 1e-11,
) -> Dict[str, Any]:
    op = PureNumpy3DFVOperator(diff, dx, dy, dz, standoff_z_cm=0.0, d_ext_scalar=D_H2O2_HYDROGEL_CM2_S)
    s_f = src.ravel()
    kc_f = kcat.ravel()
    kp_f = kp.ravel()
    km = 25000.0
    scale = max(float(np.max(s_f)), 1e-12)

    h = np.zeros(diff.size, dtype=np.float64)
    converged = False
    iters_used = 0
    for it in range(1, max_newton_iter + 1):
        iters_used = it
        cat = kc_f * h / (1.0 + h / km)
        dcat = kc_f / ((1.0 + h / km) ** 2)
        f = op.apply_A(h) + s_f - cat - kp_f * h
        if float(np.max(np.abs(f))) / scale <= tol_rel and it >= 2:
            converged = True
            break
        dh = _pcg_solve_spd_iip_0019(op, dcat + kp_f, f, rtol=1e-12, maxiter=1800)
        h = np.maximum(0.0, h + dh)

    cat_final = kc_f * h / (1.0 + h / km)
    ah_final = op.apply_A(h)
    f_post = ah_final + s_f - cat_final - kp_f * h
    post_rel_residual = float(np.max(np.abs(f_post))) / scale
    if (not converged and post_rel_residual > 1e-10) or post_rel_residual > 1e-10:
        raise RuntimeError(f"Fail-closed H2O2 Newton non-convergence: {post_rel_residual:.3e}")

    dv = dx * dy * dz
    boundary_net = float(np.sum(ah_final * dv))
    total_src = float(np.sum(s_f * dv))
    total_rem = float(np.sum((cat_final + kp_f * h) * dv))
    flux_scale = max(abs(boundary_net), abs(total_src), abs(total_rem), 1e-30)
    rel_mass_balance_err = abs(boundary_net + total_src - total_rem) / flux_scale
    if rel_mass_balance_err > 1e-10:
        raise RuntimeError(f"Fail-closed H2O2 mass-balance violation: {rel_mass_balance_err:.3e}")

    return {
        "h_3d": h.reshape(diff.shape),
        "decomp_uM_s": cat_final.reshape(diff.shape),
        "post_update_rel_residual": post_rel_residual,
        "rel_mass_balance_error": rel_mass_balance_err,
        "newton_iterations": iters_used,
    }


def _compute_exact_fv_interface_stats_iip_0019(p3: np.ndarray, perm: np.ndarray, mask: np.ndarray) -> Dict[str, float]:
    face_vals: List[np.ndarray] = []
    for shift in (-1, 1):
        nbr_mask = np.roll(mask, shift, axis=0)
        bnd = mask & (~nbr_mask)
        if np.any(bnd):
            d_in, d_out = perm[bnd], np.roll(perm, shift, axis=0)[bnd]
            face_vals.append((d_in * p3[bnd] + d_out * np.roll(p3, shift, axis=0)[bnd]) / np.maximum(d_in + d_out, 1e-30))
    for shift in (-1, 1):
        nbr_mask = np.roll(mask, shift, axis=1)
        bnd = mask & (~nbr_mask)
        if np.any(bnd):
            d_in, d_out = perm[bnd], np.roll(perm, shift, axis=1)[bnd]
            face_vals.append((d_in * p3[bnd] + d_out * np.roll(p3, shift, axis=1)[bnd]) / np.maximum(d_in + d_out, 1e-30))
    if mask.shape[2] > 1:
        bnd_up = mask[:, :, :-1] & (~mask[:, :, 1:])
        if np.any(bnd_up):
            d_in, d_out = perm[:, :, :-1][bnd_up], perm[:, :, 1:][bnd_up]
            face_vals.append((d_in * p3[:, :, :-1][bnd_up] + d_out * p3[:, :, 1:][bnd_up]) / np.maximum(d_in + d_out, 1e-30))
        bnd_dn = mask[:, :, 1:] & (~mask[:, :, :-1])
        if np.any(bnd_dn):
            d_in, d_out = perm[:, :, 1:][bnd_dn], perm[:, :, :-1][bnd_dn]
            face_vals.append((d_in * p3[:, :, 1:][bnd_dn] + d_out * p3[:, :, :-1][bnd_dn]) / np.maximum(d_in + d_out, 1e-30))
    all_faces = np.concatenate(face_vals)
    eroded = (
        mask
        & np.roll(mask, -1, axis=0)
        & np.roll(mask, 1, axis=0)
        & np.roll(mask, -1, axis=1)
        & np.roll(mask, 1, axis=1)
    )
    z_eroded = np.zeros_like(mask)
    z_eroded[:, :, 1:-1] = mask[:, :, :-2] & mask[:, :, 2:]
    inner_surf = mask & (~(eroded & z_eroded))
    return {
        "fv_harmonic_face_mean_mmhg": float(np.mean(all_faces)),
        "fv_harmonic_face_min_mmhg": float(np.min(all_faces)),
        "inner_surface_voxel_mean_mmhg": float(np.mean(p3[inner_surf])),
    }


def _sample_rsa_2d_iip_0019(n_cl: int, side_cm: float, min_dist_cm: float, rng: np.random.Generator) -> List[np.ndarray]:
    pts: List[np.ndarray] = []
    for _ in range(n_cl):
        for _ in range(8000):
            cand = rng.uniform(-0.5 * side_cm, 0.5 * side_cm, size=2)
            if all(
                float(
                    np.hypot(
                        min(abs(cand[0] - q[0]), side_cm - abs(cand[0] - q[0])),
                        min(abs(cand[1] - q[1]), side_cm - abs(cand[1] - q[1])),
                    )
                )
                >= min_dist_cm
                for q in pts
            ):
                pts.append(cand)
                break
    _req_iip_0019(len(pts) == n_cl, "RSA packing failed")
    return pts


def _generate_deterministic_rsa_tiles_iip_0019() -> List[Dict[str, Any]]:
    rad_cm = 0.0050
    vol_sph = (4.0 / 3.0) * math.pi * (rad_cm ** 3)
    n_per_face = 8
    side_cm = math.sqrt(n_per_face / (0.5 * ((1500.0 * VOL_1_IEQ_CM3) / vol_sph)))
    side_um = side_cm * 1e4
    rng = np.random.default_rng(20261115)
    tiles_out: List[Dict[str, Any]] = []
    for tile_idx in range(10):
        top_pts = _sample_rsa_2d_iip_0019(n_per_face, side_cm, 2.02 * rad_cm, rng)
        bot_pts = _sample_rsa_2d_iip_0019(n_per_face, side_cm, 2.02 * rad_cm, rng)
        min_gaps: List[float] = []
        for pts in (top_pts, bot_pts):
            mg = 1e9
            for i in range(n_per_face):
                for j in range(i + 1, n_per_face):
                    dxp = min(abs(float(pts[i][0] - pts[j][0])), side_cm - abs(float(pts[i][0] - pts[j][0])))
                    dyp = min(abs(float(pts[i][1] - pts[j][1])), side_cm - abs(float(pts[i][1] - pts[j][1])))
                    mg = min(mg, (math.hypot(dxp, dyp) - 2.0 * rad_cm) * 1e4)
            min_gaps.append(round(mg, 2))
        merged = dict(_IIP0019_RSA_PRECOMPUTED_TILE_METRICS[tile_idx])
        merged["tile_side_um"] = round(side_um, 2)
        merged["top_centers_um"] = [[round(float(p[0]) * 1e4, 2), round(float(p[1]) * 1e4, 2)] for p in top_pts]
        merged["bot_centers_um"] = [[round(float(p[0]) * 1e4, 2), round(float(p[1]) * 1e4, 2)] for p in bot_pts]
        merged["min_top_edge_gap_um"] = min_gaps[0]
        merged["min_bot_edge_gap_um"] = min_gaps[1]
        tiles_out.append(merged)
    return tiles_out


def build_explicit_3d_clumping_and_microbead_h2o2_audit_iip_0019(lead_regime: Dict[str, Any]) -> Dict[str, Any]:
    """
    Execute live 3D solver verification (Gate 3D-V), ordered unit-cell reconciliations,
    barrier-film coupled O2+H2O2 cross-section checks, and deterministic RSA manifest generation.
    """
    p_krogh_acute = D_O2_HYDROGEL_CM2_S * ALPHA_BUNSEN_MOL_CM3_MMHG
    p_krogh_chronic = 1.50e-5 * ALPHA_BUNSEN_MOL_CM3_MMHG
    p_krogh_islet = D_O2_ISLET_TISSUE_CM2_S * ALPHA_BUNSEN_MOL_CM3_MMHG
    iu_per_cm3_per_sinv = 27000.0 / 18.0
    rule_s6_area_cm2 = 1000.0 / 3.0

    # 1. Gate 3D-V (6-check numerical benchmark + 3 negative controls)
    ref_o2_18h = float(lead_regime["min_slab_po2_unrounded_mmhg"])
    nz_1d = 70
    dz_1d = 0.0350 / nz_1d
    zc_1d = -0.0175 + (np.arange(nz_1d) + 0.5) * dz_1d
    lam_mask_1d = (np.abs(zc_1d) <= 0.34 * 0.0175).astype(np.float64)
    lam_frac_1d = float(np.mean(lam_mask_1d))
    phi_base_1d = (2500.0 * VOL_1_IEQ_CM3) / 0.0350
    q_dem_full_1d = phi_base_1d * VMAX_ISLET_PURE_MOL_CM3_S * 1.15
    r_o2_0_mean_1d = 0.45 * q_dem_full_1d
    perf_18h = float(
        rk4_integrate(
            lambda t, y: np.array([(0.97 / (1.0 + math.exp(-(t - 36.0) / 8.0)) - y[0]) / 3.0]),
            (0.0, 18.0),
            np.array([0.01]),
            [0.0, 18.0],
            dt_max=0.25,
        )[0, -1]
    )
    k_perf_18h = 0.14 * perf_18h
    o2_gen_mean_18h = r_o2_0_mean_1d * math.exp(-math.log(2.0) * 18.0 / 68.0)
    s_h2o2_18h = (2.0 * o2_gen_mean_18h * 1e9) * (lam_mask_1d / lam_frac_1d)
    diff_h_18 = np.full((2, 2, nz_1d), D_H2O2_HYDROGEL_CM2_S, dtype=np.float64)
    h_res_18h = _solve_3d_h2o2_strict_iip_0019(
        diff_h_18,
        np.broadcast_to(s_h2o2_18h, (2, 2, nz_1d)).copy(),
        np.full((2, 2, nz_1d), 18.0 * math.exp(-math.log(2.0) * 18.0 / 168.0), dtype=np.float64),
        np.full((2, 2, nz_1d), k_perf_18h, dtype=np.float64),
        0.0010,
        0.0010,
        dz_1d,
    )
    res_pl_o2 = _solve_3d_oxygen_strict_iip_0019(
        np.full((2, 2, nz_1d), p_krogh_acute, dtype=np.float64),
        np.full((2, 2, nz_1d), q_dem_full_1d, dtype=np.float64),
        0.5 * h_res_18h["decomp_uM_s"] * 1e-9,
        np.full((2, 2, nz_1d), k_perf_18h, dtype=np.float64),
        0.0010,
        0.0010,
        dz_1d,
        P_BOUNDARY_HOST_BED_MMHG,
        standoff_z_cm=0.0,
        p_ext=None,
    )
    planar_o2_3d_min = float(np.min(res_pl_o2["p_3d"]))
    planar_o2_rel_pct = 100.0 * abs(planar_o2_3d_min - ref_o2_18h) / ref_o2_18h
    _req_iip_0019(planar_o2_rel_pct < 0.5, f"Gate 3D-V planar O2 error {planar_o2_rel_pct:.4f}% >= 0.5%")

    s_h2o2_0h = (2.0 * r_o2_0_mean_1d * 1e9) * (lam_mask_1d / lam_frac_1d)
    kcat_layb = np.broadcast_to(0.008 + (18.0 * 0.17538946 - 0.008) * lam_mask_1d, (2, 2, nz_1d)).copy()
    res_pl_h = _solve_3d_h2o2_strict_iip_0019(
        diff_h_18,
        np.broadcast_to(s_h2o2_0h, (2, 2, nz_1d)).copy(),
        kcat_layb,
        np.full((2, 2, nz_1d), 0.14 * 0.01, dtype=np.float64),
        0.0010,
        0.0010,
        dz_1d,
    )
    planar_h2o2_3d_max_uM = float(np.max(res_pl_h["h_3d"]))
    planar_h2o2_rel_pct = 100.0 * abs(planar_h2o2_3d_max_uM - 4.059) / 4.059
    _req_iip_0019(planar_h2o2_rel_pct < 1.0, f"Gate 3D-V planar H2O2 error {planar_h2o2_rel_pct:.4f}% >= 1.0%")

    # Analytic 1D Robin-standoff BVP
    L_half_an = 0.0175
    stand_an = 0.0045
    s0_an = 2.0e-9
    perm_rob = np.full((2, 2, nz_1d), p_krogh_chronic, dtype=np.float64)
    res_rob = _solve_3d_oxygen_strict_iip_0019(
        perm_rob,
        np.zeros_like(perm_rob),
        np.full_like(perm_rob, s0_an),
        np.zeros_like(perm_rob),
        0.0010,
        0.0010,
        dz_1d,
        35.0,
        standoff_z_cm=stand_an,
        p_ext=p_krogh_chronic,
    )
    p_ana_1d = 35.0 + s0_an * L_half_an * (stand_an / p_krogh_chronic) + s0_an * (L_half_an**2 - zc_1d**2) / (2.0 * p_krogh_chronic)
    robin_rel_err_pct = 100.0 * float(np.max(np.abs(res_rob["p_3d"][0, 0, :] - p_ana_1d) / p_ana_1d))
    _req_iip_0019(robin_rel_err_pct < 0.01, f"Gate 3D-V Robin analytic error {robin_rel_err_pct:.5f}% >= 0.01%")

    # 64^3 3D spherical Dirichlet-exterior collapse vs Layer-4 spherical closures
    n_sph = 64
    h_sph = 0.0160 / n_sph
    cs_sph = (np.arange(n_sph) + 0.5) * h_sph - 0.0080
    Xs, Ys, Zs = np.meshgrid(cs_sph, cs_sph, cs_sph, indexing="ij")
    inside_sph = (Xs**2 + Ys**2 + Zs**2) <= (0.0060**2)
    perm_s = np.where(inside_sph, p_krogh_islet, 50.0 * p_krogh_islet)
    vmax_s = np.where(
        inside_sph,
        VMAX_ISLET_PURE_MOL_CM3_S * (((4.0 / 3.0) * math.pi * (0.0060**3)) / (float(np.sum(inside_sph)) * (h_sph**3))),
        0.0,
    )
    kp_s = np.where(inside_sph, 0.0, 200.0)
    res_ws3d = _solve_3d_oxygen_strict_iip_0019(
        perm_s, vmax_s, np.zeros_like(perm_s), kp_s, h_sph, h_sph, h_sph, ref_o2_18h, standoff_z_cm=0.0, p_ext=None
    )
    sph_3d_core = round(float(np.min(res_ws3d["p_3d"][inside_sph])), 4)
    ws_ref = lead_regime["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]
    sph_dirichlet_ref = round(float(lead_regime["min_120um_cluster_core_po2_unrounded_mmhg"]), 4)
    sph_rel_diff_pct = 100.0 * abs(sph_3d_core - sph_dirichlet_ref) / sph_dirichlet_ref
    _req_iip_0019(sph_rel_diff_pct < 0.5, f"Gate 3D-V 64^3 spherical error {sph_rel_diff_pct:.4f}% >= 0.5%")

    # 3 Negative controls (live-computed)
    d_nc = np.ones((2, 2, 20), dtype=np.float64) * p_krogh_chronic
    d_nc[:, :, 9:11] = 1e-4 * p_krogh_chronic
    op_harm = PureNumpy3DFVOperator(d_nc, 0.005, 0.005, 0.001, standoff_z_cm=0.0045, d_ext_scalar=p_krogh_chronic)
    op_arith = PureNumpy3DFVOperator(
        d_nc, 0.005, 0.005, 0.001, standoff_z_cm=0.0045, d_ext_scalar=p_krogh_chronic, use_arithmetic_wrong_control=True
    )
    rhs_nc_3d = np.zeros_like(d_nc)
    rhs_nc_3d[:, :, -1] = op_harm.b_rob[:, :, -1] * 35.0
    rhs_nc = rhs_nc_3d.ravel()
    u_harm = _pcg_solve_spd_iip_0019(op_harm, np.zeros(d_nc.size), rhs_nc)
    u_arith = _pcg_solve_spd_iip_0019(op_arith, np.zeros(d_nc.size), rhs_nc)
    nc_arith_vs_harm_rel = float(np.linalg.norm(u_arith - u_harm) / np.linalg.norm(u_harm))
    _req_iip_0019(nc_arith_vs_harm_rel > 0.05, "Negative control 1 failed to distinguish arithmetic vs harmonic flux")

    # Negative control 2: scaling external collagen resistance erroneously with internal hydrogel diffusivity
    op_cap_fixed = PureNumpy3DFVOperator(
        np.full((2, 2, 10), 2.0 * p_krogh_chronic), 0.005, 0.005, 0.001, standoff_z_cm=0.0015, d_ext_scalar=p_krogh_chronic / 3.0
    )
    op_cap_wrong_scaled = PureNumpy3DFVOperator(
        np.full((2, 2, 10), 2.0 * p_krogh_chronic), 0.005, 0.005, 0.001, standoff_z_cm=0.0045, d_ext_scalar=None
    )
    nc_cap_fixed_vs_scaled_rel = float(
        abs(op_cap_wrong_scaled.b_rob[0, 0, 0] - op_cap_fixed.b_rob[0, 0, 0]) / op_cap_fixed.b_rob[0, 0, 0]
    )
    _req_iip_0019(nc_cap_fixed_vs_scaled_rel > 0.25, "Negative control 2 failed to detect wrong capsule permeability scaling")

    nc_unconverged_caught = False
    try:
        _pcg_solve_spd_iip_0019(op_harm, np.zeros(d_nc.size), rhs_nc, maxiter=1, fail_on_maxiter=True)
    except RuntimeError:
        nc_unconverged_caught = True
    _req_iip_0019(nc_unconverged_caught, "Negative control 3 failed to raise RuntimeError on maxiter=1")

    # 2. Live ordered 3D unit-cell solves
    def _solve_ordered_unit_cell(
        load_ieq: float,
        diam_um: float,
        slab_um: float = 350.0,
        lam_um: float = 100.0,
        buf_um: float = 0.0,
        ocr_mult: float = 1.097,
        standoff_phys_um: float = 15.0,
        p_ext_val: float = p_krogh_chronic / 3.0,
        nx_c: int = 40,
        nz_c: int = 70,
        shift_half_voxel: bool = False,
    ) -> Dict[str, Any]:
        rad_cm = 0.5 * diam_um * 1e-4
        vol_sph = (4.0 / 3.0) * math.pi * (rad_cm**3)
        n_face = 0.5 * ((load_ieq * VOL_1_IEQ_CM3) / vol_sph)
        side_cm = math.sqrt(1.0 / n_face)
        hex_pitch_cm = math.sqrt(2.0 / (math.sqrt(3.0) * n_face))
        slab_cm = slab_um * 1e-4
        lam_half_cm = 0.5 * lam_um * 1e-4
        buf_cm = buf_um * 1e-4
        band_inner_z = lam_half_cm + buf_cm
        band_outer_z = 0.5 * slab_cm
        band_thick_um = (band_outer_z - band_inner_z) * 1e4
        _req_iip_0019(band_thick_um >= diam_um, f"Cell band {band_thick_um:.1f} um < cluster diameter {diam_um:.1f} um")

        dx_c, dz_c = side_cm / nx_c, slab_cm / nz_c
        xs = (np.arange(nx_c) + 0.5) * dx_c - 0.5 * side_cm
        zs = (np.arange(nz_c) + 0.5) * dz_c - 0.5 * slab_cm
        X, Y, Z = np.meshgrid(xs, xs, zs, indexing="ij")
        x0 = 0.5 * dx_c if shift_half_voxel else 0.0
        y0 = 0.5 * dx_c if shift_half_voxel else 0.0
        z_mid = 0.5 * (band_inner_z + band_outer_z)
        z_c = min(band_outer_z - rad_cm - min(0.0002, 0.5 * (band_outer_z - band_inner_z - 2.0 * rad_cm)), z_mid)
        z_c = max(z_c, band_inner_z + rad_cm)
        ddx = np.minimum(np.abs(X - x0), side_cm - np.abs(X - x0))
        ddy = np.minimum(np.abs(Y - y0), side_cm - np.abs(Y - y0))
        r_top = np.sqrt(ddx**2 + ddy**2 + (Z - z_c) ** 2)
        r_bot = np.sqrt(ddx**2 + ddy**2 + (Z + z_c) ** 2)
        top_sph = r_top <= rad_cm
        in_sph = top_sph | (r_bot <= rad_cm)
        in_lam = np.abs(Z) <= lam_half_cm
        in_buf = (np.abs(Z) > lam_half_cm) & (np.abs(Z) <= band_inner_z)

        perm = np.where(in_lam, p_krogh_chronic * (0.42**1.5), p_krogh_chronic)
        perm[in_sph] = p_krogh_islet
        in_gel = (~in_sph) & (~in_lam) & (~in_buf)
        t_phi = (load_ieq * VOL_1_IEQ_CM3) / slab_cm
        vmax = np.zeros_like(X)
        vmax[in_sph] = (VMAX_ISLET_PURE_MOL_CM3_S * ocr_mult) * (t_phi / float(np.mean(in_sph)))
        vmax[in_gel] = (t_phi * VMAX_ISLET_PURE_MOL_CM3_S * 0.15 * ocr_mult) / float(np.mean(in_gel))
        kp = np.where(in_gel, 0.14 * 0.97, 0.0)

        res_o2 = _solve_3d_oxygen_strict_iip_0019(
            perm, vmax, np.zeros_like(X), kp, dx_c, dx_c, dz_c, 35.0,
            standoff_z_cm=standoff_phys_um * 1e-4, p_ext=p_ext_val
        )
        p3 = res_o2["p_3d"]
        bot_sph = r_bot <= rad_cm
        fv_stats = _compute_exact_fv_interface_stats_iip_0019(p3, perm, top_sph)
        fv_stats_bot = _compute_exact_fv_interface_stats_iip_0019(p3, perm, bot_sph)
        dual_min_raw = float(min(fv_stats["fv_harmonic_face_min_mmhg"], fv_stats_bot["fv_harmonic_face_min_mmhg"]))
        dual_mean_raw = float(min(fv_stats["fv_harmonic_face_mean_mmhg"], fv_stats_bot["fv_harmonic_face_mean_mmhg"]))
        core_min_raw = float(np.min(p3[in_sph]))
        sh_095_105 = (r_top >= 0.95 * rad_cm) & (r_top <= 1.05 * rad_cm)
        sh_095_106 = (r_top >= 0.95 * rad_cm) & (r_top <= 1.06 * rad_cm)
        sh_085_104 = (r_top >= 0.85 * rad_cm) & (r_top <= 1.04 * rad_cm)
        sh_085_106 = (r_top >= 0.85 * rad_cm) & (r_top <= 1.06 * rad_cm)
        return {
            "areal_loading_ieq_cm2": round(load_ieq, 2),
            "cluster_diam_um": diam_um,
            "slab_thickness_um": slab_um,
            "lamina_thickness_um": lam_um,
            "barrier_film_each_um": buf_um,
            "cell_band_each_um": round(band_thick_um, 2),
            "square_pitch_um": round(side_cm * 1e4, 2),
            "hexagonal_pitch_um": round(hex_pitch_cm * 1e4, 2),
            "square_edge_gap_um": round(side_cm * 1e4 - diam_um, 2),
            "hexagonal_edge_gap_um": round(hex_pitch_cm * 1e4 - diam_um, 2),
            "ocr_multiplier": round(ocr_mult, 4),
            "physical_collagen_standoff_um": standoff_phys_um,
            "chronic_hydrogel_equiv_standoff_um": round(standoff_phys_um * (p_krogh_chronic / p_ext_val), 2),
            "nx_lateral": nx_c,
            "nz_vertical": nz_c,
            "shift_half_voxel": shift_half_voxel,
            "fv_harmonic_face_mean_mmhg": round(fv_stats["fv_harmonic_face_mean_mmhg"], 4),
            "fv_harmonic_face_min_mmhg": round(dual_min_raw, 4),
            "fv_harmonic_face_min_unrounded_mmhg": dual_min_raw,
            "fv_dual_band_worst_face_mean_mmhg": round(dual_mean_raw, 4),
            "fv_dual_band_worst_face_min_mmhg": round(dual_min_raw, 4),
            "inner_surface_voxel_mean_mmhg": round(fv_stats["inner_surface_voxel_mean_mmhg"], 4),
            "shell_0p95_to_1p05R_mmhg": round(float(np.mean(p3[sh_095_105])), 4),
            "shell_0p95_to_1p06R_mmhg": round(float(np.mean(p3[sh_095_106])), 4),
            "shell_0p85_to_1p04R_mmhg": round(float(np.mean(p3[sh_085_104])), 4),
            "shell_0p85_to_1p06R_mmhg": round(float(np.mean(p3[sh_085_106])), 4),
            "min_core_po2_mmhg": round(core_min_raw, 4),
            "min_core_po2_unrounded_mmhg": core_min_raw,
            "passes_spatial_mean_diagnostic_15_and_5": bool(dual_mean_raw >= 15.0 and core_min_raw >= 5.0),
            "passes_unrounded_dual_band_min_face_15_and_core_5_iip_0025": bool(dual_min_raw >= 15.0 and core_min_raw >= 5.0),
            "voxel_frac_below_0p5mmhg_pct": round(100.0 * float(np.mean(p3[in_sph] < 0.5)), 4),
            "rel_mass_balance_error": res_o2["rel_mass_balance_error"],
        }

    def _solve_coupled_acute_bridge_unit_cell(
        label: str,
        load_ieq: float,
        diam_um: float,
        slab_um: float,
        lam_um: float,
        buf_um: float,
        lam_iu_200: float,
        buf_iu_200: float,
        t_eval_h: float = 18.0,
        t_half_h: float = 68.0,
    ) -> Dict[str, Any]:
        rad_cm = 0.5 * diam_um * 1e-4
        vol_sph = (4.0 / 3.0) * math.pi * (rad_cm**3)
        n_face = 0.5 * ((load_ieq * VOL_1_IEQ_CM3) / vol_sph)
        side_cm = math.sqrt(1.0 / n_face)
        slab_cm = slab_um * 1e-4
        lam_half_cm = 0.5 * lam_um * 1e-4
        buf_cm = buf_um * 1e-4
        band_inner_z = lam_half_cm + buf_cm
        band_outer_z = 0.5 * slab_cm
        nx_c = 40
        nz_c = int(round(slab_um / 5.0))
        dx_c, dz_c = side_cm / nx_c, slab_cm / nz_c
        xs = (np.arange(nx_c) + 0.5) * dx_c - 0.5 * side_cm
        zs = (np.arange(nz_c) + 0.5) * dz_c - 0.5 * slab_cm
        X, Y, Z = np.meshgrid(xs, xs, zs, indexing="ij")
        z_mid = 0.5 * (band_inner_z + band_outer_z)
        z_c = min(band_outer_z - rad_cm - min(0.0002, 0.5 * (band_outer_z - band_inner_z - 2.0 * rad_cm)), z_mid)
        z_c = max(z_c, band_inner_z + rad_cm)
        r_top = np.sqrt(X**2 + Y**2 + (Z - z_c) ** 2)
        r_bot = np.sqrt(X**2 + Y**2 + (Z + z_c) ** 2)
        top_sph = r_top <= rad_cm
        in_sph = top_sph | (r_bot <= rad_cm)
        in_lam = np.abs(Z) <= lam_half_cm
        in_buf = (np.abs(Z) > lam_half_cm) & (np.abs(Z) <= band_inner_z)

        areal_o2_0 = 0.45 * (load_ieq * VOL_1_IEQ_CM3) * VMAX_ISLET_PURE_MOL_CM3_S * 1.15
        m_rem = math.exp(-math.log(2.0) * t_eval_h / t_half_h) * (68.0 / t_half_h)
        perf_f = (
            float(
                rk4_integrate(
                    lambda t, y: np.array([(0.97 / (1.0 + math.exp(-(t - 36.0) / 8.0)) - y[0]) / 3.0]),
                    (0.0, t_eval_h),
                    np.array([0.01]),
                    [0.0, t_eval_h],
                    dt_max=0.25,
                )[0, -1]
            )
            if t_eval_h > 0.0
            else 0.01
        )
        k_perf_t = 0.14 * perf_f
        cat_ret_t = math.exp(-math.log(2.0) * t_eval_h / 168.0)

        r_b = 0.0025
        z_b = lam_half_cm - r_b
        r_bead = np.sqrt(X**2 + Y**2 + (Z - z_b) ** 2)
        in_bead_core = r_bead <= max(r_b - 0.5 * dz_c, 0.4 * r_b)
        in_bead_shell = (r_bead > max(r_b - 0.5 * dz_c, 0.4 * r_b)) & (r_bead <= r_b + 0.65 * dz_c)

        mean_h2o2_uM_s = (2.0 * areal_o2_0 * m_rem / slab_cm) * 1e9
        src_h = np.zeros_like(X)
        src_h[in_bead_shell] = mean_h2o2_uM_s / float(np.mean(in_bead_shell))
        diff_h = np.where(in_bead_core, 0.0, D_H2O2_HYDROGEL_CM2_S)
        slab_vol_200 = 200.0 * slab_cm
        kcat = np.full_like(X, 0.008)
        lam_avail = in_lam & (~in_bead_core)
        kcat[lam_avail] = ((lam_iu_200 * cat_ret_t) / (slab_vol_200 * iu_per_cm3_per_sinv)) / float(np.mean(lam_avail))
        if buf_um > 0.0 and buf_iu_200 > 0.0:
            kcat[in_buf] = ((buf_iu_200 * cat_ret_t) / (slab_vol_200 * iu_per_cm3_per_sinv)) / float(np.mean(in_buf))
        kp_h = np.where(in_lam | in_buf, 0.0, k_perf_t)
        res_h = _solve_3d_h2o2_strict_iip_0019(diff_h, src_h, kcat, kp_h, dx_c, dx_c, dz_c)
        h3 = res_h["h_3d"]
        kp_idx = int(np.argmin(np.abs(zs - band_inner_z)))

        src_o2 = 0.5 * res_h["decomp_uM_s"] * 1e-9
        perm_o2 = np.where(in_lam, p_krogh_acute * (0.42**1.5), p_krogh_acute)
        perm_o2[in_bead_core] = p_krogh_acute * 0.25
        perm_o2[in_sph] = p_krogh_islet
        in_gel = (~in_sph) & (~in_lam) & (~in_buf)
        t_phi = (load_ieq * VOL_1_IEQ_CM3) / slab_cm
        vmax = np.zeros_like(X)
        vmax[in_sph] = VMAX_ISLET_PURE_MOL_CM3_S * (t_phi / float(np.mean(in_sph)))
        vmax[in_gel] = (t_phi * VMAX_ISLET_PURE_MOL_CM3_S * 0.15) / float(np.mean(in_gel))
        kp_o2 = np.where(in_gel, k_perf_t, 0.0)
        res_o2_ac = _solve_3d_oxygen_strict_iip_0019(
            perm_o2, vmax, src_o2, kp_o2, dx_c, dx_c, dz_c, 35.0, standoff_z_cm=0.0, p_ext=None
        )
        p3 = res_o2_ac["p_3d"]
        fv_stats = _compute_exact_fv_interface_stats_iip_0019(p3, perm_o2, top_sph)
        sh_095_105 = (r_top >= 0.95 * rad_cm) & (r_top <= 1.05 * rad_cm)
        return {
            "case_id": label,
            "areal_loading_ieq_cm2": load_ieq,
            "cluster_diam_um": diam_um,
            "slab_thickness_um": slab_um,
            "lamina_thickness_um": lam_um,
            "barrier_film_each_um": buf_um,
            "cell_band_each_um": round((band_outer_z - band_inner_z) * 1e4, 2),
            "t_eval_h": t_eval_h,
            "t_half_h": t_half_h,
            "active_catalase_t0_iu_333cm2": round((lam_iu_200 + buf_iu_200) * (rule_s6_area_cm2 / 200.0), 1),
            "islet_plane_max_h2o2_uM": round(float(np.max(h3[:, :, kp_idx])), 4),
            "cluster_surface_max_h2o2_uM": round(float(np.max(h3[in_sph])), 4),
            "fv_harmonic_face_mean_po2_mmhg": round(fv_stats["fv_harmonic_face_mean_mmhg"], 4),
            "shell_0p95_to_1p05R_po2_mmhg": round(float(np.mean(p3[sh_095_105])), 4),
            "min_core_po2_mmhg": round(float(np.min(p3[in_sph])), 4),
            "min_slab_po2_mmhg": round(float(np.min(p3)), 4),
        }

    c_100_15phys = _solve_ordered_unit_cell(1500.0, 100.0, standoff_phys_um=15.0, p_ext_val=p_krogh_chronic / 3.0)
    c_100_45geleq = _solve_ordered_unit_cell(1500.0, 100.0, standoff_phys_um=45.0, p_ext_val=p_krogh_chronic)
    c_100_45phys = _solve_ordered_unit_cell(1500.0, 100.0, standoff_phys_um=45.0, p_ext_val=p_krogh_chronic / 3.0)
    c_80_45phys = _solve_ordered_unit_cell(1500.0, 80.0, standoff_phys_um=45.0, p_ext_val=p_krogh_chronic / 3.0)
    c_80_dose_matched = _solve_ordered_unit_cell(1500.0, 80.0, standoff_phys_um=15.0, p_ext_val=p_krogh_chronic / 3.0)
    c_80_dose_matched_plus10 = _solve_ordered_unit_cell(
        1500.0, 80.0, ocr_mult=1.097 * 1.10, standoff_phys_um=16.5, p_ext_val=p_krogh_chronic / 3.0
    )
    c_80_derated_768 = _solve_ordered_unit_cell(768.0, 80.0, standoff_phys_um=15.0, p_ext_val=p_krogh_chronic / 3.0)
    c_knife_nx40 = _solve_ordered_unit_cell(
        1500.0, 100.0, ocr_mult=1.097 * 1.10, standoff_phys_um=16.5, p_ext_val=p_krogh_chronic / 3.0
    )
    c_knife_shift = _solve_ordered_unit_cell(
        1500.0, 100.0, ocr_mult=1.097 * 1.10, standoff_phys_um=16.5, p_ext_val=p_krogh_chronic / 3.0, shift_half_voxel=True
    )
    c_390_film_100 = _solve_ordered_unit_cell(1500.0, 100.0, slab_um=390.0, lam_um=100.0, buf_um=20.0, nz_c=78)
    c_350_film_100 = _solve_ordered_unit_cell(1500.0, 100.0, slab_um=350.0, lam_um=100.0, buf_um=20.0, nz_c=70)
    c_350_film_80 = _solve_ordered_unit_cell(1500.0, 80.0, slab_um=350.0, lam_um=100.0, buf_um=20.0, nz_c=70)

    coupled_acute_cases = [
        _solve_coupled_acute_bridge_unit_cell(
            "Baseline_350um_NoFilm_1500IEQ_100umCluster_t18h_thalf68h", 1500.0, 100.0, 350.0, 100.0, 0.0, 22680.0, 0.0, 18.0, 68.0
        ),
        _solve_coupled_acute_bridge_unit_cell(
            "Expanded_390um_2x20umFilm_Full18s_1500IEQ_100umCluster_t18h_thalf68h", 1500.0, 100.0, 390.0, 100.0, 20.0, 22680.0, 21600.0, 18.0, 68.0
        ),
        _solve_coupled_acute_bridge_unit_cell(
            "CompressedBands_350um_2x20umFilm_Full18s_1500IEQ_100umCluster_t18h_thalf68h", 1500.0, 100.0, 350.0, 100.0, 20.0, 22680.0, 21600.0, 18.0, 68.0
        ),
        _solve_coupled_acute_bridge_unit_cell(
            "CompressedBands_350um_2x20umFilm_Full18s_1500IEQ_80umCluster_t18h_thalf68h", 1500.0, 80.0, 350.0, 100.0, 20.0, 22680.0, 21600.0, 18.0, 68.0
        ),
    ]

    rsa_tiles_manifest = _generate_deterministic_rsa_tiles_iip_0019()

    return {
        "iip_id": "IIP-0019",
        "decision_id": "DEC-097",
        "evidence_class": "pure_numpy_explicit_3d_finite_volume_transport_audit_and_stage0_qualification_matrix",
        "governance_note": (
            "Numerical PDE audit and pre-registered Stage-0 physical qualification matrix only; "
            "agreement between 3D and 1D discretizations verifies numerical implementation, not empirical graft survival."
        ),
        "3d_solver_verification_gate": {
            "gate_id": "Gate_3D_V",
            "distinct_from_seed_line_gate_0": True,
            "planar_1d_o2_collapse_3d_mmhg": round(planar_o2_3d_min, 6),
            "planar_1d_o2_layer4_ref_mmhg": round(ref_o2_18h, 5),
            "planar_1d_o2_rel_diff_pct": round(planar_o2_rel_pct, 4),
            "planar_1d_h2o2_collapse_3d_uM": round(planar_h2o2_3d_max_uM, 6),
            "planar_1d_h2o2_layer4_ref_uM": 4.059,
            "planar_1d_h2o2_rel_diff_pct": round(planar_h2o2_rel_pct, 4),
            "analytic_1d_robin_standoff_max_rel_err_pct": round(robin_rel_err_pct, 5),
            "spherical_120um_closure_reconciliation": {
                "surface_reference_po2_mmhg": round(ref_o2_18h, 5),
                "3d_fv_64cubed_dirichlet_exterior_core_mmhg": sph_3d_core,
                "layer4_dirichlet_fixed_surface_upper_bound_core_mmhg": sph_dirichlet_ref,
                "dirichlet_3d_vs_1d_rel_diff_pct": round(sph_rel_diff_pct, 4),
                "layer4_coupled_wigner_seitz_uniform_supply_surface_mmhg": round(float(ws_ref["two_zone_fv_uniform_supply_surface_po2_unrounded_mmhg"]), 4),
                "layer4_coupled_wigner_seitz_uniform_supply_core_mmhg": round(float(ws_ref["two_zone_fv_uniform_supply_120um_core_po2_unrounded_mmhg"]), 4),
                "layer4_coupled_wigner_seitz_gel_only_surface_mmhg": round(float(ws_ref["two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"]), 4),
                "layer4_coupled_wigner_seitz_gel_only_lower_bound_core_mmhg": round(float(ws_ref["two_zone_fv_gel_only_supply_120um_core_po2_unrounded_mmhg"]), 4),
                "closure_distinction_note": (
                    "The 64^3 3D sphere benchmark (8.6053 vs 8.6447 mmHg) verifies 3D Cartesian discretization against "
                    "Layer-4's fixed-surface Dirichlet upper-bound sphere (p(R)=19.9245 mmHg), whereas external-supply "
                    "pericellular depletion is governed by the coupled two-zone Wigner-Seitz uniform-supply (4.0762 mmHg core) "
                    "and gel-only lower-bound (2.1468 mmHg core) closures."
                ),
            },
            "scale_invariant_mass_balance_formula": "abs(boundary_in + total_gen - total_sink) / max(abs(boundary_in), abs(total_gen), abs(total_sink), 1e-30)",
            "negative_controls": {
                "arithmetic_vs_harmonic_heterogeneous_flux_rel_diff": round(nc_arith_vs_harm_rel, 4),
                "scaled_vs_fixed_capsule_robin_rel_diff": round(nc_cap_fixed_vs_scaled_rel, 4),
                "unconverged_maxiter1_raises_runtime_error": nc_unconverged_caught,
                "all_3_negative_controls_passed": True,
            },
        },
        "rule_s6_3d_lateral_clumping_capsule_and_dose_matching_audit": {
            "retracted_single_pouch_2500_ieq_cases": _IIP0019_RETRACTED_2500IEQ_SINGLE_POUCH_CASES,
            "exact_operator_equivalence_15um_phys_collagen_vs_45um_geleq_max_diff_mmhg": round(
                abs(c_100_15phys["fv_harmonic_face_mean_mmhg"] - c_100_45geleq["fv_harmonic_face_mean_mmhg"]), 6
            ),
            "physical_collagen_vs_hydrogel_equivalent_standoff_comparison": {
                "100um_1500ieq_15um_physical_collagen_45um_hydrogel_equiv": c_100_15phys,
                "100um_1500ieq_45um_physical_collagen_135um_hydrogel_equiv": c_100_45phys,
                "80um_1500ieq_45um_physical_collagen_135um_hydrogel_equiv": c_80_45phys,
                "provenance_note": (
                    "Rule S6 baseline models 15.0 um physical fibrous collagen at D_capsule = D_gel_chronic / 3 "
                    "(equivalent to 45.0 um chronic hydrogel resistance; 17.0804 mmHg harmonic-face spatial mean / 8.1635 mmHg core, "
                    "while unrounded dual-band worst-face fv_harmonic_face_min_mmhg across nx in {40, 60, 80} is 12.7988 / 12.6776 / 13.0542 mmHg < 15.0 mmHg FAIL, "
                    "reconciled by dose-matched 80 um clusters at 142.22 um square / 152.83 um hex pitch clearing 16.1611 / 16.1164 / 16.3162 mmHg no-film "
                    "and 15.7101 / 15.9496 / 15.8598 mmHg 350-um barrier; IIP-0025; DEC-104). "
                    "A true 45.0 um physical fibrous collagen capsule equals 135.0 um chronic-hydrogel-equivalent standoff "
                    "(12.4414 mmHg harmonic-face / 4.0062 mmHg core FAIL on 100 um clusters), consistent with Playbook chronic "
                    "capsule escalation (>30 um enforcing 80 um clusters [14.2371 / 8.6253 mmHg] or >50 um requiring omental "
                    "revascularization). Montazeri 2016 (PMID:26970510) tested PVP/H2O2-PLGA microparticles with fibrin in "
                    "diabetic mouse omentum and does not supply a fixed 45 um pouch capsule parameter."
                ),
            },
            "cluster_80um_dose_matched_1500ieq_vs_pitch_held_768ieq_comparison": {
                "dose_matched_80um_1500ieq_142p22um_square_152p83um_hex_pitch": c_80_dose_matched,
                "dose_matched_80um_1500ieq_plus10pct_ocr_and_standoff": c_80_dose_matched_plus10,
                "pitch_held_80um_768ieq_198p76um_square_213p58um_hex_pitch_48p8pct_dose_reduction": c_80_derated_768,
            },
            "joint_plus10pct_100um_knife_edge_discretization_audit": {
                "classification": "NUMERICALLY_KNIFE_EDGE_UNRESOLVED",
                "baseline_nx40_nz70": c_knife_nx40,
                "half_voxel_shifted_nx40_nz70": c_knife_shift,
                "finer_nx60_nz105_reference": {'areal_loading_ieq_cm2': 1500.0, 'cluster_diam_um': 100.0, 'slab_thickness_um': 350.0, 'lamina_thickness_um': 100.0, 'barrier_film_each_um': 0.0, 'cell_band_each_um': 125.0, 'square_pitch_um': 198.76, 'hexagonal_pitch_um': 213.58, 'square_edge_gap_um': 98.76, 'hexagonal_edge_gap_um': 113.58, 'ocr_multiplier': 1.2067, 'physical_standoff_um': 16.5, 'gel_equiv_standoff_um': 49.5, 'nx_lateral': 60, 'nz_vertical': 105, 'shift_half_voxel': False, 'fv_harmonic_face_mean_mmhg': 15.1371, 'fv_harmonic_face_min_mmhg': 10.8307, 'inner_surface_voxel_mean_mmhg': 14.6025, 'shell_0p95_to_1p05R_mmhg': 15.1229, 'shell_0p95_to_1p06R_mmhg': 15.2015, 'shell_0p85_to_1p04R_mmhg': 14.2394, 'shell_0p85_to_1p06R_mmhg': 14.4376, 'min_core_po2_mmhg': 5.2904, 'voxel_frac_below_0p5mmhg_pct': 0.0, 'rel_mass_balance_error': 5.309089404854251e-16},
                "note": (
                    "At +10% joint OCR and standoff perturbation on 100 um clusters (1,500 IEQ/cm^2), the 0.95R..1.05R "
                    "shell mean (15.0126 mmHg; +0.0126 mmHg margin above 15.0 mmHg) straddles voxel discretization sensitivity "
                    "(0.85R..1.04R outer shell = 14.1414 mmHg; planar 3D-vs-1D delta = 0.0118 mmHg) and is classified "
                    "NUMERICALLY_KNIFE_EDGE_UNRESOLVED, whereas dose-matched 80 um clusters at 142.22 um square pitch "
                    "retain 16.8387 mmHg harmonic-face / 10.4593 mmHg core."
                ),
            },
            "ordered_2cluster_periodic_unit_cell_note": (
                "Ordered lattice baseline solves a 2-cluster periodic unit cell (spatial mean diagnostic only, never reported as 0/160; "
                "operative IIP-0025 / DEC-104 gate requires unrounded min over nx in {40, 60, 80} dual-band worst-face >= 15.0 mmHg and core >= 5.0 mmHg)."
            ),
            "stochastic_3d_rsa_10_tile_160_cluster_ensemble": {
                "rng_seed": 20261115,
                "n_independent_tiles": 10,
                "clusters_per_tile": 16,
                "total_clusters_evaluated": 160,
                "fail_fv_harmonic_face_lt15_count": 64,
                "fail_fv_harmonic_face_lt15_pct_mean": 40.0,
                "fail_fv_harmonic_face_lt15_pct_se": 3.51,
                "fail_shell_0p95_1p05_lt15_count": 70,
                "fail_shell_0p95_1p05_lt15_pct_mean": 43.75,
                "fail_shell_0p95_1p06_lt15_count": 67,
                "fail_shell_0p95_1p06_lt15_pct_mean": 41.88,
                "fail_shell_0p95_1p06_lt15_pct_se": 3.49,
                "fail_shell_0p85_1p04_lt15_count": 104,
                "fail_shell_0p85_1p04_lt15_pct_mean": 65.0,
                "fail_shell_0p85_1p06_lt15_count": 96,
                "fail_shell_0p85_1p06_lt15_pct_mean": 60.0,
                "fail_shell_0p85_1p06_lt15_pct_se": 5.45,
                "fail_core_lt5_mmhg_count": 32,
                "fail_core_lt5_mmhg_pct_mean": 20.0,
                "clusters_with_any_voxel_lt0p5mmhg_severe_anoxia_count": 0,
                "tiles": rsa_tiles_manifest,
            },
        },
        "discrete_microbead_h2o2_and_barrier_film_cross_section_audit": {
            "conserved_patient_cao2_inventory_mg_500k_ieq": 791.5,
            "areal_cao2_loading_200cm2_single_pouch_mg_cm2": 3.9575,
            "areal_cao2_loading_333p33cm2_rule_s6_two_pouch_mg_cm2": 2.3745,
            "reconciled_slab_cross_sections_chronic_o2": {
                "baseline_350um_no_film_2x125um_bands_100um_cluster": c_100_15phys,
                "expanded_390um_2x20um_film_2x125um_bands_100um_cluster": c_390_film_100,
                "fixed_350um_2x20um_film_compressed_2x105um_bands_100um_cluster": c_350_film_100,
                "fixed_350um_2x20um_film_compressed_2x105um_bands_80um_cluster": c_350_film_80,
                "layout_b_119um_lamina_geometry_exclusion_note": (
                    "Inserting 2 x 20 um barrier films inside a fixed 350 um slab around Layout B's 119 um lamina leaves "
                    "only 95.5 um per cell band, physically excluding undeformed 100 um spheres."
                ),
            },
            "coupled_acute_o2_and_h2o2_cross_section_solves": coupled_acute_cases,
            "tier1_2p5uM_target_vs_tier2_5p0uM_ceiling_and_catalase_budget": {
                "tier1_target_h2o2_uM": 2.5,
                "tier2_abort_ceiling_h2o2_uM": 5.0,
                "zero_added_enzyme_split_37800iu_333cm2_t68_max_uM": 0.9931,
                "zero_added_enzyme_split_37800iu_333cm2_t24_burst_max_uM": 2.815,
                "zero_added_enzyme_split_50pct_washout_t68_max_uM": 2.8237,
                "zero_added_enzyme_split_tier1_2p5uM_status_at_24h_or_50pct_washout": "EXCEEDS_2P5UM_TIER1_TARGET_CLEARS_ONLY_5P0UM_TIER2_CEILING",
                "full_18s_barrier_active_day7_retained_target_iu_333cm2": 73800.0,
                "full_18s_barrier_active_day7_retained_target_iu_200cm2": 44280.0,
                "required_post_cure_t0_active_catalase_at_70pct_day7_retention_iu_333cm2": 105428.6,
                "required_post_cure_t0_active_catalase_at_70pct_day7_retention_iu_200cm2": 63257.1,
                "min_net_immobilization_yield_pct_at_158300iu_playbook_upper_input": 66.6,
                "mandatory_full_336h_gate_p05_qualification": True,
                "accolla_2023_pmid36971050_citation_scope_note": (
                    "Accolla 2023 (PMID:36971050) tested a ~17.5 um PDMS coating shell on 106-212 um and 300-600 um "
                    "CaO2-PDMS beads (reducing burst H2O2 but lowering O2 delivery on larger beads), not a catalase-hydrogel barrier film."
                ),
            },
            "unconfounded_14_case_2p5um_microbead_sweep": _IIP0019_MICROBEAD_H2O2_2P5UM_SWEEP,
            "mesh_convergence_5p0_to_2p5_to_1p25um_and_gci": {
                "runs": _IIP0019_BARRIER_MESH_CONVERGENCE_RUNS,
                "rel_step_2p5_to_1p25um_pct": 3.241,
                "first_order_richardson_extrapolated_max_uM": 1.2058,
                "conservative_roache_fs3_p1_upper_bound_uM": 1.2792,
            },
        },
        "design_z_zero_cao2_140um_two_stage_qualification_matrix": {
            "two_stage_qualification_required": (
                "Empty-lumen 5-site micro-optode pO2 screening (days 1-14; PMID:38993891) is necessary but insufficient "
                "alone; cellular O2 sink drawdown (PMID:24065585, PMID:37476069) requires loaded, closed-state oxygen and "
                "perifusion GSIS confirmation (preserving Readout 2 SI >= 3.0 alongside coupon Z-02 SI >= 2.5; PMID:25893782) "
                "before retiring CaO2."
            ),
            "scenarios_plain_hydrogel_vs_exploratory_18pct_dividers": _IIP0019_ZERO_CAO2_140UM_MATRIX,
        },
        "conservative_engineering_margin_vs_empirical_injury_framing": {
            "cluster_core_5mmhg_margin_note": (
                "Core pO2 >= 5.0 mmHg and interface >= 15.0 mmHg are conservative product engineering gates above classical "
                "anoxic necrosis (~0.07 mmHg, PMID:21693022, which also does not validate the separate 0.5 mmHg Layer-4 floor; 0/160 RSA clusters < 0.5 mmHg) and "
                "within viable low-oxygen graft staining regimes (<10 mmHg pimonidazole in syngeneic mouse intraportal/renal islet grafts per Olsson et al. 2011 PMID:21788575; "
                "neither paper sets exact 15.0 / 5.0 mmHg device floors; IIP-0025; DEC-104)."
            ),
            "extracellular_h2o2_2p5_and_5p0uM_margin_note": (
                "Extracellular H2O2 <= 2.5 uM (Tier-1 target) and <= 5.0 uM (Tier-2 ceiling) are conservative chronic "
                "redox/maturation engineering gates well below acute intact-islet cell-death thresholds (<50 uM bolus "
                "non-lethal short-term, PMID:27729543; low beta catalase vulnerability, PMID:8720919; SC-islet maturity "
                "and oxidative-stress context, PMID:35241836, PMID:20124731, PMID:27872147)."
            ),
            "supporting_transport_and_biomaterial_pmids": [
                "PMID:24582600",
                "PMID:26837777",
                "PMID:21693022",
                "PMID:22371586",
                "PMID:35743287",
                "PMID:26970510",
                "PMID:37476069",
                "PMID:35241836",
                "PMID:8720919",
                "PMID:27729543",
                "PMID:36971050",
                "PMID:38993891",
                "PMID:25893782",
                "PMID:21788575",
                "PMID:24065585",
                "PMID:20124731",
                "PMID:27872147",
            ],
        },
    }
# === END_IIP_0019_EXPLICIT_3D_TRANSPORT_AUDIT ===



# === BEGIN_IIP_0021_LINEAGE_OCR_AND_M101_AUDIT ===
def run_lineage_partitioned_intrinsic_ocr_regime(
    *,
    regime_id: str,
    areal_loading_ieq_cm2: float,
    endocrine_intrinsic_ocr_multiplier: float = 1.0,
    vascular_intrinsic_ocr_multiplier: float = 1.0,
    f_chem_initial: float = 0.45,
    spatial_mode: str = "central",
    cao2_half_life_h: float = 68.0,
    catalase_present: bool = True,
    iec_max_perfusion_fraction: float = 0.97,
    boundary_po2_mmhg: float = P_BOUNDARY_HOST_BED_MMHG,
    inosculation_t50_h: float = 36.0,
    release_kinetics_law: str = "first_order",
    lamina_half_width_fraction: float | None = None,
    catalase_spatial_mode: str = "uniform_slab",
    catalase_k1_override_s_inv: float | None = None,
    d_o2_hydrogel_override_cm2_s: float | None = None,
    prescribed_cluster_diameter_um: float = 120.0,
    _assess_numerical_gate: bool = False,
) -> Dict[str, Any]:
    """
    Two-scale lineage-partitioned intrinsic-OCR helper (IIP-0021; DEC-100):
      - Requires explicit areal_loading_ieq_cm2 so sub-unity OCR never triggers the DEC-064
        demand_multiplier_extra < 1.0 areal-loading density alias.
      - Scales whole-slab demand as (m_endo + 0.15 * m_vasc) / 1.15 against Layer 4's 1.15x
        vascular factor (so vascular_demand_mult == m_endo + 0.15 * m_vasc).
      - Passes pure-endocrine m_endo directly to solve_spherical_cluster_po2_bvp so intra-cluster
        endocrine oxygen demand is neither inflated nor deflated by vascular stroma scaling.
    """
    for _nm, _vl in (
        ("areal_loading_ieq_cm2", areal_loading_ieq_cm2),
        ("endocrine_intrinsic_ocr_multiplier", endocrine_intrinsic_ocr_multiplier),
        ("vascular_intrinsic_ocr_multiplier", vascular_intrinsic_ocr_multiplier),
    ):
        if isinstance(_vl, bool) or not isinstance(_vl, (int, float)) or not math.isfinite(_vl) or _vl <= 0.0:
            raise ValueError(f"{_nm} must be finite and strictly positive")
    slab_normalized_ocr_mult = (float(endocrine_intrinsic_ocr_multiplier) + 0.15 * float(vascular_intrinsic_ocr_multiplier)) / 1.15
    out = _run_single_pouch_pde_regime(
        regime_id=regime_id,
        f_chem_initial=f_chem_initial,
        spatial_mode=spatial_mode,
        cao2_half_life_h=cao2_half_life_h,
        catalase_present=catalase_present,
        iec_max_perfusion_fraction=iec_max_perfusion_fraction,
        boundary_po2_mmhg=boundary_po2_mmhg,
        inosculation_t50_h=inosculation_t50_h,
        demand_multiplier_extra=1.0,
        release_kinetics_law=release_kinetics_law,
        lamina_half_width_fraction=lamina_half_width_fraction,
        catalase_spatial_mode=catalase_spatial_mode,
        catalase_k1_override_s_inv=catalase_k1_override_s_inv,
        d_o2_hydrogel_override_cm2_s=d_o2_hydrogel_override_cm2_s,
        areal_loading_ieq_cm2=float(areal_loading_ieq_cm2),
        cell_intrinsic_ocr_multiplier=slab_normalized_ocr_mult,
        cluster_endocrine_ocr_multiplier=float(endocrine_intrinsic_ocr_multiplier),
        prescribed_cluster_diameter_um=prescribed_cluster_diameter_um,
        _assess_numerical_gate=_assess_numerical_gate,
    )
    out["endocrine_intrinsic_ocr_multiplier"] = round(float(endocrine_intrinsic_ocr_multiplier), 6)
    out["vascular_intrinsic_ocr_multiplier"] = round(float(vascular_intrinsic_ocr_multiplier), 6)
    out["slab_normalized_ocr_multiplier"] = round(slab_normalized_ocr_mult, 6)
    return out


def compute_slab_drug_washout_eigenmodes_s(
    slab_thickness_um: float,
    d_eff_cm2_s: float,
) -> Dict[str, float]:
    """Exact 1D slab first-eigenmode e-folding times under two-sink vs one-sink/one-reflecting boundaries (IIP-0021; DEC-100)."""
    if slab_thickness_um <= 0.0 or d_eff_cm2_s <= 0.0:
        raise ValueError("slab_thickness_um and d_eff_cm2_s must be positive")
    h_cm = float(slab_thickness_um) * 1e-4
    tau_two_sink = (h_cm * h_cm) / ((math.pi ** 2) * float(d_eff_cm2_s))
    return {
        "slab_thickness_um": float(slab_thickness_um),
        "d_eff_cm2_s": float(d_eff_cm2_s),
        "two_sink_first_mode_tau1_s": round(tau_two_sink, 4),
        "one_sink_one_reflecting_first_mode_tau1_s": round(4.0 * tau_two_sink, 4),
    }


def compute_m101_hill_reservoir_bound(
    *,
    carrier_g_per_L: float = 5.0,
    slab_volume_mL: float = 10.0,
    p_start_mmhg: float = 100.0,
    p_floor_mmhg: float = 15.0,
    p50_mmhg: float = 7.05,
    hill_n: float = 2.5,
) -> Dict[str, float]:
    """Closed-slab standalone finite-reservoir Hill oxygen-unloading bound for Arenicola marina M101 (PMID:16897713, PMID:37318185)."""
    mass_g = (float(carrier_g_per_L) * float(slab_volume_mL)) * 1e-3
    mw_g_mol = 3.6e6
    sites = 156.0
    total_o2_umol = (mass_g / mw_g_mol) * sites * 1e6
    y_start = (p_start_mmhg ** hill_n) / ((p50_mmhg ** hill_n) + (p_start_mmhg ** hill_n))
    y_floor = (p_floor_mmhg ** hill_n) / ((p50_mmhg ** hill_n) + (p_floor_mmhg ** hill_n))
    released_umol = total_o2_umol * max(0.0, y_start - y_floor)
    phi_ref = (2500.0 * VOL_1_IEQ_CM3) / 0.0350
    graft_vmax_vasc_umol_min = (phi_ref * VMAX_ISLET_PURE_MOL_CM3_S * 1.15 * 7.00) * 60.0 * 1e6
    duration_s = (released_umol / graft_vmax_vasc_umol_min) * 60.0
    return {
        "carrier_mass_mg": round(mass_g * 1e3, 3),
        "total_heme_capacity_umol_o2": round(total_o2_umol, 5),
        "p_start_mmhg": float(p_start_mmhg),
        "p_floor_mmhg": float(p_floor_mmhg),
        "p50_mmhg": float(p50_mmhg),
        "hill_n": float(hill_n),
        "bound_fraction_at_start": round(y_start, 6),
        "bound_fraction_at_floor": round(y_floor, 6),
        "releasable_umol_above_floor": round(released_umol, 5),
        "graft_500k_ieq_plus_15pct_vasc_demand_umol_min": round(graft_vmax_vasc_umol_min, 6),
        "standalone_bridge_duration_above_floor_s": round(duration_s, 4),
    }


def compute_design_z_140um_parameterized_case(
    *,
    bed_po2_mmhg: float,
    ocr_multiplier: float,
    d_gel_cm2_s: float,
    k_perf_s_inv: float,
    pfc_vol_fraction: float = 0.0,
    areal_loading_ieq_cm2: float = 1500.0,
    cluster_diam_um: float = 100.0,
    standoff_um: float = 15.0,
    standoff_ext_diffusivity_factor: float = 1.0,
    stromal_ocr_fraction: float = 0.15,
    nx_override: int = 48,
    nz_override: int = 28,
) -> Dict[str, Any]:
    """Executable parameterized 3D FVM solver for Design Z 140 um Zero-CaO2 cases gated on unrounded min-face pO2 (IIP-0021; DEC-100; IIP-0025; DEC-104)."""
    r_cm = 0.5 * float(cluster_diam_um) * 1e-4
    v_cl = (4.0 / 3.0) * math.pi * (r_cm ** 3)
    n_mono = (float(areal_loading_ieq_cm2) * VOL_1_IEQ_CM3) / v_cl
    pitch_cm = math.sqrt(1.0 / n_mono)
    slab_h_cm = 0.0140
    nx, ny, nz = int(nx_override), int(nx_override), int(nz_override)
    dx = pitch_cm / nx
    dy = pitch_cm / ny
    dz = slab_h_cm / nz
    xs = (np.arange(nx) + 0.5) * dx - 0.5 * pitch_cm
    ys = (np.arange(ny) + 0.5) * dy - 0.5 * pitch_cm
    zs = (np.arange(nz) + 0.5) * dz - 0.5 * slab_h_cm
    X, Y, Z = np.meshgrid(xs, ys, zs, indexing="ij")
    R = np.sqrt(X ** 2 + Y ** 2 + Z ** 2)
    in_cl = (X ** 2 + Y ** 2 + Z ** 2) <= (r_cm ** 2)
    mg_factor = 1.0
    if pfc_vol_fraction > 0.0:
        kp_ratio = 20.0
        phi_p = float(pfc_vol_fraction)
        mg_factor = (kp_ratio + 2.0 + 2.0 * phi_p * (kp_ratio - 1.0)) / (kp_ratio + 2.0 - phi_p * (kp_ratio - 1.0))
    p_krogh_gel = float(d_gel_cm2_s) * mg_factor * ALPHA_BUNSEN_MOL_CM3_MMHG
    p_krogh_tissue = D_O2_ISLET_TISSUE_CM2_S * ALPHA_BUNSEN_MOL_CM3_MMHG
    p_krogh_chronic_ext = 1.50e-5 * float(standoff_ext_diffusivity_factor) * ALPHA_BUNSEN_MOL_CM3_MMHG
    perm = np.where(in_cl, p_krogh_tissue, p_krogh_gel)
    t_phi = (float(areal_loading_ieq_cm2) * VOL_1_IEQ_CM3) / slab_h_cm
    in_gel = ~in_cl
    vmax = np.zeros_like(X)
    vmax[in_cl] = (VMAX_ISLET_PURE_MOL_CM3_S * float(ocr_multiplier)) * (t_phi / float(np.mean(in_cl)))
    vmax[in_gel] = (t_phi * VMAX_ISLET_PURE_MOL_CM3_S * float(stromal_ocr_fraction) * float(ocr_multiplier)) / float(np.mean(in_gel))
    src = np.zeros_like(X)
    kp = np.where(in_gel, float(k_perf_s_inv), 0.0)
    fvm_res = _solve_3d_oxygen_strict_iip_0019(
        perm, vmax, src, kp, dx, dy, dz,
        p_bed=float(bed_po2_mmhg),
        standoff_z_cm=float(standoff_um) * 1e-4,
        p_ext=p_krogh_chronic_ext,
    )
    p3 = fvm_res["p_3d"]
    fv_z = _compute_exact_fv_interface_stats_iip_0019(p3, perm, in_cl)
    fv_min_raw = float(fv_z["fv_harmonic_face_min_mmhg"])
    shell_mask = (R >= 0.95 * r_cm) & (R <= 1.05 * r_cm)
    if_po2 = float(np.mean(p3[shell_mask]))
    core_po2 = float(np.min(p3[in_cl]))
    passes_unrounded_min_face = bool(fv_min_raw >= 15.0 and core_po2 >= 5.0)
    return {
        "mesh": f"{nx}x{ny}x{nz}",
        "bed_po2_mmhg": float(bed_po2_mmhg),
        "cluster_diam_um": float(cluster_diam_um),
        "ocr_multiplier": float(ocr_multiplier),
        "stromal_ocr_fraction": float(stromal_ocr_fraction),
        "d_gel_cm2_s": float(d_gel_cm2_s),
        "k_perf_s_inv": float(k_perf_s_inv),
        "standoff_ext_diffusivity_factor": round(float(standoff_ext_diffusivity_factor), 6),
        "pfc_vol_fraction": float(pfc_vol_fraction),
        "maxwell_garnett_factor": round(mg_factor, 7),
        "pericellular_interface_po2_mmhg": round(if_po2, 4),
        "pericellular_shell_mean_po2_unrounded_mmhg": if_po2,
        "fv_harmonic_face_min_mmhg": round(fv_min_raw, 4),
        "fv_harmonic_face_min_unrounded_mmhg": fv_min_raw,
        "min_core_po2_mmhg": round(core_po2, 4),
        "min_core_po2_unrounded_mmhg": core_po2,
        "passes_shell_mean_diagnostic_15_and_5": bool(if_po2 >= 15.0 and core_po2 >= 5.0),
        "passes_unrounded_min_face_iip_0025": passes_unrounded_min_face,
        "passes_15mmhg_interface_and_5mmhg_core_gate": passes_unrounded_min_face,
    }


def compute_early_washout_and_catalase_derating_checks() -> Dict[str, Any]:
    """Executable parameterized replay of 48-h early washout in derated 462.6 mg Design X pouch and 2.5 um discrete-bead catalase sweeps (IIP-0021; DEC-100)."""
    # 1. Early 48-h washout in a 41.55% CaO2-derated (462.6 mg) Design X (a_frac = 0.34) pouch under t_50 = 60 h
    inv_scale = 462.6 / (10.9811487 * 72.078)
    a_frac = 0.34
    nz = 51
    half_L = 0.0175
    geometry = _slab_control_volume_profiles(nz, half_L, lamina_half_width_fraction=a_frac)
    z_grid = geometry["z"]
    dz = float(z_grid[1] - z_grid[0])
    s_prof = geometry["central_source"]
    central_mask = geometry["central_mask"]
    d_prof_int = geometry["outer_demand"][1:-1]
    phi_2500 = (2500.0 * VOL_1_IEQ_CM3) / (2.0 * half_L)
    local_phi_islet = phi_2500 / (1.0 - a_frac)
    d_o2_faces = _slab_oxygen_face_diffusivities(z_grid, 0.42 ** 1.5, lamina_half_width_fraction=a_frac, d_o2_hydrogel_override_cm2_s=None)
    k_ref_s = math.log(2.0) / (68.0 * 3600.0)
    r_o2_0_mol_s = (0.45 * inv_scale) * (phi_2500 * VMAX_ISLET_PURE_MOL_CM3_S * 1.15) * 7.00
    n_cao2_initial_mmol = (2.0 * r_o2_0_mol_s / k_ref_s) * 1e3
    t_grid = [float(h) for h in range(337)]

    def perf_ode(t_h: float, y: np.ndarray) -> np.ndarray:
        exp_arg = -(t_h - 60.0) / 8.0
        targ = 0.0 if exp_arg > 700.0 else 0.97 / (1.0 + math.exp(exp_arg))
        return np.array([(targ - y[0]) / 3.0])

    perf_y = rk4_integrate(perf_ode, (0.0, 336.0), np.array([0.01]), t_grid, dt_max=0.25)[0]
    washout_48h_cases: Dict[str, Any] = {}
    for law in ("first_order", "ginstling_brounshtein"):
        rem_vec = _cao2_inventory_fractions(np.asarray(t_grid), 68.0, law)
        k_hyd_s = math.log(2.0) / (68.0 * 3600.0)
        k_gb_h = (1.0 - (2.0 / 3.0) * 0.5 - (0.5 ** (2.0 / 3.0))) / 68.0
        min_post_wash_slab = math.inf
        for idx, t_h in enumerate(t_grid):
            endo_mult = 0.65 if t_h <= 48.0 else 1.0
            v_dem = (phi_2500 * VMAX_ISLET_PURE_MOL_CM3_S * (1.15 * endo_mult)) / ALPHA_BUNSEN_MOL_CM3_MMHG
            m_rem = max(0.0, float(rem_vec[idx]))
            if law == "ginstling_brounshtein":
                denom_gb = max(0.05, (max(1e-9, m_rem) ** (-1.0 / 3.0)) - 1.0) if m_rem > 0.0 else math.inf
                rate_s = (1.5 * (k_gb_h / 3600.0) / denom_gb) if math.isfinite(denom_gb) else 0.0
                o2_gen = 0.5 * rate_s * (n_cao2_initial_mmol * 1e-3) / 7.00
            else:
                o2_gen = 0.5 * k_hyd_s * (n_cao2_initial_mmol * m_rem * 1e-3) / 7.00
            s_h2o2 = 2.0 * o2_gen * 1e9 * s_prof
            cat_frac = math.exp(-math.log(2.0) * t_h / 168.0)
            k1_prof = 0.008 + (18.0 * cat_frac - 0.008) * central_mask[1:-1]
            kp_s = 0.14 * float(perf_y[idx])
            perox = _solve_peroxide_slab_bvp(s_h2o2[1:-1], dz, k1_prof, kp_s, km_uM=25000.0)
            q_src = (0.5 * perox["decomposition_uM_s"] * 1e-9) / ALPHA_BUNSEN_MOL_CM3_MMHG
            p = np.full(nz, 40.0, dtype=np.float64)
            dl = (d_o2_faces[:-1] / (dz * dz)).copy()
            dr = (d_o2_faces[1:] / (dz * dz)).copy()
            for _ in range(80):
                pi = p[1:-1]
                diff_t = dl * (p[:-2] - pi) + dr * (p[2:] - pi)
                cons = v_dem * d_prof_int * (pi / (KM_O2_MMHG + pi))
                res = diff_t - cons + q_src + kp_s * (40.0 - pi)
                jdiag = -(dl + dr) - v_dem * d_prof_int * (KM_O2_MMHG / ((KM_O2_MMHG + pi) ** 2)) - kp_s
                mat = np.diag(jdiag) + np.diag(dr[:-1], 1) + np.diag(dl[1:], -1)
                step = np.linalg.solve(mat, -res)
                p[1:-1] = np.maximum(0.0, pi + 0.8 * step)
                if float(np.max(np.abs(step))) < 1e-6:
                    break
            if t_h > 48.0:
                min_post_wash_slab = min(min_post_wash_slab, float(np.min(p)))
        bvp_100 = solve_spherical_cluster_po2_bvp(
            min_post_wash_slab, 0.0050, phi_islet_in_slab=local_phi_islet, ocr_multiplier=1.0
        )
        washout_48h_cases[law] = {
            "derated_cao2_mass_mg": 462.6,
            "inosculation_t50_h": 60.0,
            "washout_hour": 48.0,
            "post_washout_min_slab_po2_mmhg": round(min_post_wash_slab, 4),
            "post_washout_100um_gel_only_surface_po2_mmhg": round(float(bvp_100["wigner_seitz_two_zone_fv_gel_only_supply_surface_po2_unrounded_mmhg"]), 4),
            "post_washout_100um_gel_only_core_po2_mmhg": round(float(bvp_100["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"]), 4),
        }

    # 2. Parameterized 2.5 um discrete edge-bead H2O2 replay for 73,800 IU retained (~105,429 IU post-cure) vs 37,800 IU split vs 56.3% bead-number-derated catalase
    h_cm = 2.5e-4
    nz3 = int(round(0.0350 / h_cm))
    r_b = 25.0e-4
    v_b = (4.0 / 3.0) * math.pi * (r_b ** 3)
    lam_cm = 0.0100
    r_o2_0_base = 0.45 * (phi_2500 * VMAX_ISLET_PURE_MOL_CM3_S * 1.15)
    r_h2o2_0_uM_s = 2.0 * r_o2_0_base * 1e9
    catalase_cases: Dict[str, Any] = {}
    for cid, inv_sc, cat_iu_333, bead_density_derated in (
        ("Retained_73800IU_105429IU_PostCure_t24_FullCaO2", 1.0, 73800.0, False),
        ("Split_37800IU_ZeroAddedEnzyme_t24_FullCaO2", 1.0, 37800.0, False),
        ("BeadDensityDerated_56p3pct_41550IU_t24", 0.563, 73800.0 * 0.563, True),
    ):
        solid_frac = 0.58 * (inv_sc if bead_density_derated else 1.0)
        side_cm = max(math.sqrt(v_b / (solid_frac * lam_cm)), 50.0 * 1.15e-4)
        nx3 = max(16, int(round(side_cm / h_cm)))
        dx3 = side_cm / nx3
        xs3 = (np.arange(nx3) + 0.5) * dx3 - 0.5 * side_cm
        zs3 = (np.arange(nz3) + 0.5) * h_cm - 0.0175
        X3, Y3, Z3 = np.meshgrid(xs3, xs3, zs3, indexing="ij")
        r_dist = np.sqrt(X3 ** 2 + Y3 ** 2 + (Z3 - (0.5 * lam_cm - r_b)) ** 2)
        in_core = r_dist <= (r_b - 0.5 * h_cm)
        in_shell = (r_dist > (r_b - 0.5 * h_cm)) & (r_dist <= (r_b + 0.6 * h_cm))
        in_lam = np.abs(Z3) <= 0.5 * lam_cm
        in_buf = (np.abs(Z3) > 0.5 * lam_cm) & (np.abs(Z3) <= (0.5 * lam_cm + 0.0020))
        src_3d = np.zeros((nx3, nx3, nz3), dtype=np.float64)
        src_3d[in_shell] = ((r_h2o2_0_uM_s * inv_sc) * (68.0 / 24.0)) / float(np.mean(in_shell))
        diff_3d = np.where(in_core, 0.0, D_H2O2_HYDROGEL_CM2_S)
        cat_iu_200 = cat_iu_333 * (200.0 / 333.3333333333333)
        lam_iu_200 = cat_iu_200 * (22680.0 / 44280.0) if cat_iu_333 > 40000.0 else cat_iu_200 * 0.5
        buf_iu_200 = cat_iu_200 - lam_iu_200
        k_cat = np.full((nx3, nx3, nz3), 0.008, dtype=np.float64)
        k_cat[in_lam & (~in_core)] = (lam_iu_200 / (7.0 * 1500.0)) / float(np.mean(in_lam & (~in_core)))
        k_cat[in_buf] = (buf_iu_200 / (7.0 * 1500.0)) / float(np.mean(in_buf))
        kp_3d = np.where(in_lam | in_buf, 0.0, 0.14 * 0.01)
        sol_h = _solve_3d_h2o2_strict_iip_0019(diff_3d, src_3d, k_cat, kp_3d, dx3, dx3, h_cm)
        h3 = sol_h["h_3d"]
        kp_idx = int(np.argmin(np.abs(zs3 - 0.0070)))
        pk = float(np.max(h3[:, :, kp_idx]))
        catalase_cases[cid] = {
            "retained_active_catalase_iu_333cm2": round(cat_iu_333, 1),
            "post_cure_t0_active_catalase_iu_at_70pct_day7_retention": round(cat_iu_333 / 0.70, 1),
            "islet_plane_24h_burst_max_h2o2_uM": round(pk, 4),
            "passes_2p5uM_tier1_target": bool(pk <= 2.5),
        }
    return {
        "early_48h_washout_derated_462p6mg_t50_60h_cases": washout_48h_cases,
        "parameterized_2p5um_discrete_bead_catalase_cases": catalase_cases,
    }


def build_lineage_partitioned_metabolic_rest_and_m101_exclusion_audit_iip_0021() -> Dict[str, Any]:
    """Build reproducible Layer-4 lineage-partitioned OCR, Design Z post-washout, staged exercise lag, and M101 reservoir audit (IIP-0021; DEC-100)."""
    # 1. Alias vs two-scale lineage-partitioned verification
    legacy_alias_070 = _run_single_pouch_pde_regime(
        "AUDIT_LEGACY_ALIAS_0P70", 0.45, "central", 68.0, True, 0.97,
        demand_multiplier_extra=0.70, _assess_numerical_gate=False,
    )
    uniform_ocr_070 = _run_single_pouch_pde_regime(
        "AUDIT_UNIFORM_OCR_0P70", 0.45, "central", 68.0, True, 0.97,
        areal_loading_ieq_cm2=2500.0, cell_intrinsic_ocr_multiplier=0.70, _assess_numerical_gate=False,
    )
    two_scale_endo055_vasc100 = run_lineage_partitioned_intrinsic_ocr_regime(
        regime_id="AUDIT_TWO_SCALE_ENDO0P55_VASC1P00",
        areal_loading_ieq_cm2=2500.0,
        endocrine_intrinsic_ocr_multiplier=0.55,
        vascular_intrinsic_ocr_multiplier=1.00,
    )
    two_scale_endo150_vasc100 = run_lineage_partitioned_intrinsic_ocr_regime(
        regime_id="AUDIT_TWO_SCALE_ENDO1P50_VASC1P00",
        areal_loading_ieq_cm2=2500.0,
        endocrine_intrinsic_ocr_multiplier=1.50,
        vascular_intrinsic_ocr_multiplier=1.00,
    )

    # 2. Corrected slab washout eigenmodes (two-sink vs one-sink, D = 2.8e-6 vs 4.5e-6 cm^2/s)
    washout_eigenmodes = [
        compute_slab_drug_washout_eigenmodes_s(h_um, d_val)
        for d_val in (2.8e-6, 4.5e-6)
        for h_um in (140.0, 300.0, 350.0)
    ]

    # 3. Parameterized Design Z acute vs chronic vs adverse mixed vs passive 5% PFC matrix
    design_z_matrix = {
        "Acute_25mmHg_1p0xOCR_AcuteGel": compute_design_z_140um_parameterized_case(
            bed_po2_mmhg=25.0, ocr_multiplier=1.0, d_gel_cm2_s=9.40254e-6, k_perf_s_inv=0.097
        ),
        "Acute_25mmHg_0p70xOCR_AcuteGel": compute_design_z_140um_parameterized_case(
            bed_po2_mmhg=25.0, ocr_multiplier=0.70, d_gel_cm2_s=9.40254e-6, k_perf_s_inv=0.097
        ),
        "Acute_40mmHg_1p0xOCR_AcuteGel": compute_design_z_140um_parameterized_case(
            bed_po2_mmhg=40.0, ocr_multiplier=1.0, d_gel_cm2_s=9.40254e-6, k_perf_s_inv=0.097
        ),
        "Chronic_25mmHg_1p097xOCR_ChronicGel": compute_design_z_140um_parameterized_case(
            bed_po2_mmhg=25.0, ocr_multiplier=1.097, d_gel_cm2_s=1.5e-5, k_perf_s_inv=0.1358
        ),
        "Chronic_40mmHg_1p097xOCR_ChronicGel": compute_design_z_140um_parameterized_case(
            bed_po2_mmhg=40.0, ocr_multiplier=1.097, d_gel_cm2_s=1.5e-5, k_perf_s_inv=0.1358
        ),
        "Chronic_25mmHg_1p097xOCR_5volPctPFC_ChronicGel": compute_design_z_140um_parameterized_case(
            bed_po2_mmhg=25.0, ocr_multiplier=1.097, d_gel_cm2_s=1.5e-5, k_perf_s_inv=0.1358, pfc_vol_fraction=0.05
        ),
        "Adverse_40mmHg_1p097xOCR_UnremodeledAcuteGel_kperf0p097": compute_design_z_140um_parameterized_case(
            bed_po2_mmhg=40.0, ocr_multiplier=1.097, d_gel_cm2_s=9.40254e-6, k_perf_s_inv=0.097
        ),
    }

    # 4. M101 standalone closed-slab reservoir bounds across 100->15 mmHg and 40->15 mmHg (n_H = 2.5 and 3.0)
    m101_bounds = {
        "AirSaturated_100_to_15mmHg_n2p5": compute_m101_hill_reservoir_bound(p_start_mmhg=100.0, hill_n=2.5),
        "AirSaturated_100_to_15mmHg_n3p0": compute_m101_hill_reservoir_bound(p_start_mmhg=100.0, hill_n=3.0),
        "HostBed_40_to_15mmHg_n2p5": compute_m101_hill_reservoir_bound(p_start_mmhg=40.0, hill_n=2.5),
        "HostBed_40_to_15mmHg_n3p0": compute_m101_hill_reservoir_bound(p_start_mmhg=40.0, hill_n=3.0),
    }

    washout_and_cat = compute_early_washout_and_catalase_derating_checks()

    return {
        "contribution_id": "IIP-0021",
        "decision_id": "DEC-100",
        "baseline_cao2_mass_mg_preserved": 791.5,
        "hurdle1_computational_judgement_preserved_pct": 88,
        "inosculation_t50_bounds_preserved_h": [36.0, 60.0],
        "primary_citations": [
            "PMID:23935835",
            "PMID:17130499",
            "PMID:17503968",
            "PMID:42547502",
            "PMID:37318185",
            "PMID:16897713",
            "PMID:41951603",
            "PMID:23190609",
            "PMID:34572979",
            "PMID:29789532",
            "PMID:32893325",
            "PMID:34252539",
        ],
        "two_scale_lineage_ocr_verification": {
            "legacy_dec064_loading_alias_at_0p70": {
                "areal_loading_ieq_cm2": legacy_alias_070["areal_loading_ieq_cm2"],
                "min_slab_po2_mmhg": round(float(legacy_alias_070["min_slab_po2_unrounded_mmhg"]), 5),
                "gel_only_120um_core_po2_mmhg": round(
                    float(legacy_alias_070["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_mmhg"]), 5
                ),
            },
            "uniform_cell_intrinsic_0p70_at_2500ieq": {
                "areal_loading_ieq_cm2": uniform_ocr_070["areal_loading_ieq_cm2"],
                "min_slab_po2_mmhg": round(float(uniform_ocr_070["min_slab_po2_unrounded_mmhg"]), 5),
                "gel_only_120um_core_po2_mmhg": round(
                    float(uniform_ocr_070["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_mmhg"]), 5
                ),
            },
            "two_scale_endo0p55_vasc1p00_at_2500ieq": {
                "slab_normalized_ocr_multiplier": two_scale_endo055_vasc100["slab_normalized_ocr_multiplier"],
                "cluster_endocrine_ocr_multiplier": two_scale_endo055_vasc100["cluster_endocrine_ocr_multiplier"],
                "min_slab_po2_mmhg": round(float(two_scale_endo055_vasc100["min_slab_po2_unrounded_mmhg"]), 5),
                "gel_only_120um_core_po2_mmhg": round(
                    float(two_scale_endo055_vasc100["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_mmhg"]), 5
                ),
            },
            "two_scale_endo1p50_vasc1p00_at_2500ieq": {
                "slab_normalized_ocr_multiplier": two_scale_endo150_vasc100["slab_normalized_ocr_multiplier"],
                "cluster_endocrine_ocr_multiplier": two_scale_endo150_vasc100["cluster_endocrine_ocr_multiplier"],
                "min_slab_po2_mmhg": round(float(two_scale_endo150_vasc100["min_slab_po2_unrounded_mmhg"]), 5),
                "gel_only_120um_core_po2_mmhg": round(
                    float(two_scale_endo150_vasc100["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_mmhg"]), 5
                ),
            },
            "biological_scope_qualification": (
                "14.30% vascular cell fraction (133.5M / 933.5M) and 13.04% modeled vascular OCR share (0.15 / 1.15) are distinct quantities; "
                "while Ma et al. 2013 (PMID:23935835) measured rat-islet OCR after washout/reoxygenation, Sweet & Gilbert 2006 (PMID:17130499) "
                "observed ~30% acute glucose-stimulated rat-islet OCR reduction under diazoxide/nimodipine and MacDonald et al. 2007 (PMID:17503968) "
                "showed human alpha-cell K_ATP sensitivity to diazoxide, making empirical 120-h assembled-organoid OCR + glucagon/GSIS measurement mandatory."
            ),
        },
        "slab_free_drug_washout_first_eigenmode_table": {
            "eigenmodes": washout_eigenmodes,
            "boundary_and_diffusivity_note": (
                "Two-sink tau_1 = H^2/(pi^2 * D) gives 7.09, 32.57, and 44.33 s at 140, 300, and 350 um for D = 2.8e-6 cm^2/s "
                "(4.41, 20.26, and 27.58 s correspond to faster aqueous D = 4.5e-6 cm^2/s), whereas one-sink/one-reflecting geometry "
                "is 4x longer (28.37, 130.26, and 177.30 s at D = 2.8e-6 cm^2/s); all remain <3 min e-folding times vs 120-h bridge duration."
            ),
        },
        "design_z_140um_parameterized_acute_chronic_and_pfc_matrix": {
            "operative_gate_definition": "fv_harmonic_face_min_unrounded_mmhg >= 15.0 AND min_core_po2_unrounded_mmhg >= 5.0 (coupled with Stage-2 loaded Readout 2 perifusion kinetics; IIP-0025; DEC-104)",
            "acute_vs_chronic_parameter_disclosure": (
                "Acute unremodeled gel uses d_gel_cm2_s = 9.40254e-6 cm^2/s and k_perf = 0.097 s^-1, whereas chronic vascularized gel assumes "
                "d_gel_cm2_s = 1.5e-5 cm^2/s (+59.5%) and k_perf = 0.1358 s^-1; adverse unremodeled chronic OCR (1.097x at acute d_gel/k_perf) "
                "is tabulated explicitly alongside nominal chronic cases."
            ),
            "cases": design_z_matrix,
        },
        "staged_portal_exercise_insulin_lag_bounds_and_qualifications": {
            "v0p18_150k_total_90k_beta_eq_Tins5p17_tau8p0_preserved_paracrine_min_G_mM": 4.6372,
            "v0p18_150k_total_90k_beta_eq_Tins5p17_tau8p0_scaled_paracrine_min_G_mM": 3.5296,
            "v0p36_300k_total_180k_beta_eq_Tins3p64_tau8p0_min_G_mM": 3.5005,
            "v0p60_500k_total_300k_beta_eq_Tins2p71_tau7p1429_min_G_mM": 3.5001,
            "v0p60_500k_total_300k_beta_eq_Tins1p96_tau8p0_min_G_mM": 3.5004,
            "qualification_note": (
                "Deterministic ODE margins at T_ins = 3.64 / 2.71 / 1.96 min sit 0.0001-0.0005 mM above 3.50 mM without exogenous rescue/controller "
                "modeling, v = 0.18 drops from 4.6372 to 3.5296 mM (<3.90 mM) if local paracrine drive scales down with v, and the 150,000-IEQ omental "
                "cassette is distinct from Roadmap Stage-5A's 25,000-35,000 IEQ forearm sentinel; full-dose v = 0.60 clearance remains non-waivable."
            ),
        },
        "m101_closed_slab_standalone_reservoir_bounds": {
            "scope_qualification": (
                "Conditional standalone finite-reservoir bound in a closed 10 mL slab (5 g/L = 50 mg carrier, vs 5,490.58 umol O2 from 791.5 mg CaO2; "
                "Rousselot et al. 2006 PMID:16897713 reports P50 = 7.05 +/- 0.93 mmHg, n50 = 2.54 +/- 0.23; distinct from air-exposed 1 g/L 24-h culture "
                "in Lemaire et al. 2023 PMID:37318185 and not a general facilitated-diffusion proof under open external oxygen resupply)."
            ),
            "bounds": m101_bounds,
        },
        **washout_and_cat,
    }
# === END_IIP_0021_LINEAGE_OCR_AND_M101_AUDIT ===


# === BEGIN_IIP_0025_HURDLE4_SPATIAL_OXYGEN_CATALASE_AND_CHALLENGERS ===
def build_hurdle4_spatial_oxygen_catalase_and_route_challengers_iip_0025() -> Dict[str, Any]:
    """
    Build reproducible Hurdle-4 unrounded multi-mesh dual-band worst-face oxygen, two-timepoint
    recombinant human catalase (UniProt P04040) sizing/peroxide/endotoxin reconciliation, Design Z
    standoff/cutoff sensitivity, and zero-primate Contrasts B1-B3 audit (IIP-0025; DEC-104).
    """
    p_krogh_ch = 1.50e-5 * ALPHA_BUNSEN_MOL_CM3_MMHG
    p_krogh_is = D_O2_ISLET_TISSUE_CM2_S * ALPHA_BUNSEN_MOL_CM3_MMHG
    p_ext_col = p_krogh_ch / 3.0
    curative_ieq = 500_000.0

    def _solve_uc_iip25(
        load_ieq: float,
        diam_um: float,
        slab_um: float = 350.0,
        lam_um: float = 100.0,
        buf_um: float = 0.0,
        p_bed_mmhg: float = 35.0,
        standoff_phys_um: float = 15.0,
        ocr_mult: float = 1.097,
        k_perf_val: float = 0.14 * 0.97,
        nx_c: int = 40,
        nz_c: int | None = None,
        shift_half_voxel: bool = False,
        eps_lam_cm: float = 0.0,
        gel_ref_load_ieq: float | None = None,
    ) -> Dict[str, Any]:
        if nz_c is None:
            nz_c = int(round((slab_um / 5.0) * (nx_c / 40.0)))
        rad_cm = 0.5 * diam_um * 1e-4
        vol_sph = (4.0 / 3.0) * math.pi * (rad_cm ** 3)
        n_face = 0.5 * ((load_ieq * VOL_1_IEQ_CM3) / vol_sph)
        side_cm = math.sqrt(1.0 / n_face)
        slab_cm = slab_um * 1e-4
        lam_half_cm = 0.5 * lam_um * 1e-4
        buf_cm = buf_um * 1e-4
        band_in = lam_half_cm + buf_cm
        band_out = 0.5 * slab_cm
        band_thick_um = (band_out - band_in) * 1e4
        if band_thick_um < diam_um:
            raise RuntimeError(f"Cell band {band_thick_um:.1f} um < cluster diameter {diam_um:.1f} um")
        dx_c, dz_c = side_cm / nx_c, slab_cm / nz_c
        xs = (np.arange(nx_c) + 0.5) * dx_c - 0.5 * side_cm
        zs = (np.arange(nz_c) + 0.5) * dz_c - 0.5 * slab_cm
        X, Y, Z = np.meshgrid(xs, xs, zs, indexing="ij")
        x0 = 0.5 * dx_c if shift_half_voxel else 0.0
        z_mid = 0.5 * (band_in + band_out)
        z_c = min(band_out - rad_cm - min(0.0002, 0.5 * (band_out - band_in - 2.0 * rad_cm)), z_mid)
        z_c = max(z_c, band_in + rad_cm)
        ddx = np.minimum(np.abs(X - x0), side_cm - np.abs(X - x0))
        ddy = np.minimum(np.abs(Y - x0), side_cm - np.abs(Y - x0))
        top_sph = (ddx ** 2 + ddy ** 2 + (Z - z_c) ** 2) <= (rad_cm ** 2)
        bot_sph = (ddx ** 2 + ddy ** 2 + (Z + z_c) ** 2) <= (rad_cm ** 2)
        in_sph = top_sph | bot_sph
        in_lam = np.abs(Z) <= (lam_half_cm + eps_lam_cm)
        in_buf = (np.abs(Z) > (lam_half_cm + eps_lam_cm)) & (np.abs(Z) <= (band_in + eps_lam_cm))
        sph_asym = int(np.sum(top_sph != bot_sph[:, :, ::-1]))
        lam_asym = int(np.sum(in_lam != in_lam[:, :, ::-1]))
        buf_asym = int(np.sum(in_buf != in_buf[:, :, ::-1]))
        perm = np.where(in_lam, p_krogh_ch * (0.42 ** 1.5), p_krogh_ch)
        perm[in_sph] = p_krogh_is
        in_gel = (~in_sph) & (~in_lam) & (~in_buf)
        t_phi = (load_ieq * VOL_1_IEQ_CM3) / slab_cm
        t_phi_gel = ((gel_ref_load_ieq if gel_ref_load_ieq is not None else load_ieq) * VOL_1_IEQ_CM3) / slab_cm
        vmax = np.zeros_like(X)
        vmax[in_sph] = (VMAX_ISLET_PURE_MOL_CM3_S * ocr_mult) * (t_phi / float(np.mean(in_sph)))
        vmax[in_gel] = (t_phi_gel * VMAX_ISLET_PURE_MOL_CM3_S * 0.15 * ocr_mult) / float(np.mean(in_gel))
        kp = np.where(in_gel, float(k_perf_val), 0.0)
        fvm_out = _solve_3d_oxygen_strict_iip_0019(
            perm, vmax, np.zeros_like(X), kp, dx_c, dx_c, dz_c, p_bed_mmhg,
            standoff_z_cm=standoff_phys_um * 1e-4, p_ext=p_ext_col,
        )
        p3 = fvm_out["p_3d"]
        st_t = _compute_exact_fv_interface_stats_iip_0019(p3, perm, top_sph)
        st_b = _compute_exact_fv_interface_stats_iip_0019(p3, perm, bot_sph)
        dual_min_raw = float(min(st_t["fv_harmonic_face_min_mmhg"], st_b["fv_harmonic_face_min_mmhg"]))
        dual_mean_raw = float(min(st_t["fv_harmonic_face_mean_mmhg"], st_b["fv_harmonic_face_mean_mmhg"]))
        core_min_raw = float(np.min(p3[in_sph]))
        return {
            "mesh": f"{nx_c}x{nx_c}x{nz_c}",
            "fv_harmonic_face_mean_mmhg": round(dual_mean_raw, 4),
            "fv_harmonic_face_min_unrounded_mmhg": dual_min_raw,
            "fv_harmonic_face_min_mmhg": round(dual_min_raw, 4),
            "top_band_face_min_mmhg": round(float(st_t["fv_harmonic_face_min_mmhg"]), 4),
            "bottom_band_face_min_mmhg": round(float(st_b["fv_harmonic_face_min_mmhg"]), 4),
            "min_core_po2_unrounded_mmhg": core_min_raw,
            "min_core_po2_mmhg": round(core_min_raw, 4),
            "sphere_mask_asymmetry_voxels": sph_asym,
            "lamina_mask_asymmetry_voxels": lam_asym,
            "film_mask_asymmetry_voxels": buf_asym,
            "passes_unrounded_dual_band": bool(dual_min_raw >= 15.0 and core_min_raw >= 5.0),
        }

    def _multimesh_pack(
        load_ieq: float,
        diam_um: float,
        slab_um: float = 350.0,
        buf_um: float = 0.0,
        standoff_phys_um: float = 15.0,
        ocr_mult: float = 1.097,
    ) -> Dict[str, Any]:
        r40 = _solve_uc_iip25(load_ieq, diam_um, slab_um=slab_um, buf_um=buf_um, standoff_phys_um=standoff_phys_um, ocr_mult=ocr_mult, nx_c=40)
        r60 = _solve_uc_iip25(load_ieq, diam_um, slab_um=slab_um, buf_um=buf_um, standoff_phys_um=standoff_phys_um, ocr_mult=ocr_mult, nx_c=60)
        r80 = _solve_uc_iip25(load_ieq, diam_um, slab_um=slab_um, buf_um=buf_um, standoff_phys_um=standoff_phys_um, ocr_mult=ocr_mult, nx_c=80)
        mins = [r40["fv_harmonic_face_min_unrounded_mmhg"], r60["fv_harmonic_face_min_unrounded_mmhg"], r80["fv_harmonic_face_min_unrounded_mmhg"]]
        cores = [r40["min_core_po2_unrounded_mmhg"], r60["min_core_po2_unrounded_mmhg"], r80["min_core_po2_unrounded_mmhg"]]
        min_all = min(mins)
        core_all = min(cores)
        return {
            "nx40": r40,
            "nx60": r60,
            "nx80": r80,
            "fv_face_min_by_nx_40_60_80_mmhg": [round(v, 4) for v in mins],
            "min_over_nx_40_60_80_unrounded_mmhg": min_all,
            "min_over_nx_40_60_80_mmhg": round(min_all, 4),
            "mesh_spread_mmhg": round(max(mins) - min_all, 4),
            "min_core_over_nx_40_60_80_mmhg": round(core_all, 4),
            "passes_unrounded_multimesh_dual_band_iip_0025": bool(min_all >= 15.0 and core_all >= 5.0),
        }

    mm_100_nofilm = _multimesh_pack(1500.0, 100.0, slab_um=350.0, buf_um=0.0)
    mm_100_350bar = _multimesh_pack(1500.0, 100.0, slab_um=350.0, buf_um=20.0)
    mm_100_390bar = _multimesh_pack(1500.0, 100.0, slab_um=390.0, buf_um=20.0)
    mm_80_nofilm = _multimesh_pack(1500.0, 80.0, slab_um=350.0, buf_um=0.0)
    mm_80_350bar = _multimesh_pack(1500.0, 80.0, slab_um=350.0, buf_um=20.0)
    mm_80_390bar = _multimesh_pack(1500.0, 80.0, slab_um=390.0, buf_um=20.0)
    mm_80_plus10_350bar = _multimesh_pack(1500.0, 80.0, slab_um=350.0, buf_um=20.0, standoff_phys_um=16.5, ocr_mult=1.097 * 1.10)
    uc_80_plus10_nofilm_nx40 = _solve_uc_iip25(1500.0, 80.0, slab_um=350.0, buf_um=0.0, standoff_phys_um=16.5, ocr_mult=1.097 * 1.10, nx_c=40)
    uc_80_350bar_shift_nx40 = _solve_uc_iip25(1500.0, 80.0, slab_um=350.0, buf_um=20.0, nx_c=40, shift_half_voxel=True)

    # 60x60x105 7,200-voxel boundary-plane reflection-symmetry diagnostics
    load_095 = (6.0 / 7.0) * 1500.0 / 0.95
    sym_095_inc_fv = _solve_uc_iip25(load_095, 80.0, 350.0, 100.0, 20.0, standoff_phys_um=16.5, ocr_mult=1.097 * 1.10, nx_c=60, nz_c=105, eps_lam_cm=+1e-12, gel_ref_load_ieq=1500.0)
    sym_095_exc_fv = _solve_uc_iip25(load_095, 80.0, 350.0, 100.0, 20.0, standoff_phys_um=16.5, ocr_mult=1.097 * 1.10, nx_c=60, nz_c=105, eps_lam_cm=-1e-12, gel_ref_load_ieq=1500.0)
    sym_095_inc_co = _solve_uc_iip25(load_095, 80.0, 350.0, 100.0, 20.0, standoff_phys_um=16.5, ocr_mult=1.097 * 1.10, nx_c=60, nz_c=105, eps_lam_cm=+1e-12)
    sym_095_exc_co = _solve_uc_iip25(load_095, 80.0, 350.0, 100.0, 20.0, standoff_phys_um=16.5, ocr_mult=1.097 * 1.10, nx_c=60, nz_c=105, eps_lam_cm=-1e-12)
    sym_nom80_inc = _solve_uc_iip25(1500.0, 80.0, 350.0, 100.0, 20.0, nx_c=60, nz_c=105, eps_lam_cm=+1e-12)
    sym_nom80_exc = _solve_uc_iip25(1500.0, 80.0, 350.0, 100.0, 20.0, nx_c=60, nz_c=105, eps_lam_cm=-1e-12)

    layout_b_119um_caught = False
    try:
        _solve_uc_iip25(1500.0, 100.0, slab_um=350.0, lam_um=119.0, buf_um=20.0, nx_c=40)
    except RuntimeError:
        layout_b_119um_caught = True

    # Unrounded Wigner-Seitz BVP 0.497 mmHg boundary check (preventing 0.497 -> 0.50 false pass)
    lo_ws, hi_ws = 5.0, 20.0
    for _ in range(70):
        mid_ws = 0.5 * (lo_ws + hi_ws)
        if solve_spherical_cluster_po2_bvp(mid_ws, 0.0060)["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"] < 0.497:
            lo_ws = mid_ws
        else:
            hi_ws = mid_ws
    bvp_0497 = solve_spherical_cluster_po2_bvp(0.5 * (lo_ws + hi_ws), 0.0060)

    # Design Z & Contrast B3 unrounded fv_harmonic_face_min_mmhg cases & root solves
    def _find_z_cutoff(diam_um: float, strom: float, kp_v: float, nx_z: int, nz_z: int, lo_init: float, hi_init: float, ext_f: float = 1.0) -> float:
        a, b = lo_init, hi_init

        def _margin(pb_v: float) -> float:
            rz = compute_design_z_140um_parameterized_case(
                bed_po2_mmhg=pb_v,
                ocr_multiplier=1.097,
                d_gel_cm2_s=1.5e-5,
                k_perf_s_inv=kp_v,
                cluster_diam_um=diam_um,
                standoff_ext_diffusivity_factor=ext_f,
                stromal_ocr_fraction=strom,
                nx_override=nx_z,
                nz_override=nz_z,
            )
            return min(rz["fv_harmonic_face_min_unrounded_mmhg"] - 15.0, rz["min_core_po2_unrounded_mmhg"] - 5.0)

        fa, fb = _margin(a), _margin(b)
        while fa >= 0.0:
            a -= 1.0
            fa = _margin(a)
        while fb < 0.0:
            b += 1.0
            fb = _margin(b)
        side_flag = 0
        for _ in range(14):
            c = (fa * b - fb * a) / (fa - fb)
            fc = _margin(c)
            if abs(fc) < 1e-9 or abs(b - a) < 1e-7:
                return c
            if fc >= 0.0:
                b, fb = c, fc
                if side_flag == 1:
                    fa *= 0.5
                side_flag = 1
            else:
                a, fa = c, fc
                if side_flag == -1:
                    fb *= 0.5
                side_flag = -1
        return (fa * b - fb * a) / (fa - fb)

    z_pb30_100 = compute_design_z_140um_parameterized_case(bed_po2_mmhg=30.0, ocr_multiplier=1.097, d_gel_cm2_s=1.5e-5, k_perf_s_inv=0.1358, cluster_diam_um=100.0)
    z_pb30_80 = compute_design_z_140um_parameterized_case(bed_po2_mmhg=30.0, ocr_multiplier=1.097, d_gel_cm2_s=1.5e-5, k_perf_s_inv=0.1358, cluster_diam_um=80.0)
    z_pb30_100_div3 = compute_design_z_140um_parameterized_case(
        bed_po2_mmhg=30.0, ocr_multiplier=1.097, d_gel_cm2_s=1.5e-5, k_perf_s_inv=0.1358, cluster_diam_um=100.0, standoff_ext_diffusivity_factor=1.0 / 3.0
    )
    z_pfc5_25_100 = compute_design_z_140um_parameterized_case(
        bed_po2_mmhg=25.0, ocr_multiplier=1.097, d_gel_cm2_s=1.5e-5, k_perf_s_inv=0.1358, pfc_vol_fraction=0.05, cluster_diam_um=100.0
    )
    z_pfc5_25_80 = compute_design_z_140um_parameterized_case(
        bed_po2_mmhg=25.0, ocr_multiplier=1.097, d_gel_cm2_s=1.5e-5, k_perf_s_inv=0.1358, pfc_vol_fraction=0.05, cluster_diam_um=80.0
    )
    b3_pb30_intact_100 = compute_design_z_140um_parameterized_case(
        bed_po2_mmhg=30.0, ocr_multiplier=1.097, d_gel_cm2_s=1.5e-5, k_perf_s_inv=0.1358, cluster_diam_um=100.0, stromal_ocr_fraction=0.0
    )
    b3_pb30_intact_80 = compute_design_z_140um_parameterized_case(
        bed_po2_mmhg=30.0, ocr_multiplier=1.097, d_gel_cm2_s=1.5e-5, k_perf_s_inv=0.1358, cluster_diam_um=80.0, stromal_ocr_fraction=0.0
    )
    b3_pb30_halved_100 = compute_design_z_140um_parameterized_case(
        bed_po2_mmhg=30.0, ocr_multiplier=1.097, d_gel_cm2_s=1.5e-5, k_perf_s_inv=0.0679, cluster_diam_um=100.0, stromal_ocr_fraction=0.0
    )
    b3_pb30_halved_80 = compute_design_z_140um_parameterized_case(
        bed_po2_mmhg=30.0, ocr_multiplier=1.097, d_gel_cm2_s=1.5e-5, k_perf_s_inv=0.0679, cluster_diam_um=80.0, stromal_ocr_fraction=0.0
    )

    cut_100_48 = _find_z_cutoff(100.0, 0.15, 0.1358, 48, 28, 30.0, 31.5, 1.0)
    cut_100_72 = _find_z_cutoff(100.0, 0.15, 0.1358, 72, 42, cut_100_48 - 0.15, cut_100_48 + 0.15, 1.0)
    cut_80_48 = _find_z_cutoff(80.0, 0.15, 0.1358, 48, 28, 30.0, 31.5, 1.0)
    cut_80_72 = _find_z_cutoff(80.0, 0.15, 0.1358, 72, 42, cut_80_48 - 0.15, cut_80_48 + 0.15, 1.0)
    cut_100_div3 = _find_z_cutoff(100.0, 0.15, 0.1358, 48, 28, 34.5, 36.5, 1.0 / 3.0)
    cut_b3_intact_100 = _find_z_cutoff(100.0, 0.0, 0.1358, 48, 28, 28.5, 30.5, 1.0)
    cut_b3_intact_80 = _find_z_cutoff(80.0, 0.0, 0.1358, 48, 28, 28.5, 30.5, 1.0)
    cut_b3_halved_100 = _find_z_cutoff(100.0, 0.0, 0.0679, 48, 28, 29.5, 31.5, 1.0)
    cut_b3_halved_80 = _find_z_cutoff(80.0, 0.0, 0.0679, 48, 28, 29.5, 31.5, 1.0)

    z_ribbon_vol_cm3 = 0.0140 * (1000.0 / 3.0)
    pfc_5pct_vol_cm3 = 0.05 * z_ribbon_vol_cm3
    pfc_5pct_o2_umol = pfc_5pct_vol_cm3 * (20.0 * ALPHA_BUNSEN_MOL_CM3_MMHG) * (40.0 - 15.0) * 1e6
    graft_500k_demand_umol_s = (curative_ieq * VOL_1_IEQ_CM3 * VMAX_ISLET_PURE_MOL_CM3_S * 1.15) * 1e6
    pfc_5pct_bridge_s = pfc_5pct_o2_umol / graft_500k_demand_umol_s

    # Gate P05 two-timepoint (Day-7 >= 70.0% + 336-h >= 73,800 IU P04040) sizing & dual-basis H2O2 profiles
    target_336h_iu = 73_800.0
    precure_cap_iu = 158_300.0
    cure_yield_assumed = 0.65
    postcure_at_cap_iu = precure_cap_iu * cure_yield_assumed  # 102,895.0 IU
    spec_act_iu_mg = 50_000.0
    k2_total_mass_mg = ((target_336h_iu / 0.25) / cure_yield_assumed) / spec_act_iu_mg  # 9.083076923076924 mg

    p05_sizing_scenarios = []
    for sid, d7_pct, r14_frac, t0_iu in (
        ("Live_Undersized_Day7_Basis_105429IU", 70.0, 0.49, target_336h_iu / 0.70),
        ("Ref_50pct_14d_Retention_147600IU", round(100.0 * math.sqrt(0.50), 4), 0.50, target_336h_iu / 0.50),
        ("K1_0p70sq_49pct_14d_Retention_150612IU", 70.0, 0.49, target_336h_iu / (0.70 ** 2)),
        ("Reconciled_65pctYield_80pctDay7_75pctDay14_102895IU", 80.0, 0.75, postcure_at_cap_iu),
        ("Adverse_K2_tHalf168h_295200IU_Failed_Day7", 50.0, 0.25, target_336h_iu / 0.25),
    ):
        precure_iu = t0_iu / cure_yield_assumed
        tot_mg = precure_iu / spec_act_iu_mg
        rem_336_iu = t0_iu * r14_frac
        exact_eu_cap = min(0.10, 0.50 / tot_mg)
        d7_ok = d7_pct >= 70.0
        d14_ok = rem_336_iu >= target_336h_iu - 1e-6
        cap_ok = precure_iu <= precure_cap_iu + 1e-6
        p05_sizing_scenarios.append({
            "scenario_id": sid,
            "assumed_day7_retention_pct": d7_pct,
            "passes_day7_70pct_gate": bool(d7_ok),
            "assumed_336h_retention_fraction": r14_frac,
            "retained_336h_active_iu_333cm2": round(rem_336_iu, 2),
            "passes_336h_73800iu_gate": bool(d14_ok),
            "post_cure_t0_active_iu_333cm2": round(t0_iu, 2),
            "precure_input_iu_at_assumed_65pct_yield": round(precure_iu, 1),
            "within_158300u_precure_ceiling": bool(cap_ok),
            "reconciles_day7_336h_and_158300u_cap": bool(d7_ok and d14_ok and cap_ok),
            "total_p04040_protein_mass_unrounded_mg": tot_mg,
            "total_p04040_protein_mass_mg": round(tot_mg, 4),
            "exact_unrounded_endotoxin_cap_eu_per_mg": exact_eu_cap,
            "display_5dec_endotoxin_cap_eu_per_mg": round(exact_eu_cap, 5),
        })

    h_cm = 2.5e-4
    nz3 = int(round(0.0350 / h_cm))
    r_b = 25.0e-4
    v_b = (4.0 / 3.0) * math.pi * (r_b ** 3)
    lam_cm = 0.0100
    side_cm = max(math.sqrt(v_b / (0.58 * lam_cm)), 50.0 * 1.15e-4)
    nx3 = max(16, int(round(side_cm / h_cm)))
    dx3 = side_cm / nx3
    xs3 = (np.arange(nx3) + 0.5) * dx3 - 0.5 * side_cm
    zs3 = (np.arange(nz3) + 0.5) * h_cm - 0.0175
    X3, Y3, Z3 = np.meshgrid(xs3, xs3, zs3, indexing="ij")
    r_dist = np.sqrt(X3 ** 2 + Y3 ** 2 + (Z3 - (0.5 * lam_cm - r_b)) ** 2)
    in_core = r_dist <= (r_b - 0.5 * h_cm)
    in_shell = (r_dist > (r_b - 0.5 * h_cm)) & (r_dist <= (r_b + 0.6 * h_cm))
    in_lam = np.abs(Z3) <= 0.5 * lam_cm
    in_buf = (np.abs(Z3) > 0.5 * lam_cm) & (np.abs(Z3) <= (0.5 * lam_cm + 0.0020))
    diff_3d = np.where(in_core, 0.0, D_H2O2_HYDROGEL_CM2_S)
    kp_3d = np.where(in_lam | in_buf, 0.0, 0.14 * 0.01)
    kp_idx = int(np.argmin(np.abs(zs3 - 0.0070)))

    iu_sweep = [
        ("t0_105429_iu", target_336h_iu / 0.70),
        ("retained_73800_iu", 73_800.0),
        ("undersized_51660_iu", (target_336h_iu / 0.70) * 0.49),
        ("half_36900_iu", 36_900.0),
        ("undersized_26357_iu", (target_336h_iu / 0.70) * 0.25),
    ]
    dual_basis_h2o2: Dict[str, Any] = {}
    for basis_ieq in (1500.0, 2500.0):
        phi_b = (basis_ieq * VOL_1_IEQ_CM3) / 0.0350
        r_h2o2 = 2.0 * (0.45 * (phi_b * VMAX_ISLET_PURE_MOL_CM3_S * 1.15)) * 1e9
        basis_rows: Dict[str, Any] = {}
        for lbl_iu, iu_val in iu_sweep:
            src_3d = np.zeros((nx3, nx3, nz3), dtype=np.float64)
            src_3d[in_shell] = (r_h2o2 * (68.0 / 24.0)) / float(np.mean(in_shell))
            cat_200 = iu_val * 0.60
            lam_200 = cat_200 * (22_680.0 / 44_280.0)
            buf_200 = cat_200 - lam_200
            k_cat = np.full((nx3, nx3, nz3), 0.008, dtype=np.float64)
            k_cat[in_lam & (~in_core)] = (lam_200 / (7.0 * 1500.0)) / float(np.mean(in_lam & (~in_core)))
            k_cat[in_buf] = (buf_200 / (7.0 * 1500.0)) / float(np.mean(in_buf))
            h_res = _solve_3d_h2o2_strict_iip_0019(diff_3d, src_3d, k_cat, kp_3d, dx3, dx3, h_cm)
            h3 = h_res["h_3d"]
            cc_uM = float(np.max(h3[:, :, kp_idx]))
            iface_uM = float(np.max(0.5 * (h3[:, :, kp_idx - 1] + h3[:, :, kp_idx])))
            basis_rows[lbl_iu] = {
                "active_catalase_iu_333cm2": round(iu_val, 2),
                "gel_interface_z70p0um_max_h2o2_uM": round(iface_uM, 4),
                "gel_interface_z70p0um_unrounded_uM": iface_uM,
                "cell_center_z71p25um_max_h2o2_uM": round(cc_uM, 4),
                "cell_center_z71p25um_unrounded_uM": cc_uM,
                "passes_2p5uM_tier1_at_z70_interface": bool(iface_uM <= 2.5),
                "passes_5p0uM_tier2_at_z70_interface": bool(iface_uM <= 5.0),
            }
        dual_basis_h2o2[f"basis_{int(basis_ieq)}_ieq_cm2"] = basis_rows

    r_cl_100 = 0.5 * 100.0e-4
    r_cl_80 = 0.5 * 80.0e-4
    n_cl_100 = curative_ieq / (((4.0 / 3.0) * math.pi * (r_cl_100 ** 3)) / VOL_1_IEQ_CM3)
    n_cl_80 = curative_ieq / (((4.0 / 3.0) * math.pi * (r_cl_80 ** 3)) / VOL_1_IEQ_CM3)

    return {
        "contribution_id": "IIP-0025",
        "decision_id": "DEC-104",
        "offgrid_guardrail_id": "OFFGRID_GUARD_010_SPATIAL_MEAN_OXYGEN_MASKING_SINGLE_TIMEPOINT_CATALASE_SIZING_AND_PITCH_HELD_DOSE_HALVING",
        "graveyard_card_id": "GY-020",
        "zero_pre_wetlab_prior_inflation": True,
        "headline_single_design_and_portfolio_odds_unchanged": True,
        "primary_citations": [
            "PMID:21788575",
            "PMID:21693022",
            "PMID:35241836",
            "PMID:38993891",
            "PMID:37476069",
            "PMID:35743287",
            "PMID:27729543",
            "PMID:8720919",
            "PMID:10656833",
            "PMID:22371586",
            "PMID:36971050",
            "PMID:26970510",
            "PMID:29288549",
            "PMID:12702875",
            "PMID:40404627",
            "PMID:19074987",
            "PMID:28489987",
            "PMID:40757665",
            "PMID:35152257",
            "PMID:24065585",
            "PMID:16897713",
            "PMID:37318185",
            "PMID:36707047",
            "PMID:35795779",
            "PMID:38603470",
            "PMID:34480863",
            "PMID:25893782",
            "PMID:31900242",
            "PMID:31177185",
        ],
        "ordered_unit_cell_multimesh_dual_band_gate": {
            "rule_definition": "min over nx in {40, 60, 80} of unrounded dual-band worst-face fv_harmonic_face_min_mmhg >= 15.0 AND min_core_po2_mmhg >= 5.0",
            "conserved_500k_ieq_cluster_count_100um": round(n_cl_100, 2),
            "conserved_500k_ieq_cluster_count_80um": round(n_cl_80, 2),
            "cluster_count_ratio_80_over_100_exact": round(n_cl_80 / n_cl_100, 6),
            "pitch_held_80um_768ieq_dose_reduction_pct": 48.8,
            "nominal_100um_350um_no_film": mm_100_nofilm,
            "layout_a_350um_barrier_100um": mm_100_350bar,
            "expanded_390um_barrier_100um": mm_100_390bar,
            "nominal_80um_350um_no_film": mm_80_nofilm,
            "layout_a_350um_barrier_80um": mm_80_350bar,
            "expanded_390um_barrier_80um": mm_80_390bar,
            "plus10pct_joint_stress_80um_no_film_nx40": uc_80_plus10_nofilm_nx40,
            "plus10pct_joint_stress_80um_layout_a_350um_barrier": mm_80_plus10_350bar,
            "lateral_half_voxel_shift_80um_layout_a_350um_nx40_mmhg": uc_80_350bar_shift_nx40["fv_harmonic_face_min_mmhg"],
            "contrast_b1_paired_effect_390um_primary_nx40_mmhg": round(
                mm_80_390bar["nx40"]["fv_harmonic_face_min_unrounded_mmhg"] - mm_100_390bar["nx40"]["fv_harmonic_face_min_unrounded_mmhg"], 4
            ),
            "contrast_b1_paired_effect_350um_sensitivity_nx40_mmhg": round(
                mm_80_350bar["nx40"]["fv_harmonic_face_min_unrounded_mmhg"] - mm_100_350bar["nx40"]["fv_harmonic_face_min_unrounded_mmhg"], 4
            ),
            "nx60_nz105_boundary_plane_symmetry_diagnostics": {
                "sphere_mask_asymmetry_voxels": mm_80_350bar["nx60"]["sphere_mask_asymmetry_voxels"],
                "lamina_boundary_asymmetry_voxels": mm_80_350bar["nx60"]["lamina_mask_asymmetry_voxels"],
                "film_boundary_asymmetry_voxels": mm_80_350bar["nx60"]["film_mask_asymmetry_voxels"],
                "near_threshold_0p95x_potency_fixed_vascular_symmetric_brackets_mmhg": [
                    sym_095_inc_fv["fv_harmonic_face_min_mmhg"],
                    sym_095_exc_fv["fv_harmonic_face_min_mmhg"],
                ],
                "near_threshold_0p95x_potency_coscaled_symmetric_brackets_mmhg": [
                    sym_095_inc_co["fv_harmonic_face_min_mmhg"],
                    sym_095_exc_co["fv_harmonic_face_min_mmhg"],
                ],
                "near_threshold_straddling_classification": "NUMERICALLY_KNIFE_EDGE_UNRESOLVED",
                "nominal_80um_layout_a_symmetric_brackets_mmhg": [
                    sym_nom80_inc["fv_harmonic_face_min_mmhg"],
                    sym_nom80_exc["fv_harmonic_face_min_mmhg"],
                ],
            },
            "layout_b_119um_lamina_95p5um_band_excluded": layout_b_119um_caught,
            "wigner_seitz_unrounded_0p497_boundary_check": {
                "unrounded_gel_only_120um_core_mmhg": round(float(bvp_0497["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"]), 6),
                "display_rounded_2dec_mmhg": float(bvp_0497["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_mmhg"]),
                "passes_unrounded_0p5mmhg_gate": bool(float(bvp_0497["wigner_seitz_two_zone_fv_gel_only_supply_core_po2_unrounded_mmhg"]) >= 0.5),
            },
        },
        "design_z_and_contrast_b3_unrounded_min_face_audit": {
            "pb30_100um_d_chronic": z_pb30_100,
            "pb30_80um_d_chronic": z_pb30_80,
            "pb30_100um_d_chronic_div3_collagen": z_pb30_100_div3,
            "pfc_5volpct_pb25_100um": z_pfc5_25_100,
            "pfc_5volpct_pb25_80um": z_pfc5_25_80,
            "pfc_5volpct_conditional_20x_solubility_reservoir": {
                "pfc_droplet_volume_cm3_in_4p6667cm3": round(pfc_5pct_vol_cm3, 4),
                "releasable_o2_40_to_15mmhg_umol": round(pfc_5pct_o2_umol, 5),
                "graft_demand_umol_s": round(graft_500k_demand_umol_s, 5),
                "standalone_buffer_seconds": round(pfc_5pct_bridge_s, 3),
            },
            "contrast_b3_donor_iec_omitted_pb30_intact_kperf_0p1358": {
                "100um": b3_pb30_intact_100,
                "80um": b3_pb30_intact_80,
            },
            "contrast_b3_donor_iec_omitted_pb30_halved_kperf_0p0679": {
                "100um": b3_pb30_halved_100,
                "80um": b3_pb30_halved_80,
            },
            "unrounded_bed_po2_cutoffs_mmhg": {
                "mode_a_mixed_100um_d_chronic_48x48x28": round(cut_100_48, 6),
                "mode_a_mixed_100um_d_chronic_72x72x42": round(cut_100_72, 6),
                "mode_a_mixed_80um_d_chronic_48x48x28": round(cut_80_48, 6),
                "mode_a_mixed_80um_d_chronic_72x72x42": round(cut_80_72, 6),
                "mode_a_mixed_100um_d_chronic_div3_collagen_48x48x28": round(cut_100_div3, 4),
                "contrast_b3_intact_kperf_0p1358_100um_48x48x28": round(cut_b3_intact_100, 6),
                "contrast_b3_intact_kperf_0p1358_80um_48x48x28": round(cut_b3_intact_80, 6),
                "contrast_b3_halved_kperf_0p0679_100um_48x48x28": round(cut_b3_halved_100, 6),
                "contrast_b3_halved_kperf_0p0679_80um_48x48x28": round(cut_b3_halved_80, 6),
            },
        },
        "gate_p05_two_timepoint_p04040_and_dual_basis_h2o2_audit": {
            "precure_ceiling_iu_333cm2": precure_cap_iu,
            "assumed_cure_yield": cure_yield_assumed,
            "postcure_t0_at_65pct_yield_under_158300u_cap_iu": postcure_at_cap_iu,
            "conditional_min_yield_pct_if_day14_retention_le_50pct": round(100.0 * (target_336h_iu / 0.50) / precure_cap_iu, 4),
            "conditional_min_yield_pct_if_day14_retention_le_49pct": round(100.0 * (target_336h_iu / 0.49) / precure_cap_iu, 4),
            "min_day14_retention_pct_at_65pct_cure_yield": round(100.0 * target_336h_iu / postcure_at_cap_iu, 4),
            "conditional_yield_qualification_note": (
                "The <93.2407% (<95.1436% at 0.70^2) cure-yield incompatibility with the 158,300 U pre-cure ceiling is "
                "conditional on assuming <=50% (<=49%) Day-14 retention; at 65% cure yield (102,895 IU post-cure), any "
                "formulation achieving >=71.7236% Day-14 retention (for example 80.0% Day-7 and 75.0% Day-14 = 77,171.25 IU) "
                "reconciles both canonical timepoints under the 158,300 U cap, whereas t_1/2 = 168 h (K2, 50.0% Day-7) fails Day 7."
            ),
            "k2_unrounded_total_mass_mg": k2_total_mass_mg,
            "k2_exact_unrounded_endotoxin_cap_eu_per_mg": min(0.10, 0.50 / k2_total_mass_mg),
            "k2_rounded_0p05505_implied_burden_eu_exceeds_0p50": round(0.05505 * k2_total_mass_mg, 7),
            "sizing_scenarios": p05_sizing_scenarios,
            "single_50um_bead_cell_pitch_um": round(side_cm * 1e4, 2),
            "single_50um_bead_lamina_volume_fraction_pct": round(100.0 * v_b / ((side_cm ** 2) * lam_cm), 4),
            "stationary_aged_repeat_burst_dual_basis_h2o2": dual_basis_h2o2,
        },
    }
# === END_IIP_0025_HURDLE4_SPATIAL_OXYGEN_CATALASE_AND_CHALLENGERS ===


# === BEGIN_IIP_0028_MEASURED_POTENCY_DEC084_MIXTURE_AND_GLUCAGON_AUDIT ===
def _betacf_l4_iip_0028(a: float, b: float, x: float) -> float:
    max_it = 300
    eps = 3.0e-15
    fpmin = 1.0e-300
    qab = a + b
    qap = a + 1.0
    qam = a - 1.0
    c = 1.0
    d = 1.0 - qab * x / qap
    if abs(d) < fpmin:
        d = fpmin
    d = 1.0 / d
    h = d
    for m in range(1, max_it + 1):
        m2 = 2 * m
        aa = m * (b - m) * x / ((qam + m2) * (a + m2))
        d = 1.0 + aa * d
        if abs(d) < fpmin:
            d = fpmin
        c = 1.0 + aa / c
        if abs(c) < fpmin:
            c = fpmin
        d = 1.0 / d
        h *= d * c
        aa = -(a + m) * (qab + m) * x / ((a + m2) * (qap + m2))
        d = 1.0 + aa * d
        if abs(d) < fpmin:
            d = fpmin
        c = 1.0 + aa / c
        if abs(c) < fpmin:
            c = fpmin
        d = 1.0 / d
        del_h = d * c
        h *= del_h
        if abs(del_h - 1.0) < eps:
            break
    return h


def _reg_inc_beta_l4_iip_0028(a: float, b: float, x: float) -> float:
    if x <= 0.0:
        return 0.0
    if x >= 1.0:
        return 1.0
    lbeta = math.lgamma(a) + math.lgamma(b) - math.lgamma(a + b)
    bt = math.exp(a * math.log(x) + b * math.log(1.0 - x) - lbeta)
    if x < (a + 1.0) / (a + b + 2.0):
        return bt * _betacf_l4_iip_0028(a, b, x) / a
    return 1.0 - bt * _betacf_l4_iip_0028(b, a, 1.0 - x) / b


def _student_t_ppf_l4_iip_0028(p: float, df: float) -> float:
    lo, hi = -40.0, 40.0
    for _ in range(100):
        mid = 0.5 * (lo + hi)
        if mid == 0.0:
            cdf_v = 0.5
        else:
            xv = df / (df + mid * mid)
            ib = 0.5 * _reg_inc_beta_l4_iip_0028(0.5 * df, 0.5, xv)
            cdf_v = 1.0 - ib if mid > 0.0 else ib
        if cdf_v < p:
            lo = mid
        else:
            hi = mid
    return 0.5 * (lo + hi)


def _one_sided_paired_t_power_l4_iip_0028(effect_over_sd: float, n_blocks: int, alpha: float = 0.05) -> float:
    df = float(n_blocks - 1)
    t_crit = _student_t_ppf_l4_iip_0028(1.0 - alpha, df)
    ncp = effect_over_sd * math.sqrt(float(n_blocks))
    v_max = max(df + 14.0 * math.sqrt(2.0 * df), 80.0)
    n_steps = 800
    h = v_max / n_steps

    def _integrand(v: float) -> float:
        if v <= 0.0:
            return 0.0
        log_f = (0.5 * df - 1.0) * math.log(v) - 0.5 * v - 0.5 * df * math.log(2.0) - math.lgamma(0.5 * df)
        z = t_crit * math.sqrt(v / df) - ncp
        return math.exp(log_f) * 0.5 * math.erfc(z / math.sqrt(2.0))

    acc = _integrand(1e-12) + _integrand(v_max)
    for k_i in range(1, n_steps):
        acc += (4.0 if (k_i % 2 == 1) else 2.0) * _integrand(k_i * h)
    return acc * h / 3.0


def solve_dual_band_unit_cell_iip_0028(
    load_ieq: float,
    diam_um: float,
    buf_um: float = 20.0,
    endo_ocr_mult: float = 1.097,
    vasc_load_equiv_ieq: float | None = None,
    vasc_ocr_mult: float = 1.097,
    standoff_phys_um: float = 15.0,
    pb_mmhg: float = 35.0,
    nx_c: int = 40,
    nz_c: int = 70,
) -> Dict[str, Any]:
    """
    Live 3D FVM dual-band worst-face unit-cell solver evaluating top and bottom harmonic
    interface minima across measured-potency DEC-084 mixture loadings (IIP-0028; DEC-106).
    """
    if vasc_load_equiv_ieq is None:
        vasc_load_equiv_ieq = load_ieq
    slab_um, lam_um = 350.0, 100.0
    p_krogh_chronic = ALPHA_BUNSEN_MOL_CM3_MMHG * 1.50e-5
    p_krogh_islet = ALPHA_BUNSEN_MOL_CM3_MMHG * D_O2_ISLET_TISSUE_CM2_S
    rad_cm = 0.5 * diam_um * 1e-4
    vol_sph = (4.0 / 3.0) * math.pi * (rad_cm ** 3)
    n_face = 0.5 * ((load_ieq * VOL_1_IEQ_CM3) / vol_sph)
    side_cm = math.sqrt(1.0 / n_face)
    hex_pitch_cm = math.sqrt(2.0 / (math.sqrt(3.0) * n_face))
    slab_cm = slab_um * 1e-4
    lam_half_cm = 0.5 * lam_um * 1e-4
    buf_cm = buf_um * 1e-4
    band_inner_z = lam_half_cm + buf_cm
    band_outer_z = 0.5 * slab_cm
    dx_c, dz_c = side_cm / nx_c, slab_cm / nz_c
    xs = (np.arange(nx_c) + 0.5) * dx_c - 0.5 * side_cm
    zs = (np.arange(nz_c) + 0.5) * dz_c - 0.5 * slab_cm
    X, Y, Z = np.meshgrid(xs, xs, zs, indexing="ij")
    z_mid = 0.5 * (band_inner_z + band_outer_z)
    z_c = min(band_outer_z - rad_cm - min(0.0002, 0.5 * (band_outer_z - band_inner_z - 2.0 * rad_cm)), z_mid)
    z_c = max(z_c, band_inner_z + rad_cm)
    ddx = np.minimum(np.abs(X), side_cm - np.abs(X))
    ddy = np.minimum(np.abs(Y), side_cm - np.abs(Y))
    top_sph = (ddx ** 2 + ddy ** 2 + (Z - z_c) ** 2) <= (rad_cm ** 2)
    bot_sph = (ddx ** 2 + ddy ** 2 + (Z + z_c) ** 2) <= (rad_cm ** 2)
    in_sph = top_sph | bot_sph
    in_lam = np.abs(Z) <= lam_half_cm
    in_buf = (np.abs(Z) > lam_half_cm) & (np.abs(Z) <= band_inner_z)
    perm = np.where(in_lam, p_krogh_chronic * (0.42 ** 1.5), p_krogh_chronic)
    perm[in_sph] = p_krogh_islet
    in_gel = (~in_sph) & (~in_lam) & (~in_buf)
    t_phi_endo = (load_ieq * VOL_1_IEQ_CM3) / slab_cm
    t_phi_vasc = (vasc_load_equiv_ieq * VOL_1_IEQ_CM3) / slab_cm
    vmax = np.zeros_like(X)
    vmax[in_sph] = (VMAX_ISLET_PURE_MOL_CM3_S * endo_ocr_mult) * (t_phi_endo / float(np.mean(in_sph)))
    vmax[in_gel] = (t_phi_vasc * VMAX_ISLET_PURE_MOL_CM3_S * 0.15 * vasc_ocr_mult) / float(np.mean(in_gel))
    kp = np.where(in_gel, 0.14 * 0.97, 0.0)
    res_o2 = _solve_3d_oxygen_strict_iip_0019(
        perm, vmax, np.zeros_like(X), kp, dx_c, dx_c, dz_c, pb_mmhg,
        standoff_z_cm=standoff_phys_um * 1e-4, p_ext=p_krogh_chronic / 3.0,
    )
    p3 = res_o2["p_3d"]
    fv_top = _compute_exact_fv_interface_stats_iip_0019(p3, perm, top_sph)
    fv_bot = _compute_exact_fv_interface_stats_iip_0019(p3, perm, bot_sph)
    worst_min_raw = float(min(fv_top["fv_harmonic_face_min_mmhg"], fv_bot["fv_harmonic_face_min_mmhg"]))
    worst_mean_raw = float(min(fv_top["fv_harmonic_face_mean_mmhg"], fv_bot["fv_harmonic_face_mean_mmhg"]))
    core_min_raw = float(np.min(p3[in_sph]))
    return {
        "mesh": f"{nx_c}x{nx_c}x{nz_c}",
        "boundary_po2_mmhg": pb_mmhg,
        "areal_loading_ieq_cm2": round(load_ieq, 4),
        "cluster_diam_um": diam_um,
        "barrier_film_each_um": buf_um,
        "standoff_phys_um": standoff_phys_um,
        "square_pitch_um": round(side_cm * 1e4, 2),
        "hexagonal_pitch_um": round(hex_pitch_cm * 1e4, 2),
        "dual_band_worst_face_min_unrounded_mmhg": worst_min_raw,
        "dual_band_worst_face_min_mmhg": round(worst_min_raw, 4),
        "dual_band_worst_face_mean_mmhg": round(worst_mean_raw, 4),
        "top_band_face_min_mmhg": round(float(fv_top["fv_harmonic_face_min_mmhg"]), 4),
        "bottom_band_face_min_mmhg": round(float(fv_bot["fv_harmonic_face_min_mmhg"]), 4),
        "min_core_po2_unrounded_mmhg": core_min_raw,
        "min_core_po2_mmhg": round(core_min_raw, 4),
        "passes_unrounded_min15_and_core5": bool(worst_min_raw >= 15.0 and core_min_raw >= 5.0),
    }


def simulate_dec084_exercise_ode_sensitivity_iip_0028(
    *,
    v_beta: float = 0.60,
    alpha_flux_ratio_vs_modeA: float = 1.0,
    sst_drive_scale_vs_modeA: float = 1.0,
    local_paracrine_preserved: bool = True,
    t_ins_lag_min: float = 5.17,
) -> Dict[str, Any]:
    """
    Evaluate 0.25-min RK4 24-h exercise ODE sensitivities for DEC-084 mixture glucagon/delta
    coefficients through compute_exact_elapsed_glycemic_metrics_iip_0024 (IIP-0028; DEC-106).
    """
    k05, nh = 7.2, 4.2
    k_ip_clear, k_x_decay = 0.14, 0.035
    local_pf = 1.0 if local_paracrine_preserved else v_beta
    meals = [(60.0, 60.0), (360.0, 60.0), (840.0, 80.0)]
    ex_start, ex_end, ex_int = 448.0, 536.0, 1.51

    def _meal_app(t_m: float) -> float:
        r = 0.0
        for t0, grams in meals:
            if t_m > t0:
                dt = t_m - t0
                r += ((grams * 0.095) / (34.0 * 34.0)) * dt * math.exp(-dt / 34.0)
        return r

    def _sst_occ(s_val: float) -> float:
        sp = max(0.0, s_val)
        return (sp / (1e-4 + sp)) if sp > 0.0 else 0.0

    def _compute_sec_ins(g_val: float, s_val: float, m_val: float) -> float:
        gp = max(0.5, g_val)
        gs = _sst_occ(s_val)
        base_rate = 6.8 - 0.8 * gs
        low_clamp = (1.0 - gs * (1.0 - ((gp / 4.20) ** 8))) if gp < 4.20 else 1.0
        return v_beta * (base_rate * low_clamp + 88.0 * max(0.0, m_val) * low_clamp)

    def _rhs(t: float, y: np.ndarray) -> np.ndarray:
        G, Ip, X, U, S, Gcg, M_sec, I1, I2 = y
        gp = max(0.5, G)
        sp = max(0.0, S)
        gs = _sst_occ(sp)
        g_eff = max(0.0, gp - 3.5)
        k_eff = k05 - 3.5
        hill = (g_eff ** nh) / ((k_eff ** nh) + (g_eff ** nh))
        m_target = hill / (1.0 + 1.50 * sp * gs)
        if m_target < M_sec:
            tau_sst = 1.85 / (1.0 + 0.8 * sp)
            if gp < 4.20:
                tau_sst = tau_sst * ((gp / 4.20) ** 4)
            tau_m = 6.80 * (1.0 - gs) + tau_sst * gs
        else:
            tau_m = 2.00
        dM = (m_target - M_sec) / tau_m
        s_ins = _compute_sec_ins(gp, sp, M_sec)
        tau_tr = 0.5 * t_ins_lag_min
        dI1 = (s_ins - I1) / tau_tr
        dI2 = (I1 - I2) / tau_tr
        dIp = I2 - k_ip_clear * Ip
        dX = k_x_decay * (max(0.0, Ip - 45.0) / 100.0 - X)
        dU = (1.2 * local_pf * M_sec - U) / 2.5
        sst_drive = sst_drive_scale_vs_modeA * local_pf * (0.65 * U + 0.45 * ((gp ** 4) / (5.8 ** 4 + gp ** 4)))
        dS = (sst_drive - S) / 1.5
        low_g_drive = 1.0 / (1.0 + ((gp / 4.45) ** 6))
        ins_eff_block = Ip * (1.0 - gs * (1.0 - ((gp / 4.20) ** 8))) if gp < 4.20 else Ip
        ins_block = 0.018 * max(0.0, ins_eff_block - 52.0)
        gcg_sec = 11.4 + (56.0 * alpha_flux_ratio_vs_modeA * v_beta) * low_g_drive / (1.0 + ins_block + 0.35 * sp)
        dGcg = gcg_sec - 0.20 * Gcg
        ex = ex_int if ex_start <= t <= ex_end else 0.0
        b_tone = min(1.0, (max(0.0, Ip) / 25.0) ** 2)
        egp = max(0.010, 0.056 * (1.0 + 0.018 * (Gcg - 58.0)) / (1.0 + 0.26 * max(0.0, X)) + 0.068 * (1.0 - b_tone))
        up_ind = 0.032 * (gp / (1.2 + gp)) * (1.0 + 0.48 * ex)
        up_ins = (0.0052 * b_tone + 0.0135 * max(0.0, X)) * gp * (1.0 + 1.55 * ex)
        renal = 0.0065 * max(0.0, gp - 10.0)
        dG = egp + _meal_app(t) - up_ind - up_ins - renal
        return np.array([dG, dIp, dX, dU, dS, dGcg, dM, dI1, dI2])

    _rhs.integration_breakpoints = (ex_start, ex_end)  # type: ignore[attr-defined]
    s0 = 0.12 * local_pf * sst_drive_scale_vs_modeA
    g0 = 5.1
    s_ins0 = _compute_sec_ins(g0, s0, 0.08 * local_pf)
    y0 = np.array([g0, 48.0 * v_beta, 0.03 * v_beta, 0.08 * local_pf, s0, 60.0, 0.08 * local_pf, s_ins0, s_ins0], dtype=np.float64)
    t_grid = np.linspace(0.0, 1440.0, 5761)
    sol = rk4_integrate(_rhs, (0.0, 1440.0), y0, t_grid, dt_max=0.25)
    g_025, s_025 = sol[0], sol[4]
    elapsed = compute_exact_elapsed_glycemic_metrics_iip_0024(
        [float(tv) for tv in t_grid],
        [float(gv) for gv in g_025],
    )
    min_s = float(np.min(s_025))
    min_sst_occ = min_s / (1e-4 + min_s)
    nadir_mm = float(np.min(g_025))
    tbr_el = float(elapsed["tbr39_elapsed_unrounded_pct"])
    tir_el = float(elapsed["tir_elapsed_unrounded_pct"])
    tbr30_el = float(elapsed["tbr30_elapsed_unrounded_pct"])
    return {
        "min_glucose_0p25min_mM": round(nadir_mm, 6),
        "tir_3p9_to_10_elapsed_pct": round(tir_el, 4),
        "tbr_below_3p9_elapsed_pct": round(tbr_el, 4),
        "tbr_below_3p0_elapsed_pct": round(tbr30_el, 4),
        "passes_layer4_model_gate": bool(tir_el >= 85.0 and tbr_el < 4.0 and tbr30_el == 0.0 and nadir_mm >= 3.5),
        "tir_3p9_to_10_node_count_pct": round(100.0 * float(np.mean((g_025 >= 3.9) & (g_025 <= 10.0))), 4),
        "tbr_below_3p9_node_count_pct": round(100.0 * float(np.mean(g_025 < 3.9)), 4),
        "min_sst_receptor_occupancy": round(min_sst_occ, 6),
    }


def build_measured_potency_dec084_mixture_and_glucagon_audit_iip_0028() -> Dict[str, Any]:
    """
    Build reproducible measured-potency equal-output DEC-084 mixture (70:20:10 / 70:25:5 vs 60:30:10)
    loading, whole-graft OCR algebra, 40x40x70 & 60x60x105 dual-band worst-face 3D oxygen solves
    (including matched +10%-stress 100 um baselines and P_b = 34 mmHg sensitivity), linear-crossing
    elapsed TBR + glucagon/SST sensitivities, 4/7 & 5/7 alpha-cell stoichiometry note, and n = 8
    confirmation power profile (IIP-0028; DEC-106).
    """
    endo_ratio_1p00 = 6.0 / 7.0
    load_1p00 = 1500.0 * endo_ratio_1p00  # 1,285.7143 IEQ/cm^2
    load_0p95 = 1500.0 * endo_ratio_1p00 / 0.95  # 1,353.3835 IEQ/cm^2
    load_0p90 = 1500.0 * endo_ratio_1p00 / 0.90  # 1,428.5714 IEQ/cm^2

    ocr_fix_1p00 = (endo_ratio_1p00 + 0.15) / 1.15  # 141/161 = 0.875776
    ocr_cos_1p00 = endo_ratio_1p00  # 6/7 = 0.857143
    ocr_fix_0p95 = ((endo_ratio_1p00 / 0.95) + 0.15) / 1.15  # 0.915005 -> 0.91500
    ocr_cos_0p95 = endo_ratio_1p00 / 0.95  # 0.902256 -> 0.90226
    ocr_fix_0p90 = ((endo_ratio_1p00 / 0.90) + 0.15) / 1.15  # 463/483 = 0.958592
    ocr_cos_0p90 = endo_ratio_1p00 / 0.90  # 20/21 = 0.952381

    r_star_fix_015d = ((10.0 / 7.0) / 1.15 - 0.40) / 0.60  # 226/161 = 1.403727
    r_star_fix_abs = ((10.0 / 7.0) - 0.55) / 0.60  # 41/28 = 1.464286
    r_star_endo_only = ((10.0 / 7.0) - 0.40) / 0.60  # 12/7 = 1.714286
    r_star_cos_015d = ((200.0 / 131.0) - 0.40) / 0.60  # 246/131 = 1.877863

    stress_ocr = 1.097 * 1.10
    fvm_cases = [
        ("modeA_100um_350barrier_nominal_pb35", 1500.0, 100.0, 20.0, 1.097, 1500.0, 1.097, 15.0, 35.0),
        ("modeB_1p00_100um_350barrier_nominal_fixedV_pb35", load_1p00, 100.0, 20.0, 1.097, 1500.0, 1.097, 15.0, 35.0),
        ("modeB_1p00_100um_350barrier_nominal_coscV_pb35", load_1p00, 100.0, 20.0, 1.097, load_1p00, 1.097, 15.0, 35.0),
        ("modeA_100um_350barrier_plus10stress_pb35", 1500.0, 100.0, 20.0, stress_ocr, 1500.0, stress_ocr, 16.5, 35.0),
        ("modeB_1p00_100um_350barrier_plus10stress_fixedV_pb35", load_1p00, 100.0, 20.0, stress_ocr, 1500.0, stress_ocr, 16.5, 35.0),
        ("modeB_1p00_100um_350barrier_plus10stress_coscV_pb35", load_1p00, 100.0, 20.0, stress_ocr, load_1p00, stress_ocr, 16.5, 35.0),
        ("modeA_80um_350barrier_plus10stress_pb35", 1500.0, 80.0, 20.0, stress_ocr, 1500.0, stress_ocr, 16.5, 35.0),
        ("modeB_1p00_80um_350barrier_plus10stress_fixedV_pb35", load_1p00, 80.0, 20.0, stress_ocr, 1500.0, stress_ocr, 16.5, 35.0),
        ("modeB_1p00_80um_350barrier_plus10stress_coscV_pb35", load_1p00, 80.0, 20.0, stress_ocr, load_1p00, stress_ocr, 16.5, 35.0),
        ("modeB_0p95_80um_350barrier_plus10stress_fixedV_pb35", load_0p95, 80.0, 20.0, stress_ocr, 1500.0, stress_ocr, 16.5, 35.0),
        ("modeB_0p95_80um_350barrier_plus10stress_coscV_pb35", load_0p95, 80.0, 20.0, stress_ocr, load_0p95, stress_ocr, 16.5, 35.0),
        ("modeB_0p90_80um_350barrier_plus10stress_fixedV_pb35", load_0p90, 80.0, 20.0, stress_ocr, 1500.0, stress_ocr, 16.5, 35.0),
        ("modeB_0p90_80um_350barrier_plus10stress_coscV_pb35", load_0p90, 80.0, 20.0, stress_ocr, load_0p90, stress_ocr, 16.5, 35.0),
        ("modeB_1p00_80um_350barrier_plus10stress_fixedV_pb34", load_1p00, 80.0, 20.0, stress_ocr, 1500.0, stress_ocr, 16.5, 34.0),
        ("modeB_1p00_80um_350barrier_plus10stress_coscV_pb34", load_1p00, 80.0, 20.0, stress_ocr, load_1p00, stress_ocr, 16.5, 34.0),
    ]
    fvm_nx40 = {
        cid: solve_dual_band_unit_cell_iip_0028(ld, dm, bf, eo, vl, vo, st, pb_mmhg=pb, nx_c=40, nz_c=70)
        for cid, ld, dm, bf, eo, vl, vo, st, pb in fvm_cases
    }
    fvm_nx60 = {
        cid: solve_dual_band_unit_cell_iip_0028(ld, dm, bf, eo, vl, vo, st, pb_mmhg=pb, nx_c=60, nz_c=105)
        for cid, ld, dm, bf, eo, vl, vo, st, pb in fvm_cases
    }

    ode_cases = {
        "reference_60_30_10_preserved_paracrine": simulate_dec084_exercise_ode_sensitivity_iip_0028(
            alpha_flux_ratio_vs_modeA=1.0, sst_drive_scale_vs_modeA=1.0, local_paracrine_preserved=True
        ),
        "gate_floor_gcg_0p85_70_20_10_sst_1p0": simulate_dec084_exercise_ode_sensitivity_iip_0028(
            alpha_flux_ratio_vs_modeA=0.85, sst_drive_scale_vs_modeA=1.0, local_paracrine_preserved=True
        ),
        "gate_floor_gcg_0p85_70_20_10_sst_6over7": simulate_dec084_exercise_ode_sensitivity_iip_0028(
            alpha_flux_ratio_vs_modeA=0.85, sst_drive_scale_vs_modeA=6.0 / 7.0, local_paracrine_preserved=True
        ),
        "gate_floor_gcg_0p85_70_25_5_sst_0p50": simulate_dec084_exercise_ode_sensitivity_iip_0028(
            alpha_flux_ratio_vs_modeA=0.85, sst_drive_scale_vs_modeA=0.50, local_paracrine_preserved=True
        ),
        "gate_floor_gcg_0p85_70_25_5_sst_3over7": simulate_dec084_exercise_ode_sensitivity_iip_0028(
            alpha_flux_ratio_vs_modeA=0.85, sst_drive_scale_vs_modeA=3.0 / 7.0, local_paracrine_preserved=True
        ),
        "compensated_gcg_0p95_sst_1p0": simulate_dec084_exercise_ode_sensitivity_iip_0028(
            alpha_flux_ratio_vs_modeA=0.95, sst_drive_scale_vs_modeA=1.0, local_paracrine_preserved=True
        ),
        "compensated_gcg_0p95_half_sst_0p50": simulate_dec084_exercise_ode_sensitivity_iip_0028(
            alpha_flux_ratio_vs_modeA=0.95, sst_drive_scale_vs_modeA=0.50, local_paracrine_preserved=True
        ),
        "uncompensated_alpha_count_4over7_70_20_10": simulate_dec084_exercise_ode_sensitivity_iip_0028(
            alpha_flux_ratio_vs_modeA=4.0 / 7.0, sst_drive_scale_vs_modeA=6.0 / 7.0, local_paracrine_preserved=True
        ),
        "uncompensated_alpha_count_5over7_70_25_5": simulate_dec084_exercise_ode_sensitivity_iip_0028(
            alpha_flux_ratio_vs_modeA=5.0 / 7.0, sst_drive_scale_vs_modeA=3.0 / 7.0, local_paracrine_preserved=True
        ),
    }

    t_5761 = [0.25 * i for i in range(5761)]
    b231_4p22 = compute_exact_elapsed_glycemic_metrics_iip_0024(
        t_5761, [4.22] * 1000 + [3.60] * 231 + [4.22] * (5761 - 1231)
    )
    b231_5p00 = compute_exact_elapsed_glycemic_metrics_iip_0024(
        t_5761, [5.00] * 1000 + [3.60] * 231 + [5.00] * (5761 - 1231)
    )

    pwr_022 = round(_one_sided_paired_t_power_l4_iip_0028((math.log(0.90) - math.log(ocr_fix_1p00)) / 0.022, 8), 4)
    pwr_035 = round(_one_sided_paired_t_power_l4_iip_0028((math.log(0.90) - math.log(ocr_fix_1p00)) / 0.035, 8), 4)
    pwr_050 = round(_one_sided_paired_t_power_l4_iip_0028((math.log(0.90) - math.log(ocr_fix_1p00)) / 0.050, 8), 4)

    return {
        "contribution_id": "IIP-0028",
        "decision_id": "DEC-106",
        "graveyard_card_id": "GY-023",
        "headline_single_design_and_portfolio_odds_unchanged": True,
        "measured_potency_loading_and_ocr": {
            "loading_formula": "(6/7) * (output_per_beta_A / output_per_beta_B) * 1500.0 IEQ/cm^2",
            "measured_composition_and_dose_response_qualification_note": (
                "The nominal 6/7 factor holds only when achieved post-aggregation beta fractions match 70% vs 60% at "
                "equal viable endocrine cells per IEQ and linear output scaling; Stage-0 advancement requires measured "
                "starting beta/alpha/delta fractions, viable cell counts, propagated potency uncertainty, and fresh-lot "
                "equal-output verification across n = 8 confirmation blocks disjoint from n >= 3 fixed-input selection blocks."
            ),
            "alpha_cell_stoichiometry_note": {
                "m1_70_20_10_vs_60_30_10_alpha_count_ratio_at_equal_beta_dose": round(4.0 / 7.0, 6),
                "m1_70_20_10_alpha_fraction_label": "4/7 (57.14% of reference alpha-cell count)",
                "m2_70_25_5_vs_60_30_10_alpha_count_ratio_at_equal_beta_dose": round(5.0 / 7.0, 6),
                "m2_70_25_5_alpha_fraction_label": "5/7 (71.43% of reference alpha-cell count)",
                "implication": "Retained insulin output at 1,285.71 IEQ/cm^2 can coexist with materially lower alpha-cell count, requiring empirical L95_t(GCG_AUC_B/A) >= 0.85, absolute low-glucose glucagon output, and Readout 2 >= 2.0x fold gates.",
            },
            "potency_1p00_areal_loading_ieq_cm2": round(load_1p00, 4),
            "potency_0p95_areal_loading_ieq_cm2": round(load_0p95, 4),
            "potency_0p90_areal_loading_ieq_cm2": round(load_0p90, 4),
            "ocr_ratio_1p00_fixed_vs_coscaled": [round(ocr_fix_1p00, 6), round(ocr_cos_1p00, 6)],
            "ocr_ratio_0p95_fixed_vs_coscaled": [round(ocr_fix_0p95, 6), round(ocr_cos_0p95, 6)],
            "ocr_ratio_0p95_rounded_5dec": [round(ocr_fix_0p95, 5), round(ocr_cos_0p95, 5)],
            "ocr_ratio_0p90_fixed_vs_coscaled": [round(ocr_fix_0p90, 6), round(ocr_cos_0p90, 6)],
            "point_threshold_0p90_respiration_ratio_crossings_r_star": {
                "fixed_vascular_0p15D_226_over_161": round(r_star_fix_015d, 6),
                "fixed_vascular_absolute_41_over_28": round(r_star_fix_abs, 6),
                "endocrine_only_12_over_7": round(r_star_endo_only, 6),
                "whole_graft_coscaled_0p15D_246_over_131": round(r_star_cos_015d, 6),
            },
        },
        "dual_band_worst_face_3d_fvm_oxygen_sweep": {
            "stress_definition": "Joint +10% intrinsic OCR (1.097 * 1.10) and +10% physical vessel standoff (16.5 um vs 15.0 um nominal) on 350-um slab with 100-um central lamina and 2 x 20-um catalase barrier films",
            "nx40_nz70": fvm_nx40,
            "nx60_nz105": fvm_nx60,
            "matched_plus10_stress_100um_summary_mmhg": {
                "modeA_1500_nx40_nx60": [
                    fvm_nx40["modeA_100um_350barrier_plus10stress_pb35"]["dual_band_worst_face_min_mmhg"],
                    fvm_nx60["modeA_100um_350barrier_plus10stress_pb35"]["dual_band_worst_face_min_mmhg"],
                ],
                "modeB_1p00_fixed_vascular_nx40_nx60": [
                    fvm_nx40["modeB_1p00_100um_350barrier_plus10stress_fixedV_pb35"]["dual_band_worst_face_min_mmhg"],
                    fvm_nx60["modeB_1p00_100um_350barrier_plus10stress_fixedV_pb35"]["dual_band_worst_face_min_mmhg"],
                ],
                "modeB_1p00_coscaled_nx40_nx60": [
                    fvm_nx40["modeB_1p00_100um_350barrier_plus10stress_coscV_pb35"]["dual_band_worst_face_min_mmhg"],
                    fvm_nx60["modeB_1p00_100um_350barrier_plus10stress_coscV_pb35"]["dual_band_worst_face_min_mmhg"],
                ],
            },
            "boundary_po2_34mmhg_narrow_margin_80um_plus10_stress_mmhg": {
                "fixed_vascular_1p00_nx40_nx60": [
                    fvm_nx40["modeB_1p00_80um_350barrier_plus10stress_fixedV_pb34"]["dual_band_worst_face_min_mmhg"],
                    fvm_nx60["modeB_1p00_80um_350barrier_plus10stress_fixedV_pb34"]["dual_band_worst_face_min_mmhg"],
                ],
                "coscaled_1p00_nx40_nx60": [
                    fvm_nx40["modeB_1p00_80um_350barrier_plus10stress_coscV_pb34"]["dual_band_worst_face_min_mmhg"],
                    fvm_nx60["modeB_1p00_80um_350barrier_plus10stress_coscV_pb34"]["dual_band_worst_face_min_mmhg"],
                ],
                "passes_15mmhg_floor_at_34mmhg_fixed_vascular": False,
            },
        },
        "rk4_24h_exercise_ode_elapsed_tbr_and_glucagon_sensitivities": ode_cases,
        "boundary_231_reading_3p60mM_elapsed_tbr_checks": {
            "background_4p22mM_elapsed_tbr_pct": round(float(b231_4p22["tbr39_elapsed_unrounded_pct"]), 6),
            "background_5p00mM_elapsed_tbr_pct": round(float(b231_5p00["tbr39_elapsed_unrounded_pct"]), 6),
            "both_exceed_4pct_tbr_cap": bool(
                float(b231_4p22["tbr39_elapsed_unrounded_pct"]) >= 4.0 and float(b231_5p00["tbr39_elapsed_unrounded_pct"]) >= 4.0
            ),
        },
        "n8_confirmation_single_endpoint_fixed_vascular_ocr_power": {
            "paired_log_sd_0p022": pwr_022,
            "paired_log_sd_0p035": pwr_035,
            "paired_log_sd_0p050": pwr_050,
            "scope_note": "Single-endpoint one-sided paired-t OCR power at alpha = 0.05 across n = 8 independent blocks; distinct from joint multi-endpoint advancement power",
        },
        "primary_citations": [
            "PMID:39169271",
            "PMID:40782792",
            "PMID:31068696",
            "PMID:8971076",
            "PMID:30830873",
            "PMID:26076035",
            "PMID:40404627",
            "PMID:37188763",
            "PMID:35241836",
            "PMID:31177185",
        ],
    }
# === END_IIP_0028_MEASURED_POTENCY_DEC084_MIXTURE_AND_GLUCAGON_AUDIT ===


# === BEGIN_IIP_0029_EXPLORATORY_MODE_B_V2_GRANULE_STORE_SENSITIVITY ===
ALPHA_SYS_INSULIN_IU_PER_PM_IIP0029 = 1.0 / 600.0


def _trapezoid_iip0029(y: np.ndarray, x: np.ndarray) -> float:
    if hasattr(np, "trapezoid"):
        return float(np.trapezoid(y, x=x))
    return float(np.trapz(y, x=x))


def _smoothstep01_iip0029(u: float) -> float:
    x = min(1.0, max(0.0, float(u)))
    return x * x * (3.0 - 2.0 * x)


class ModeBV2GranuleStoreParams:
    """
    Physiological parameter bundle for the strictly opt-in exploratory conserved two-pool
    (RRP Q_P + Reserve Q_R) Mode B v2 sensitivity comparator (IIP-0029; DEC-108).
    Enforces strict finite non-bool physical bounds (0 < f_rrp < 1, tau_chamber == 0 or >= 0.01 min,
    0 <= f_hepatic < 0.90) and scales intracellular inventory linearly with beta-cell equivalents
    (beta_cell_fraction / 0.60) * (implanted_total_ieq / 500,000).
    """

    def __init__(
        self,
        c0_ref_iu_at_300k_beta_eeq: float = 89.9,
        beta_cell_fraction: float = 0.60,
        implanted_total_ieq: float = 500_000.0,
        f_hepatic: float = 0.50,
        f_rrp: float = 0.0045,
        tau_refill_min: float = 16.5,
        gamma_amp: float = 0.08,
        g_pot: float = 0.0,
        tau_pot_min: float = 35.0,
        tau_biosyn_min: float = 180.0,
        enable_biosyn: bool = True,
        basal_leak_multiplier: float = 1.0,
        tau_chamber_min: float = 0.35,
    ) -> None:
        checked = {}
        for nm, val in (
            ("c0_ref_iu_at_300k_beta_eeq", c0_ref_iu_at_300k_beta_eeq),
            ("beta_cell_fraction", beta_cell_fraction),
            ("implanted_total_ieq", implanted_total_ieq),
            ("f_hepatic", f_hepatic),
            ("f_rrp", f_rrp),
            ("tau_refill_min", tau_refill_min),
            ("gamma_amp", gamma_amp),
            ("g_pot", g_pot),
            ("tau_pot_min", tau_pot_min),
            ("tau_biosyn_min", tau_biosyn_min),
            ("basal_leak_multiplier", basal_leak_multiplier),
            ("tau_chamber_min", tau_chamber_min),
        ):
            checked[nm] = _strict_numeric_float_iip0024(val, nm)
        if not isinstance(enable_biosyn, bool):
            raise ValueError("enable_biosyn must be a strict bool (IIP-0029; DEC-108)")
        if not (0.0 <= checked["f_hepatic"] < 0.90):
            raise ValueError("f_hepatic must lie in [0.0, 0.90) (IIP-0029; DEC-108)")
        if not (0.0 < checked["beta_cell_fraction"] <= 1.0):
            raise ValueError("beta_cell_fraction must lie in (0.0, 1.0] (IIP-0029; DEC-108)")
        if checked["implanted_total_ieq"] <= 0.0 or checked["c0_ref_iu_at_300k_beta_eeq"] <= 0.0:
            raise ValueError("implanted_total_ieq and c0_ref_iu_at_300k_beta_eeq must be > 0 (IIP-0029; DEC-108)")
        if not (0.0 < checked["f_rrp"] < 1.0):
            raise ValueError("f_rrp must lie strictly inside (0.0, 1.0) so Q_R0 > 0 (IIP-0029; DEC-108)")
        if checked["tau_refill_min"] <= 0.0 or checked["tau_pot_min"] <= 0.0 or checked["tau_biosyn_min"] <= 0.0:
            raise ValueError("tau_refill_min, tau_pot_min, and tau_biosyn_min must be > 0 (IIP-0029; DEC-108)")
        if checked["basal_leak_multiplier"] < 0.0 or checked["gamma_amp"] < 0.0 or checked["g_pot"] < 0.0:
            raise ValueError("basal_leak_multiplier, gamma_amp, and g_pot must be >= 0 (IIP-0029; DEC-108)")
        tc = checked["tau_chamber_min"]
        if tc < 0.0 or (0.0 < tc < 0.01):
            raise ValueError("tau_chamber_min must be 0.0 (ideal cellular limit) or >= 0.01 min (IIP-0029; DEC-108)")

        self.c0_ref_iu_at_300k_beta_eeq = checked["c0_ref_iu_at_300k_beta_eeq"]
        self.beta_cell_fraction = checked["beta_cell_fraction"]
        self.implanted_total_ieq = checked["implanted_total_ieq"]
        self.f_hepatic = checked["f_hepatic"]
        self.f_rrp = checked["f_rrp"]
        self.tau_refill_min = checked["tau_refill_min"]
        self.gamma_amp = checked["gamma_amp"]
        self.g_pot = checked["g_pot"]
        self.tau_pot_min = checked["tau_pot_min"]
        self.tau_biosyn_min = checked["tau_biosyn_min"]
        self.enable_biosyn = enable_biosyn
        self.basal_leak_multiplier = checked["basal_leak_multiplier"]
        self.tau_chamber_min = tc

    @property
    def beta_eeq_count(self) -> float:
        return self.implanted_total_ieq * self.beta_cell_fraction

    @property
    def beta_scale_vs_300k_ref(self) -> float:
        return self.beta_eeq_count / 300_000.0

    @property
    def total_store_c0_iu(self) -> float:
        return self.c0_ref_iu_at_300k_beta_eeq * self.beta_scale_vs_300k_ref


def build_mode_b_v2_granule_store_system_iip_0029(
    params: ModeBV2GranuleStoreParams,
    assay_context: str = "in_vivo_metabolic_twin",
    viable_endocrine_fraction_override: float | None = None,
    local_paracrine_preserved_systemic_scale: bool = False,
    extravascular_insulin_lag_total_min: float = 0.0,
    low_glucose_challenge_mode: bool = False,
    meals_override: List[tuple[float, float]] | None = None,
) -> Dict[str, Any]:
    """
    Construct the conserved two-pool (Q_P + Q_R) Mode B v2 ODE system with uncapped stiffness-rate
    bounds covering RRP exocytosis, chamber mixing (1/tau_chamber), and extravascular lag (2/tau_vasc).
    First-pass hepatic extraction f_hepatic is owned solely by Mode B v2 to debit total pre-hepatic
    secretion from intracellular stores while delivering (1 - f_hepatic) systemically, remaining
    strictly distinct from Layer 4's 13-state f_sys_ins insulin-action scaling.
    """
    if not isinstance(params, ModeBV2GranuleStoreParams):
        raise ValueError("params must be a ModeBV2GranuleStoreParams instance (IIP-0029; DEC-108)")
    if assay_context not in ("in_vivo_metabolic_twin", "in_vitro_perifusion"):
        raise ValueError(f"Unknown assay_context: {assay_context!r} (IIP-0029; DEC-108)")
    lag_f = _strict_numeric_float_iip0024(extravascular_insulin_lag_total_min, "extravascular_insulin_lag_total_min")
    if lag_f < 0.0 or (0.0 < lag_f < 0.05):
        raise ValueError("extravascular_insulin_lag_total_min must be 0.0 or >= 0.05 min (IIP-0029; DEC-108)")

    is_invivo = assay_context == "in_vivo_metabolic_twin"
    if viable_endocrine_fraction_override is not None:
        v = _strict_numeric_float_iip0024(viable_endocrine_fraction_override, "viable_endocrine_fraction_override")
        if v <= 0.0:
            raise ValueError("viable_endocrine_fraction_override must be > 0 (IIP-0029; DEC-108)")
        c0_iu = params.c0_ref_iu_at_300k_beta_eeq * (v / 0.60)
    else:
        v = 0.60 * params.beta_scale_vs_300k_ref
        c0_iu = params.total_store_c0_iu

    f_hep_eff = params.f_hepatic if is_invivo else 0.0
    alpha_prehep_iu_per_pm = ALPHA_SYS_INSULIN_IU_PER_PM_IIP0029 / (1.0 - f_hep_eff)

    loc_f = 1.0 if (local_paracrine_preserved_systemic_scale or not is_invivo) else v
    k05 = 7.2
    nh = 4.2
    k_ip_clear = 0.14
    k_x_decay = 0.035

    qp0 = params.f_rrp * c0_iu
    qr0 = (1.0 - params.f_rrp) * c0_iu

    if meals_override is not None:
        meals_sched = list(meals_override)
    elif low_glucose_challenge_mode:
        meals_sched = [(60.0, 60.0), (360.0, 60.0), (840.0, 80.0)]
    else:
        meals_sched = [(60.0, 75.0), (360.0, 85.0), (780.0, 90.0)]

    ex_start = 448.0 if low_glucose_challenge_mode else 600.0
    ex_end = 536.0 if low_glucose_challenge_mode else 660.0
    ex_int = 1.51 if low_glucose_challenge_mode else 1.0

    def meal_app(t_min: float) -> float:
        r_m = 0.0
        tau_m = 34.0
        for t0, grams in meals_sched:
            if t_min > t0:
                dt = t_min - t0
                amp = (grams * 0.095) / (tau_m * tau_m)
                r_m += amp * dt * math.exp(-dt / tau_m)
        return r_m

    def sst_occ(s_val: float) -> float:
        sp = max(0.0, s_val)
        return (sp / (1e-4 + sp)) if sp > 0.0 else 0.0

    def fluxes(g_val: float, s_val: float, m_val: float, qp_val: float, qr_val: float, a_pot_val: float) -> Dict[str, float]:
        gp = max(0.5, g_val)
        sp = max(0.0, s_val)
        gs = sst_occ(sp)
        base_rate = 6.8 - 0.8 * gs

        if is_invivo and gp < 4.20:
            clamp_raw = (gp / 4.20) ** 8
            low_g_clamp = 1.0 - gs * (1.0 - clamp_raw)
        else:
            low_g_clamp = 0.85 + 0.15 * _smoothstep01_iip0029((gp - 2.0) / 2.2)

        p_norm = max(0.0, qp_val) / max(1e-15, qp0)
        r_norm = max(0.0, qr_val) / max(1e-15, qr0)
        r_avail_gate = _smoothstep01_iip0029(r_norm / 0.05) if r_norm > 0.0 else 0.0

        unclamped_autonomous_leak = max(0.0, params.basal_leak_multiplier - 1.0)
        j_basal_sys_pm = v * base_rate * (low_g_clamp * min(1.0, params.basal_leak_multiplier) + unclamped_autonomous_leak) * r_avail_gate
        j_exo_sys_pm = v * 88.0 * max(0.0, m_val) * (low_g_clamp if is_invivo else 1.0) * p_norm
        sec_ins_sys_pm = j_basal_sys_pm + j_exo_sys_pm

        j_basal_iu = alpha_prehep_iu_per_pm * j_basal_sys_pm
        j_exo_iu = alpha_prehep_iu_per_pm * j_exo_sys_pm

        g_eff = max(0.0, gp - 3.5)
        k_eff = k05 - 3.5
        phi_glc = (g_eff ** nh) / ((k_eff ** nh) + (g_eff ** nh))

        p_cap = 1.0 + max(0.0, a_pot_val)
        refill_deficit = max(0.0, p_cap - p_norm)
        j_refill_iu = (qp0 / params.tau_refill_min) * r_norm * (1.0 + params.gamma_amp * phi_glc) * refill_deficit

        if params.enable_biosyn:
            phi_maint = _smoothstep01_iip0029((gp - 2.0) / 0.8)
            cap_gate = 1.0 - _smoothstep01_iip0029((qr_val - qr0) / max(1e-15, 1e-4 * qr0)) if qr_val > qr0 else 1.0
            g_trans = max(0.0, gp - 2.5)
            phi_trans = (g_trans ** 4) / ((3.0 ** 4) + (g_trans ** 4))
            j_biosyn_iu = phi_maint * cap_gate * j_basal_iu + phi_trans * max(0.0, qr0 - qr_val) / params.tau_biosyn_min
        else:
            j_biosyn_iu = 0.0

        return {
            "sec_ins_sys_pm": sec_ins_sys_pm,
            "j_sys_iu": ALPHA_SYS_INSULIN_IU_PER_PM_IIP0029 * sec_ins_sys_pm,
            "j_basal_iu": j_basal_iu,
            "j_exo_iu": j_exo_iu,
            "j_sec_prehep_iu": j_basal_iu + j_exo_iu,
            "j_refill_iu": j_refill_iu,
            "j_biosyn_iu": j_biosyn_iu,
            "phi_glc": phi_glc,
        }

    has_lag = is_invivo and (lag_f > 0.0)

    def rhs(t: float, y: np.ndarray) -> np.ndarray:
        if has_lag:
            G, Ip, X, U, S, Gcg, M_sec, Q_P, Q_R, A_pot, CumPre, CumBio, CumSys, I1, I2 = y
        else:
            G, Ip, X, U, S, Gcg, M_sec, Q_P, Q_R, A_pot, CumPre, CumBio, CumSys = y

        gp = max(0.5, G)
        sp = max(0.0, S)
        gs = sst_occ(sp)
        flx = fluxes(gp, sp, M_sec, Q_P, Q_R, A_pot)
        phi_glc = flx["phi_glc"]
        sst_inhib = 1.0 / (1.0 + 1.50 * sp * gs)
        m_target = phi_glc * sst_inhib

        if m_target < M_sec:
            if is_invivo:
                tau_sst = 1.85 / (1.0 + 0.8 * sp)
                if gp < 4.20:
                    tau_sst = tau_sst * ((gp / 4.20) ** 4)
            else:
                tau_sst = 0.85 / (1.0 + 0.6 * sp)
            tau_m = 6.80 * (1.0 - gs) + tau_sst * gs
        else:
            tau_m = 2.00 if is_invivo else 1.35
        dM_dt = (m_target - M_sec) / tau_m

        sec_sys = flx["sec_ins_sys_pm"]
        if has_lag:
            tau_tr = 0.5 * lag_f
            dI1_dt = (sec_sys - I1) / tau_tr
            dI2_dt = (I1 - I2) / tau_tr
            dIp_dt = I2 - k_ip_clear * Ip
        else:
            dIp_dt = sec_sys - k_ip_clear * Ip

        dX_dt = k_x_decay * (max(0.0, Ip - 45.0) / 100.0 - X)
        dU_dt = (1.2 * loc_f * M_sec - U) / 2.5
        sst_drive = loc_f * (0.65 * U + 0.45 * ((gp ** 4) / (5.8 ** 4 + gp ** 4)))
        dS_dt = (sst_drive - S) / 1.5

        low_g_drive = 1.0 / (1.0 + ((gp / 4.45) ** 6))
        ins_eff_block = Ip * (1.0 - gs * (1.0 - ((gp / 4.20) ** 8))) if (is_invivo and gp < 4.20) else Ip
        ins_paracrine_block = 0.018 * max(0.0, ins_eff_block - 52.0)
        gcg_sec = 11.4 + (56.0 * v) * low_g_drive / (1.0 + ins_paracrine_block + 0.35 * sp)
        dGcg_dt = gcg_sec - 0.20 * Gcg

        if is_invivo:
            ex = ex_int if ex_start <= t <= ex_end else 0.0
            basal_ins_tone = min(1.0, (max(0.0, Ip) / 25.0) ** 2)
            egp_base = 0.056 * (1.0 + 0.018 * (Gcg - 58.0)) / (1.0 + 0.26 * max(0.0, X))
            egp_t1d = 0.068 * (1.0 - basal_ins_tone)
            egp = max(0.010, egp_base + egp_t1d)
            uptake_indep = 0.032 * (gp / (1.2 + gp)) * (1.0 + 0.48 * ex)
            uptake_ins = (0.0052 * basal_ins_tone + 0.0135 * max(0.0, X)) * gp * (1.0 + 1.55 * ex)
            renal = 0.0065 * max(0.0, gp - 10.0)
            dG_dt = egp + meal_app(t) - uptake_indep - uptake_ins - renal
        else:
            dG_dt = 0.0

        dQP_dt = flx["j_refill_iu"] - flx["j_exo_iu"]
        dQR_dt = flx["j_biosyn_iu"] - flx["j_refill_iu"] - flx["j_basal_iu"]
        dApot_dt = (params.g_pot * phi_glc - A_pot) / params.tau_pot_min
        dCumPre_dt = flx["j_sec_prehep_iu"]
        dCumBio_dt = flx["j_biosyn_iu"]
        dCumSys_dt = flx["j_sys_iu"]

        if has_lag:
            return np.array(
                [dG_dt, dIp_dt, dX_dt, dU_dt, dS_dt, dGcg_dt, dM_dt, dQP_dt, dQR_dt, dApot_dt, dCumPre_dt, dCumBio_dt, dCumSys_dt, dI1_dt, dI2_dt],
                dtype=np.float64,
            )
        return np.array(
            [dG_dt, dIp_dt, dX_dt, dU_dt, dS_dt, dGcg_dt, dM_dt, dQP_dt, dQR_dt, dApot_dt, dCumPre_dt, dCumBio_dt, dCumSys_dt],
            dtype=np.float64,
        )

    g0 = 5.1 if v >= 0.6 else 17.2 - 12.1 * v
    s0 = 0.12 * loc_f
    m0 = 0.08 * loc_f if is_invivo else 0.0
    s_ins0 = fluxes(g0, s0, m0, qp0, qr0, 0.0)["sec_ins_sys_pm"]
    base_y0 = [g0, 48.0 * v, 0.03 * v, 0.08 * loc_f if is_invivo else 0.0, s0, 60.0, m0, qp0, qr0, 0.0, 0.0, 0.0, 0.0]
    if has_lag:
        base_y0.extend([s_ins0, s_ins0])

    # Uncapped stiffness-rate bound covering Q_P turnover, 1/tau_chamber, and 2/tau_vasc:
    lam_qp_upper = (alpha_prehep_iu_per_pm * v * 88.0 / max(1e-15, qp0)) + ((1.0 + params.gamma_amp) / params.tau_refill_min)
    lam_chamber = (1.0 / params.tau_chamber_min) if (not is_invivo and params.tau_chamber_min > 0.0) else 0.0
    lam_vasc = (2.0 / lag_f) if has_lag else 0.0
    max_lam_upper = max(lam_qp_upper, lam_chamber, lam_vasc) + 0.5 * min(lam_qp_upper, max(lam_chamber, lam_vasc))

    return {
        "rhs": rhs,
        "fluxes": fluxes,
        "y0": np.array(base_y0, dtype=np.float64),
        "c0_iu": c0_iu,
        "qp0_iu": qp0,
        "qr0_iu": qr0,
        "v_eff": v,
        "f_hepatic_eff": f_hep_eff,
        "max_stiff_rate_min_inv": max_lam_upper,
        "ex_start": ex_start,
        "ex_end": ex_end,
    }


def courant_safe_rk4_integrate_iip_0029(
    rhs: Any,
    y0: np.ndarray,
    t_grid: np.ndarray,
    max_stiff_rate: float,
    breakpoints: tuple[float, ...] = (),
    courant_target: float = 0.18,
) -> np.ndarray:
    """Explicit 4th-order Runge-Kutta integrator with uncapped stiffness-rate substepping and breakpoint handling."""
    out = np.zeros((len(y0), len(t_grid)), dtype=np.float64)
    out[:, 0] = y0.copy()
    cur = y0.copy()
    bp_set = {float(b) for b in breakpoints}

    for idx in range(len(t_grid) - 1):
        t0 = float(t_grid[idx])
        t1 = float(t_grid[idx + 1])
        span = t1 - t0
        if span <= 0.0:
            out[:, idx + 1] = cur
            continue
        n_sub = max(1, int(math.ceil(span * max(1.0, float(max_stiff_rate)) / float(courant_target))))
        h = span / float(n_sub)
        tc = t0
        for _ in range(n_sub):
            t_eval_mid = tc + 0.5 * h
            t_r1 = math.nextafter(tc, t1) if tc in bp_set else tc
            t_r4 = math.nextafter(tc + h, tc) if (tc + h) in bp_set else (tc + h)
            k1 = rhs(t_r1, cur)
            k2 = rhs(t_eval_mid, cur + 0.5 * h * k1)
            k3 = rhs(t_eval_mid, cur + 0.5 * h * k2)
            k4 = rhs(t_r4, cur + h * k3)
            cur = cur + (h / 6.0) * (k1 + 2.0 * k2 + 2.0 * k3 + k4)
            tc += h
        out[:, idx + 1] = cur
    return out


def replay_mode_b_v2_perifusion_iip_0029(
    params: ModeBV2GranuleStoreParams,
    low_mM: float,
    high_mM: float,
    pre_low_min: float,
    high_durations: List[float],
    low_gaps: List[float],
    dt_out: float = 0.1,
) -> Dict[str, Any]:
    """
    Imposed-glucose repeated-challenge perifusion replay under exploratory Mode B v2.
    Uses the pre-pulse steady basal reference for step-down shut-off so truncated short low
    intervals return censored None rather than an artificial fast t90.
    """
    sys_b = build_mode_b_v2_granule_store_system_iip_0029(params, assay_context="in_vitro_perifusion")
    rhs_cell = sys_b["rhs"]
    flux_fn = sys_b["fluxes"]
    tau_ch = params.tau_chamber_min
    use_chamber = tau_ch > 1e-9

    y0_cell = sys_b["y0"].copy()
    y0_cell[0] = float(low_mM)
    sec0 = flux_fn(float(low_mM), y0_cell[4], y0_cell[6], y0_cell[7], y0_cell[8], y0_cell[9])["sec_ins_sys_pm"]
    state = np.concatenate([y0_cell, [float(low_mM), sec0]]) if use_chamber else y0_cell.copy()

    def run_seg(st_in: np.ndarray, g_inlet: float, dur: float) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
        n_steps = max(1, int(round(dur / dt_out)))
        t_vec = np.linspace(0.0, float(dur), n_steps + 1)
        if use_chamber:
            def _aug_rhs(t: float, ya: np.ndarray) -> np.ndarray:
                yc = ya[:13].copy()
                g_ch, c_eff = float(ya[13]), float(ya[14])
                yc[0] = g_ch
                dyc = rhs_cell(t, yc)
                dyc[0] = 0.0
                sec_now = flux_fn(g_ch, yc[4], yc[6], yc[7], yc[8], yc[9])["sec_ins_sys_pm"]
                dg_ch = (float(g_inlet) - g_ch) / tau_ch
                dc_eff = (sec_now - c_eff) / tau_ch
                return np.concatenate([dyc, [dg_ch, dc_eff]])

            y_mat = courant_safe_rk4_integrate_iip_0029(_aug_rhs, st_in, t_vec, sys_b["max_stiff_rate_min_inv"])
            eff_sec = y_mat[14, :].copy()
            return y_mat[:, -1].copy(), t_vec, eff_sec, y_mat

        st0 = st_in.copy()
        st0[0] = float(g_inlet)

        def _clamp_rhs(t: float, yc: np.ndarray) -> np.ndarray:
            yc_use = yc.copy()
            yc_use[0] = float(g_inlet)
            dy = rhs_cell(t, yc_use)
            dy[0] = 0.0
            return dy

        y_mat = courant_safe_rk4_integrate_iip_0029(_clamp_rhs, st0, t_vec, sys_b["max_stiff_rate_min_inv"])
        eff_sec = np.array(
            [flux_fn(float(g_inlet), y_mat[4, j], y_mat[6, j], y_mat[7, j], y_mat[8, j], y_mat[9, j])["sec_ins_sys_pm"] for j in range(n_steps + 1)],
            dtype=np.float64,
        )
        return y_mat[:, -1].copy(), t_vec, eff_sec, y_mat

    state, _, prior_eff, y_pre = run_seg(state, low_mM, pre_low_min)
    min_qp_seen = float(np.min(y_pre[7, :]))
    min_qr_seen = float(np.min(y_pre[8, :]))
    max_qr_seen = float(np.max(y_pre[8, :]))
    min_m_seen = float(np.min(y_pre[6, :]))
    max_m_seen = float(np.max(y_pre[6, :]))

    pulses: List[Dict[str, Any]] = []
    instantaneous_stepdown_drop_pct = None

    for idx, h_min in enumerate(high_durations):
        basal = float(prior_eff[-1])
        state, t_vec, eff_vec, y_hi = run_seg(state, high_mM, h_min)
        min_qp_seen = min(min_qp_seen, float(np.min(y_hi[7, :])))
        min_qr_seen = min(min_qr_seen, float(np.min(y_hi[8, :])))
        max_qr_seen = max(max_qr_seen, float(np.max(y_hi[8, :])))
        min_m_seen = min(min_m_seen, float(np.min(y_hi[6, :])))
        max_m_seen = max(max_m_seen, float(np.max(y_hi[6, :])))

        peak_idx = int(np.argmax(eff_vec))
        tot_area = _trapezoid_iip0029(eff_vec, t_vec)
        exc_area = _trapezoid_iip0029(eff_vec - basal, t_vec)
        pulses.append(
            {
                "high_minutes": float(h_min),
                "pre_secretion": basal,
                "peak": float(eff_vec[peak_idx]),
                "mean_high_rate": tot_area / max(1e-9, float(h_min)),
                "time_to_peak_min": float(t_vec[peak_idx]),
                "late_plateau": float(np.mean(eff_vec[max(0, int(0.75 * len(eff_vec))):])),
                "total_high_area": tot_area,
                "excess_high_area": exc_area,
            }
        )
        if idx < len(low_gaps):
            eff_pre_stepdown = float(eff_vec[-1])
            state, t_low, prior_eff, y_low = run_seg(state, low_mM, low_gaps[idx])
            min_qp_seen = min(min_qp_seen, float(np.min(y_low[7, :])))
            min_qr_seen = min(min_qr_seen, float(np.min(y_low[8, :])))
            max_qr_seen = max(max_qr_seen, float(np.max(y_low[8, :])))
            min_m_seen = min(min_m_seen, float(np.min(y_low[6, :])))
            max_m_seen = max(max_m_seen, float(np.max(y_low[6, :])))
            if idx == 0:
                eff_t0plus = float(prior_eff[0])
                instantaneous_stepdown_drop_pct = (
                    0.0 if eff_pre_stepdown <= 1e-12 else 100.0 * (1.0 - eff_t0plus / eff_pre_stepdown)
                )
                s_start = float(prior_eff[0])
                s_basal_ref = float(pulses[0]["pre_secretion"])
                span_drop = s_start - s_basal_ref
                t50_val, t90_val = None, None
                if span_drop > 1e-6:
                    target50 = s_basal_ref + 0.50 * span_drop
                    target90 = s_basal_ref + 0.10 * span_drop
                    for k_i in range(len(prior_eff) - 1):
                        ya, yb = float(prior_eff[k_i]), float(prior_eff[k_i + 1])
                        if t50_val is None and ya >= target50 >= yb:
                            frac = 0.0 if abs(ya - yb) < 1e-15 else (ya - target50) / (ya - yb)
                            t50_val = float(t_low[k_i] + frac * (t_low[k_i + 1] - t_low[k_i]))
                        if t90_val is None and ya >= target90 >= yb:
                            frac = 0.0 if abs(ya - yb) < 1e-15 else (ya - target90) / (ya - yb)
                            t90_val = float(t_low[k_i] + frac * (t_low[k_i + 1] - t_low[k_i]))
                pulses[0]["effluent_stepdown_t50_min"] = t50_val
                pulses[0]["effluent_stepdown_t90_min"] = t90_val

    if not (-1e-12 <= min_m_seen and max_m_seen <= 1.0 + 1e-12):
        raise AssertionError(f"Mode B v2 M_sec invariant violated: [{min_m_seen}, {max_m_seen}] (IIP-0029; DEC-108)")

    final_store = float(state[7] + state[8])
    cum_prehep = float(state[10])
    cum_bio = float(state[11])
    c0 = sys_b["c0_iu"]
    rel_mass_err = abs((final_store + cum_prehep - cum_bio) - c0) / c0
    exc0 = pulses[0]["excess_high_area"]
    excess_ratios = None if abs(exc0) <= 1e-12 else [p["excess_high_area"] / exc0 for p in pulses]

    return {
        "pulses": pulses,
        "peak_ratios": [p["peak"] / max(1e-15, pulses[0]["peak"]) for p in pulses],
        "total_area_ratios": [p["total_high_area"] / max(1e-15, pulses[0]["total_high_area"]) for p in pulses],
        "excess_area_ratios": excess_ratios,
        "initial_store_c0_iu": c0,
        "final_store_iu": final_store,
        "min_qp_iu": min_qp_seen,
        "min_qr_iu": min_qr_seen,
        "max_qr_over_qr0": max_qr_seen / sys_b["qr0_iu"],
        "min_m_sec": min_m_seen,
        "max_m_sec": max_m_seen,
        "instantaneous_stepdown_drop_pct": instantaneous_stepdown_drop_pct,
        "cumulative_secreted_iu": cum_prehep,
        "cumulative_biosyn_iu": cum_bio,
        "relative_mass_conservation_error": rel_mass_err,
    }


def run_mode_b_v2_24h_metabolic_sensitivity_iip_0029(
    params: ModeBV2GranuleStoreParams,
    *,
    viable_endocrine_fraction_override: float | None = None,
    local_paracrine_preserved_systemic_scale: bool = False,
    extravascular_insulin_lag_total_min: float = 0.0,
    low_glucose_challenge_mode: bool = False,
    meals_override: List[tuple[float, float]] | None = None,
    return_traces: bool = False,
) -> Dict[str, Any]:
    """Run a 24-h (5,761-step, dt = 0.25 min) exploratory Mode B v2 granule-store sensitivity replay."""
    sys_b = build_mode_b_v2_granule_store_system_iip_0029(
        params,
        assay_context="in_vivo_metabolic_twin",
        viable_endocrine_fraction_override=viable_endocrine_fraction_override,
        local_paracrine_preserved_systemic_scale=local_paracrine_preserved_systemic_scale,
        extravascular_insulin_lag_total_min=extravascular_insulin_lag_total_min,
        low_glucose_challenge_mode=low_glucose_challenge_mode,
        meals_override=meals_override,
    )
    t_grid = np.linspace(0.0, 1440.0, 5761)
    rk4_y = courant_safe_rk4_integrate_iip_0029(
        sys_b["rhs"],
        sys_b["y0"],
        t_grid,
        sys_b["max_stiff_rate_min_inv"],
        breakpoints=(sys_b["ex_start"], sys_b["ex_end"]),
    )
    g_0p25 = rk4_y[0, :]
    min_m_val = float(np.min(rk4_y[6, :]))
    max_m_val = float(np.max(rk4_y[6, :]))
    if not (-1e-12 <= min_m_val and max_m_val <= 1.0 + 1e-12):
        raise AssertionError(f"Mode B v2 24h M_sec invariant violated: [{min_m_val}, {max_m_val}] (IIP-0029; DEC-108)")

    elapsed = compute_exact_elapsed_glycemic_metrics_iip_0024(t_grid, g_0p25)
    ex_s_idx = int(sys_b["ex_start"] * 4)
    ex_e_idx = int(sys_b["ex_end"] * 4)
    sec_ex = np.array(
        [
            sys_b["fluxes"](
                float(rk4_y[0, k]),
                float(rk4_y[4, k]),
                float(rk4_y[6, k]),
                float(rk4_y[7, k]),
                float(rk4_y[8, k]),
                float(rk4_y[9, k]),
            )["sec_ins_sys_pm"]
            for k in range(ex_s_idx, ex_e_idx + 1)
        ],
        dtype=np.float64,
    )
    half_drop = _trajectory_half_drop_time(t_grid[ex_s_idx : ex_e_idx + 1], sec_ex, sys_b["ex_start"], sys_b["ex_end"])
    final_store = float(rk4_y[7, -1] + rk4_y[8, -1])
    cum_prehep = float(rk4_y[10, -1])
    cum_bio = float(rk4_y[11, -1])
    cum_sys = float(rk4_y[12, -1])
    c0 = sys_b["c0_iu"]
    rel_mass_err = abs((final_store + cum_prehep - cum_bio) - c0) / c0
    out: Dict[str, Any] = {
        "granule_conservation_mode": "two_pool_conserved_v2",
        "evidence_status": "EXPLORATORY_OPT_IN_SENSITIVITY_COMPARATOR_NOT_A_RELEASE_GATE",
        "initial_store_c0_iu": round(c0, 4),
        "final_store_iu": round(final_store, 4),
        "min_glucose_0p25min_mM": float(np.min(g_0p25)),
        "max_glucose_0p25min_mM": float(np.max(g_0p25)),
        "tir_3p9_to_10_elapsed_pct": float(elapsed["tir_elapsed_unrounded_pct"]),
        "tbr_lt_3p9_elapsed_pct": float(elapsed["tbr39_elapsed_unrounded_pct"]),
        "tbr_lt_3p0_elapsed_pct": float(elapsed["tbr30_elapsed_unrounded_pct"]),
        "exercise_shutoff_half_time_min": None if half_drop is None else float(half_drop),
        "min_qp_iu": float(np.min(rk4_y[7, :])),
        "min_qr_iu": float(np.min(rk4_y[8, :])),
        "max_qr_over_qr0": float(np.max(rk4_y[8, :]) / sys_b["qr0_iu"]),
        "min_m_sec": min_m_val,
        "max_m_sec": max_m_val,
        "max_abs_ip": float(np.max(np.abs(rk4_y[1, :]))),
        "cumulative_24h_prehepatic_secreted_iu": cum_prehep,
        "cumulative_24h_systemic_appearance_iu": cum_sys,
        "cumulative_24h_biosyn_iu": cum_bio,
        "relative_mass_conservation_error": rel_mass_err,
    }
    if return_traces:
        out["t_grid"] = t_grid
        out["state_matrix"] = rk4_y
        out["sys_b"] = sys_b
    return out


def simulate_metabolic_twin_granule_sensitivity_iip_0029(
    *,
    granule_conservation_mode: str = "mode_a_default",
    params: ModeBV2GranuleStoreParams | None = None,
    viable_endocrine_fraction_override: float | None = None,
    local_paracrine_preserved_systemic_scale: bool = True,
    extravascular_insulin_lag_total_min: float = 0.0,
    low_glucose_challenge_mode: bool = False,
    meals_override: List[tuple[float, float]] | None = None,
    return_traces: bool = False,
) -> Dict[str, Any]:
    """
    Opt-in dispatcher preserving exact Mode A default parity unless callers explicitly select
    granule_conservation_mode='two_pool_conserved_v2' for exploratory sensitivity analysis (IIP-0029; DEC-108).
    """
    if granule_conservation_mode == "mode_a_default":
        ode_a = solve_24h_paracrine_and_whole_body_metabolic_ode(pde_regimes=[])
        lead_a = ode_a["graft_architectures_compared"][0]
        return {
            "granule_conservation_mode": "mode_a_default",
            "evidence_status": "LIVE_MODE_A_DEFAULT_PARITY",
            "lead_graft_id": lead_a["graft_id"],
            "tir_3p9_to_10_elapsed_pct": float(lead_a["time_in_tight_range_3p9_to_10p0_mM_pct"]),
            "min_glucose_mM": float(lead_a["min_glucose_mM"]),
            "exercise_shutoff_half_time_min": float(lead_a["insulin_secretion_shutoff_half_time_min"]),
            "tbr_lt_3p0_elapsed_pct": float(lead_a["time_severe_hypoglycemia_lt_3p0_mM_54_mg_dL_pct"]),
        }
    if granule_conservation_mode == "two_pool_conserved_v2":
        use_params = params if params is not None else ModeBV2GranuleStoreParams()
        return run_mode_b_v2_24h_metabolic_sensitivity_iip_0029(
            use_params,
            viable_endocrine_fraction_override=viable_endocrine_fraction_override,
            local_paracrine_preserved_systemic_scale=local_paracrine_preserved_systemic_scale,
            extravascular_insulin_lag_total_min=extravascular_insulin_lag_total_min,
            low_glucose_challenge_mode=low_glucose_challenge_mode,
            meals_override=meals_override,
            return_traces=return_traces,
        )
    raise ValueError(
        f"Unsupported granule_conservation_mode={granule_conservation_mode!r}; "
        "expected 'mode_a_default' or 'two_pool_conserved_v2' (IIP-0029; DEC-108)"
    )


def verify_mode_b_v2_against_scipy_dop853_iip_0029(
    params: ModeBV2GranuleStoreParams | None = None,
    *,
    local_paracrine_preserved_systemic_scale: bool = True,
) -> Dict[str, Any]:
    """
    Independent piecewise SciPy DOP853 verification of Mode B v2 across glucose G(t),
    RRP store Q_P(t), reserve store Q_R(t), and cumulative pre-hepatic secretion CumPre(t)
    over 0-1,440 min (breakpoints 600 and 660 min; IIP-0029; DEC-108).
    """
    use_params = params if params is not None else ModeBV2GranuleStoreParams()
    sim = run_mode_b_v2_24h_metabolic_sensitivity_iip_0029(
        use_params,
        local_paracrine_preserved_systemic_scale=local_paracrine_preserved_systemic_scale,
        return_traces=True,
    )
    rk4_mat = sim["state_matrix"]
    sys_p = sim["sys_b"]
    try:
        import scipy
        from scipy.integrate import solve_ivp as _dop_solve_ivp
    except ImportError:
        return {
            "scipy_available": False,
            "verified": False,
            "note": "SciPy is not installed in this Python interpreter; run with SciPy to execute live DOP853 parity.",
        }

    t_s1 = np.linspace(0.0, 600.0, 2401)
    t_s2 = np.linspace(600.0, 660.0, 241)
    t_s3 = np.linspace(660.0, 1440.0, 3121)
    d1 = _dop_solve_ivp(sys_p["rhs"], (0.0, 600.0), sys_p["y0"], method="DOP853", t_eval=t_s1, rtol=1e-11, atol=1e-13, max_step=1.0)
    d2 = _dop_solve_ivp(sys_p["rhs"], (600.0, 660.0), d1.y[:, -1], method="DOP853", t_eval=t_s2, rtol=1e-11, atol=1e-13, max_step=1.0)
    d3 = _dop_solve_ivp(sys_p["rhs"], (660.0, 1440.0), d2.y[:, -1], method="DOP853", t_eval=t_s3, rtol=1e-11, atol=1e-13, max_step=1.0)
    if not (d1.success and d2.success and d3.success):
        raise RuntimeError("Piecewise SciPy DOP853 verification failed to converge (IIP-0029; DEC-108)")

    dop_full = np.concatenate([d1.y, d2.y[:, 1:], d3.y[:, 1:]], axis=1)
    max_g_diff = float(np.max(np.abs(rk4_mat[0, :] - dop_full[0, :])))
    max_qp_diff = float(np.max(np.abs(rk4_mat[7, :] - dop_full[7, :])))
    max_qr_diff = float(np.max(np.abs(rk4_mat[8, :] - dop_full[8, :])))
    max_cum_diff = float(np.max(np.abs(rk4_mat[10, :] - dop_full[10, :])))
    max_g_0_600 = float(np.max(np.abs(rk4_mat[0, :2401] - d1.y[0, :])))

    return {
        "scipy_available": True,
        "scipy_version": str(scipy.__version__),
        "verified": bool(
            max_g_diff < 1e-5
            and max_qp_diff < 1e-6
            and max_qr_diff < 1e-5
            and max_cum_diff < 1e-5
        ),
        "dop853_0_to_600min_max_abs_g_diff_mM": max_g_0_600,
        "dop853_0_to_1440min_max_abs_g_diff_mM": max_g_diff,
        "dop853_0_to_1440min_max_abs_qp_diff_iu": max_qp_diff,
        "dop853_0_to_1440min_max_abs_qr_diff_iu": max_qr_diff,
        "dop853_0_to_1440min_max_abs_cum_prehep_diff_iu": max_cum_diff,
    }


def _replay_live_mode_a_imposed_perifusion_iip_0029(
    low_mM: float,
    high_mM: float,
    pre_low_min: float,
    high_durations: List[float],
    low_gaps: List[float],
    *,
    force_zero_sst: bool = False,
    dt_out: float = 0.1,
) -> Dict[str, Any]:
    """Direct imposed-glucose replay of live Mode A secretion/SST equations showing zero granule conservation."""
    def _step(st: np.ndarray, g_val: float, dur: float) -> tuple[np.ndarray, np.ndarray]:
        n_st = max(1, int(round(dur / dt_out)))
        t_v = np.linspace(0.0, float(dur), n_st + 1)

        def _rhs_a(_t: float, y: np.ndarray) -> np.ndarray:
            u_v, s_v, m_v = float(y[0]), float(y[1]), float(y[2])
            gp = max(0.5, float(g_val))
            sp = max(0.0, s_v)
            gs = (sp / (1e-4 + sp)) if sp > 0.0 else 0.0
            g_eff = max(0.0, gp - 3.5)
            k_eff = 7.2 - 3.5
            phi_g = (g_eff ** 4.2) / ((k_eff ** 4.2) + (g_eff ** 4.2))
            m_t = phi_g / (1.0 + 1.50 * sp * gs)
            if m_t < m_v:
                tau_s = 1.85 / (1.0 + 0.8 * sp)
                if gp < 4.20:
                    tau_s = tau_s * ((gp / 4.20) ** 4)
                tau_m = 6.80 * (1.0 - gs) + tau_s * gs
            else:
                tau_m = 2.00
            dm = (m_t - m_v) / tau_m
            du = (1.2 * m_v - u_v) / 2.5
            s_drv = 0.0 if force_zero_sst else (0.65 * u_v + 0.45 * ((gp ** 4) / (5.8 ** 4 + gp ** 4)))
            ds = (s_drv - s_v) / 1.5
            return np.array([du, ds, dm], dtype=np.float64)

        ym = courant_safe_rk4_integrate_iip_0029(_rhs_a, st, t_v, max_stiff_rate=3.0)
        gp_c = max(0.5, float(g_val))
        sec = np.array(
            [
                (
                    (6.8 - 0.8 * (0.0 if force_zero_sst else ((max(0.0, ym[1, k]) / (1e-4 + max(0.0, ym[1, k]))) if ym[1, k] > 0 else 0.0)))
                    + 88.0 * max(0.0, ym[2, k])
                )
                * (
                    1.0
                    - (0.0 if force_zero_sst else ((max(0.0, ym[1, k]) / (1e-4 + max(0.0, ym[1, k]))) if ym[1, k] > 0 else 0.0))
                    * (1.0 - (gp_c / 4.20) ** 8)
                    if gp_c < 4.20
                    else 1.0
                )
                for k in range(len(t_v))
            ],
            dtype=np.float64,
        )
        return ym[:, -1].copy(), sec

    st = np.array([0.0, 0.0 if force_zero_sst else 0.12, 0.0], dtype=np.float64)
    st, _ = _step(st, low_mM, pre_low_min)
    peaks: List[float] = []
    for i, hd in enumerate(high_durations):
        st, sec_hi = _step(st, high_mM, hd)
        peaks.append(float(np.max(sec_hi)))
        if i < len(low_gaps):
            st, _ = _step(st, low_mM, low_gaps[i])
    return {
        "peaks": peaks,
        "peak2_over_peak1_pct": round(100.0 * peaks[1] / max(1e-15, peaks[0]), 4) if len(peaks) >= 2 else None,
    }


def build_exploratory_mode_b_v2_granule_sensitivity_audit_iip_0029(
    part_b_mode_a: Dict[str, Any] | None = None,
) -> Dict[str, Any]:
    """
    Build the bounded, strictly opt-in exploratory Mode B v2 two-clock granule-store sensitivity
    audit attached to Layer 4 Part B (IIP-0029; DEC-108). Preserves exact Mode A default parity
    and is NEVER a Stage-0 clinical release gate.
    """
    p_portal = ModeBV2GranuleStoreParams(c0_ref_iu_at_300k_beta_eeq=89.9, beta_cell_fraction=0.60, implanted_total_ieq=500_000.0, f_hepatic=0.50)
    sim_p = run_mode_b_v2_24h_metabolic_sensitivity_iip_0029(p_portal, local_paracrine_preserved_systemic_scale=True)
    sim_f40 = run_mode_b_v2_24h_metabolic_sensitivity_iip_0029(ModeBV2GranuleStoreParams(f_hepatic=0.40), local_paracrine_preserved_systemic_scale=True)
    sim_f60 = run_mode_b_v2_24h_metabolic_sensitivity_iip_0029(ModeBV2GranuleStoreParams(f_hepatic=0.60), local_paracrine_preserved_systemic_scale=True)
    sim_f00 = run_mode_b_v2_24h_metabolic_sensitivity_iip_0029(ModeBV2GranuleStoreParams(f_hepatic=0.00), local_paracrine_preserved_systemic_scale=True)

    # Real piecewise SciPy DOP853 multi-state verification (G, Q_P, Q_R, CumPre):
    dop_audit = verify_mode_b_v2_against_scipy_dop853_iip_0029(p_portal, local_paracrine_preserved_systemic_scale=True)

    # Infinite-store convergence to live Mode A (reference 1,440-min 7-state ODE):
    p_inf = ModeBV2GranuleStoreParams(c0_ref_iu_at_300k_beta_eeq=1e9, f_rrp=0.10, tau_refill_min=0.5, gamma_amp=5.0, f_hepatic=0.0)
    sim_inf = run_mode_b_v2_24h_metabolic_sensitivity_iip_0029(p_inf, viable_endocrine_fraction_override=1.0, return_traces=True)
    lead_a_tir = None
    lead_a_min_g = None
    if isinstance(part_b_mode_a, dict) and part_b_mode_a.get("graft_architectures_compared"):
        lead_a = part_b_mode_a["graft_architectures_compared"][0]
        lead_a_tir = float(lead_a["time_in_tight_range_3p9_to_10p0_mM_pct"])
        lead_a_min_g = float(lead_a["min_glucose_mM"])

    # Positivity, mass conservation, small-lag stability, and C^1 biosynthesis saturation:
    p_stiff = ModeBV2GranuleStoreParams(c0_ref_iu_at_300k_beta_eeq=0.25, f_rrp=0.0045, tau_refill_min=16.5, enable_biosyn=True)
    sim_stiff = run_mode_b_v2_24h_metabolic_sensitivity_iip_0029(p_stiff, meals_override=[(60.0, 120.0), (240.0, 120.0)])
    rep_small_ch = replay_mode_b_v2_perifusion_iip_0029(ModeBV2GranuleStoreParams(tau_chamber_min=0.01), 2.8, 16.7, 30.0, [10.0], [5.0], dt_out=0.2)
    sim_small_vasc = run_mode_b_v2_24h_metabolic_sensitivity_iip_0029(p_portal, extravascular_insulin_lag_total_min=0.05, local_paracrine_preserved_systemic_scale=True)
    fast_12h = replay_mode_b_v2_perifusion_iip_0029(p_portal, 2.8, 2.8, 720.0, [10.0], [], dt_out=1.0)
    sys_p_diag = build_mode_b_v2_granule_store_system_iip_0029(p_portal, assay_context="in_vivo_metabolic_twin")
    hypo_2mM_biosyn = sys_p_diag["fluxes"](2.0, 0.12, 0.0, sys_p_diag["qp0_iu"], 0.50 * sys_p_diag["qr0_iu"], 0.0)["j_biosyn_iu"]

    # Effluent shutoff & short low-interval censoring:
    r2_std = replay_mode_b_v2_perifusion_iip_0029(p_portal, 2.8, 16.7, 90.0, [20.0, 20.0], [15.0], dt_out=0.1)
    p_ch06 = ModeBV2GranuleStoreParams(tau_chamber_min=0.60)
    r2_short_2m = replay_mode_b_v2_perifusion_iip_0029(p_ch06, 2.8, 16.7, 90.0, [20.0], [2.0], dt_out=0.1)
    r2_long_60m = replay_mode_b_v2_perifusion_iip_0029(p_ch06, 2.8, 16.7, 90.0, [20.0], [60.0], dt_out=0.1)

    # Ceteris-paribus isolated tau_refill = 16.5 -> 45.0 min at fixed 56.88 IU (f_rrp=0.0045, gamma_amp=0.08):
    c0_w6 = 89.9 * 0.632693
    p_w6_fast = ModeBV2GranuleStoreParams(c0_ref_iu_at_300k_beta_eeq=c0_w6, f_rrp=0.0045, tau_refill_min=16.5, gamma_amp=0.08, f_hepatic=0.50)
    p_w6_slow = ModeBV2GranuleStoreParams(c0_ref_iu_at_300k_beta_eeq=c0_w6, f_rrp=0.0045, tau_refill_min=45.0, gamma_amp=0.08, f_hepatic=0.50)
    m_5h7h = [(60.0, 75.0), (360.0, 85.0), (780.0, 90.0)]
    m_4h4h = [(60.0, 75.0), (300.0, 85.0), (540.0, 90.0)]
    s_fast_57 = run_mode_b_v2_24h_metabolic_sensitivity_iip_0029(p_w6_fast, local_paracrine_preserved_systemic_scale=True, meals_override=m_5h7h)
    s_slow_57 = run_mode_b_v2_24h_metabolic_sensitivity_iip_0029(p_w6_slow, local_paracrine_preserved_systemic_scale=True, meals_override=m_5h7h)
    s_fast_44 = run_mode_b_v2_24h_metabolic_sensitivity_iip_0029(p_w6_fast, local_paracrine_preserved_systemic_scale=True, meals_override=m_4h4h)
    s_slow_44 = run_mode_b_v2_24h_metabolic_sensitivity_iip_0029(p_w6_slow, local_paracrine_preserved_systemic_scale=True, meals_override=m_4h4h)

    # Local 4-schedule Jacobian & FIM conditioning (illustrating unidentifiability from cross-protocol summaries):
    fim_scheds = (
        ("peak", 2.0, 20.0, 120.0, [18.0, 18.0], [5.0]),
        ("peak", 2.8, 20.0, 120.0, [19.0, 14.0], [17.0]),
        ("area", 2.8, 20.0, 90.0, [30.0, 30.0], [30.0]),
        ("area", 2.8, 20.0, 120.0, [60.0, 60.0], [60.0]),
    )

    def _eval_fim_vec(c0_v: float, fr_v: float, tr_v: float, ga_v: float) -> np.ndarray:
        pf = ModeBV2GranuleStoreParams(c0_ref_iu_at_300k_beta_eeq=c0_v, f_rrp=fr_v, tau_refill_min=tr_v, gamma_amp=ga_v, enable_biosyn=False, tau_chamber_min=0.0)
        vals = []
        for rk, lo, hi, pre, hd, gp in fim_scheds:
            rep = replay_mode_b_v2_perifusion_iip_0029(pf, lo, hi, pre, hd, gp, dt_out=0.5)
            vals.append(rep["peak_ratios"][1] if rk == "peak" else rep["total_area_ratios"][1])
        return np.array(vals, dtype=np.float64)

    th0 = np.array([89.9, 0.0045, 16.5, 0.08], dtype=np.float64)
    eps = 1e-3
    jac = np.zeros((4, 4), dtype=np.float64)
    for j in range(4):
        tp, tm = th0.copy(), th0.copy()
        tp[j] *= math.exp(eps)
        tm[j] *= math.exp(-eps)
        jac[:, j] = (_eval_fim_vec(*tp) - _eval_fim_vec(*tm)) / (2.0 * eps)
    sv = np.linalg.svd(jac, compute_uv=False)
    jac_cond = float(sv[0] / max(1e-15, sv[-1]))

    # Live Mode A zero-conservation diagnostic on 5-min gap:
    ma_5m = _replay_live_mode_a_imposed_perifusion_iip_0029(2.0, 20.0, 120.0, [18.0, 18.0], [5.0], force_zero_sst=False)
    ma_5m_nosst = _replay_live_mode_a_imposed_perifusion_iip_0029(2.0, 20.0, 120.0, [18.0, 18.0], [5.0], force_zero_sst=True)

    return {
        "decision_id": "DEC-108",
        "contribution_id": "IIP-0029",
        "evidence_status": "EXPLORATORY_OPT_IN_SENSITIVITY_COMPARATOR_NOT_A_RELEASE_GATE",
        "default_mode_a_unchanged": True,
        "mode_a_default_reference_parity": {
            "lead_60_30_10_mode_a_tir_pct": lead_a_tir,
            "lead_60_30_10_mode_a_min_glucose_mM": lead_a_min_g,
            "infinite_store_mode_b_v2_tir_pct": round(sim_inf["tir_3p9_to_10_elapsed_pct"], 2),
            "infinite_store_mode_b_v2_min_glucose_mM": round(sim_inf["min_glucose_0p25min_mM"], 4),
            "live_mode_a_5min_gap_peak2_over_peak1_pct": ma_5m["peak2_over_peak1_pct"],
            "live_mode_a_zero_sst_5min_gap_peak2_over_peak1_pct": ma_5m_nosst["peak2_over_peak1_pct"],
        },
        "real_scipy_dop853_multi_state_verification": dop_audit,
        "positivity_mass_conservation_and_biosyn_audit": {
            "c0_0p25_iu_min_qp_iu": sim_stiff["min_qp_iu"],
            "c0_0p25_iu_relative_mass_error": sim_stiff["relative_mass_conservation_error"],
            "c0_0p25_iu_m_sec_range": [round(sim_stiff["min_m_sec"], 6), round(sim_stiff["max_m_sec"], 6)],
            "small_tau_chamber_0p01_min_finite_and_positive": bool(math.isfinite(rep_small_ch["pulses"][0]["peak"]) and rep_small_ch["min_qp_iu"] > 0.0),
            "small_tau_vasc_0p05_min_max_ip": round(sim_small_vasc["max_abs_ip"], 4),
            "fasting_12h_store_drift_iu": abs(fast_12h["final_store_iu"] - fast_12h["initial_store_c0_iu"]),
            "hypoglycemia_2p0mM_biosynthesis_iu_per_min": float(hypo_2mM_biosyn),
        },
        "effluent_shutoff_and_short_interval_censoring_audit": {
            "tau_chamber_0p35_min_t50_min": round(float(r2_std["pulses"][0]["effluent_stepdown_t50_min"]), 4),
            "tau_chamber_0p35_min_t90_min": round(float(r2_std["pulses"][0]["effluent_stepdown_t90_min"]), 4),
            "tau_chamber_0p60_min_2min_low_t90_censored": r2_short_2m["pulses"][0]["effluent_stepdown_t90_min"],
            "tau_chamber_0p60_min_60min_low_t90_min": round(float(r2_long_60m["pulses"][0]["effluent_stepdown_t90_min"]), 4),
            "instantaneous_stepdown_drop_pct": round(float(r2_std["instantaneous_stepdown_drop_pct"]), 6),
        },
        "hepatic_first_pass_extraction_sensitivity_sweep": {
            "ownership_note": (
                "First-pass hepatic extraction f_hepatic is owned solely by exploratory Mode B v2 to debit total pre-hepatic secretion "
                "from intracellular stores while delivering (1 - f_hepatic) systemically; it is strictly distinct from Layer 4's 13-state "
                "f_sys_ins insulin-action scaling and is never double-counted. Direct human hepatic-vein pulsatile extraction "
                "(Meier et al. 2005 PMID:15919785) and canine portal-vs-peripheral studies (Edgerton et al. 2019 PMID:30830873) provide "
                "route context only and do not validate a 40-60% extraction range for this graft."
            ),
            "f_hepatic_0p00_systemic_iu_day": round(sim_f00["cumulative_24h_systemic_appearance_iu"], 2),
            "f_hepatic_0p40_prehepatic_iu_day": round(sim_f40["cumulative_24h_prehepatic_secreted_iu"], 2),
            "f_hepatic_0p50_prehepatic_iu_day": round(sim_p["cumulative_24h_prehepatic_secreted_iu"], 2),
            "f_hepatic_0p50_systemic_iu_day": round(sim_p["cumulative_24h_systemic_appearance_iu"], 2),
            "f_hepatic_0p60_prehepatic_iu_day": round(sim_f60["cumulative_24h_prehepatic_secreted_iu"], 2),
        },
        "ceteris_paribus_isolated_tau_refill_meal_sensitivity": {
            "c0_fixed_iu": round(c0_w6, 2),
            "f_rrp_fixed": 0.0045,
            "gamma_amp_fixed": 0.08,
            "f_hepatic_fixed": 0.50,
            "canonical_5h_7h_250g_tir_tau16p5_pct": round(s_fast_57["tir_3p9_to_10_elapsed_pct"], 2),
            "canonical_5h_7h_250g_tir_tau45p0_pct": round(s_slow_57["tir_3p9_to_10_elapsed_pct"], 2),
            "realistic_4h_4h_250g_tir_tau16p5_pct": round(s_fast_44["tir_3p9_to_10_elapsed_pct"], 2),
            "realistic_4h_4h_250g_tir_tau45p0_pct": round(s_slow_44["tir_3p9_to_10_elapsed_pct"], 2),
        },
        "beta_fraction_stored_insulin_scaling_note": {
            "modeled_60_30_10_500k_ieq_range_iu": [41.5, 138.3],
            "unadjusted_70_20_10_500k_ieq_equal_per_beta_content_range_iu": [round(41.5 * 7.0 / 6.0, 2), round(138.3 * 7.0 / 6.0, 2)],
            "gate0s_escalation_trigger_iu": 138.3,
            "caveat": (
                "Arithmetic scaling assumes identical total IEQ and identical mature insulin content per beta-equivalent "
                "(Perez-Frances et al. 2024 PMID:39169271 did not measure this recipe). Stage-0 therefore measures intact mature "
                "insulin directly at the actual final dose and escalates to full scope-matched Gate 0S atomic-ledger review "
                "whenever U95_t(stored_insulin_iu) > 138.3 IU or max_lot > 138.3 IU."
            ),
        },
        "local_4schedule_jacobian_and_fim_conditioning": {
            "log_parameter_jacobian_condition_number": round(jac_cond, 2),
            "log_parameter_fim_condition_number": round(jac_cond ** 2, 1),
            "identifiability_caveat": (
                "Local 4-summary FIM ill-conditioning (which depends on parameter scaling) and cross-protocol validation "
                "confirm that uncalibrated ODE parameter inversion cannot replace empirical Stage-0 two-pulse Readout 2, "
                "direct inert-tracer tau_chamber verification, and mature-insulin inventory measurement."
            ),
        },
        "primary_citations": [
            "PMID:30661993",
            "PMID:35241836",
            "PMID:36136756",
            "PMID:31068696",
            "PMID:30710150",
            "PMID:27163171",
            "PMID:30931946",
            "PMID:25303535",
            "PMID:12879249",
            "PMID:33737253",
            "PMID:31177185",
            "PMID:39169271",
            "PMID:15919785",
            "PMID:30830873",
        ],
    }
# === END_IIP_0029_EXPLORATORY_MODE_B_V2_GRANULE_STORE_SENSITIVITY ===


def main() -> None:
    part_a_algebra = verify_exact_slab_source_distribution_algebra()
    part_a_pde = solve_336h_spatial_pouch_pde()
    live_series_film_table_r6 = part_a_pde["design_x_100um_lamina_transport_qualification_v80_018"].pop("live_series_film_table_r6")
    dx_coupled_regimes = part_a_pde["design_x_100um_lamina_transport_qualification_v80_018"].pop("coupled_pde_regimes_for_metabolic_ode")
    part_a_pde["regimes_simulated"].extend(dx_coupled_regimes)
    part_a_pde["bed_level_convective_o2_budget_and_periimplant_fluid_film_audit_sonnet55_r5"] = {
        "finding_ids": ["AUDIT-REF", "AUDIT-REF", "AUDIT-REF", "AUDIT-REF", "AUDIT-REF", "AUDIT-REF", "AUDIT-REF"],
        "primary_citations": ["PMID:17497731", "PMID:29695723", "PMID:22371586"],
        "citation_provenance_reconciliation_r6": (
            "Replaces prior misattributed Round-5 PMIDs "
            "with verified islet oxygen transport and macroencapsulation biotransport studies: Papas et al. 2007 PMID:17497731, "
            "Evron et al. 2018 Sci Rep PMID:29695723, and Pedraza et al. 2012 PNAS PMID:22371586 (AUDIT-REF [DEC-050/DEC-078])."
        ),
        # Oxygen-demand basis reconciliation (three distinct, non-interchangeable bases in this file):
        # (i) Pure-islet Vmax basis: 500,000 IEQ x 1.7671e-6 cm^3/IEQ x 34 nmol/cm^3/s = 1.802 umol/min.
        # (ii) Local-film peak basis (periimplant_stagnant_fluid_film_transport_limit below):
        #      q_face = 1.125e-10 mol/cm^2/s at 2,500 IEQ/cm^2 over two faces of 200 cm^2 = 2.70 umol/min
        #      (equivalently 6.75e-11 at 1,500 IEQ/cm^2 over two faces of 333.33 cm^2).
        # (iii) Whole-bed macro-flow peak basis (this dict): 0.153 mL STP/min = 6.83 umol/min, matched by
        #      6.21 mL/min x 1.10 mM arteriovenous extraction = 6.831 umol/min (2.53x basis (ii)).
        # Bases (ii) and (iii) are different assumed demand states (local film peak vs safety-scaled whole-bed
        # peak); map both to the same measured lot/state before combining them in one capacity claim.
        "macroscopic_bed_convective_o2_budget_500k_ieq": {
            "total_graft_o2_consumption_mol_min_range": [1.65e-6, 2.75e-6],
            "total_graft_o2_consumption_ml_stp_min_range": [0.037, 0.062],
            "nominal_500k_ieq_o2_consumption_ml_stp_min": 0.049,
            "peak_500k_ieq_o2_consumption_ml_stp_min": 0.153,
            "arteriovenous_o2_extraction_delta_c_av_mM": 1.10,
            "required_local_microvascular_blood_flow_ml_min_range": [1.50, 2.50],
            "peak_required_omental_blood_flow_ml_min_at_1p10mM_extraction": 6.21,
            "peak_required_omental_blood_flow_ml_min_at_1p42mM_extraction": 4.80,
            "peak_required_omental_blood_flow_ml_min_at_1p42mM_hyperemic_extraction": 4.80,
            "resting_subcutaneous_adipose_blood_flow_ml_min_per_10g": 0.30,
            "subcutaneous_full_dose_convective_feasibility": False,
            "omental_portal_venous_fold_blood_flow_ml_min_across_333cm2": 12.5,
            "omental_modular_cassette_array_3_to_4_x_100cm2_feasible": True,
        },
        "periimplant_stagnant_fluid_film_transport_limit": {
            "d_o2_water_37C_cm2_s": 2.8e-5,
            "d_o2_proteinaceous_seroma_37C_cm2_s": 1.584e-5,
            "alpha_o2_water_mol_cm3_mmhg": 1.35e-9,
            "alpha_o2_seroma_mol_cm3_mmhg": 1.35e-9,
            "basal_o2_flux_1500_ieq_cm2_mol_cm2_s": 3.90e-11,
            "basal_o2_flux_2500_ieq_cm2_mol_cm2_s": 6.50e-11,
            "o2_flux_1500_ieq_cm2_mol_cm2_s": 6.75e-11,
            "o2_flux_2500_ieq_cm2_mol_cm2_s": 1.125e-10,
            "unvascularized_100pct_surface_flux_seroma_50um_film_drop_basal_mmhg": round((3.90e-11 * 50.0e-4) / (1.584e-5 * 1.35e-9), 2),
            "unvascularized_100pct_surface_flux_seroma_50um_film_drop_peak_mmhg": round((6.75e-11 * 50.0e-4) / (1.584e-5 * 1.35e-9), 2),
            "unvascularized_100pct_surface_flux_seroma_80um_film_drop_peak_mmhg": round((6.75e-11 * 80.0e-4) / (1.584e-5 * 1.35e-9), 2),
            "vascularized_outer_band_kperf_0p1358_external_surface_flux_fraction": 0.32,
            "vascularized_32pct_external_flux_seroma_50um_film_drop_basal_mmhg": round(0.32 * (3.90e-11 * 50.0e-4) / (1.584e-5 * 1.35e-9), 2),
            "vascularized_32pct_external_flux_seroma_50um_film_drop_peak_mmhg": round(0.32 * (6.75e-11 * 50.0e-4) / (1.584e-5 * 1.35e-9), 2),
            "vascularized_32pct_external_flux_seroma_80um_film_drop_peak_mmhg": round(0.32 * (6.75e-11 * 80.0e-4) / (1.584e-5 * 1.35e-9), 2),
            "seroma_adjusted_50um_film_drop_basal_mmhg": round((3.90e-11 * 50.0e-4) / (1.584e-5 * 1.35e-9), 2),
            "seroma_adjusted_50um_film_drop_peak_mmhg": round((6.75e-11 * 50.0e-4) / (1.584e-5 * 1.35e-9), 2),
            "seroma_adjusted_80um_film_drop_peak_mmhg": round((6.75e-11 * 80.0e-4) / (1.584e-5 * 1.35e-9), 2),
            "water_permeability_50um_film_drop_at_3p90e11_basal_mmhg": round((3.90e-11 * 50.0e-4) / (2.8e-5 * 1.35e-9), 2),
            "water_permeability_50um_film_drop_at_6p75e11_peak_mmhg": round((6.75e-11 * 50.0e-4) / (2.8e-5 * 1.35e-9), 2),
            "water_permeability_80um_film_drop_at_6p75e11_peak_mmhg": round((6.75e-11 * 80.0e-4) / (2.8e-5 * 1.35e-9), 2),
            "critical_stagnant_fluid_film_thickness_seroma_100pct_flux_for_15mmhg_drop_um_at_1500_ieq_cm2": round(
                (1.584e-5 * 1.35e-9 * 15.0 / 6.75e-11) * 1e4, 1
            ),
            "critical_stagnant_fluid_film_thickness_seroma_100pct_flux_for_15mmhg_drop_um_at_2500_ieq_cm2": round(
                (1.584e-5 * 1.35e-9 * 15.0 / 1.125e-10) * 1e4, 1
            ),
            "critical_stagnant_fluid_film_thickness_for_15mmhg_drop_um_at_1500_ieq_cm2": round(
                (2.8e-5 * 1.35e-9 * 15.0 / 6.75e-11) * 1e4, 1
            ),
            "critical_stagnant_fluid_film_thickness_for_15mmhg_drop_um_at_2500_ieq_cm2": round(
                (2.8e-5 * 1.35e-9 * 15.0 / 1.125e-10) * 1e4, 1
            ),
            "coupled_bvp_and_series_fluid_film_core_po2_table_r6": {
                "day0_to_3_pre_anastomosis_with_ca_o2_f045_and_50um_film_min_slab_po2_mmhg": 18.42,
                "day90_vascularized_kperf_0p1358_1500_ieq_cm2_with_35um_film_core_po2_mmhg": round(28.34 - 0.32 * (6.75e-11 * 35.0e-4) / (1.584e-5 * 1.35e-9), 2),
                "day90_vascularized_kperf_0p1358_1500_ieq_cm2_with_50um_film_core_po2_mmhg": round(28.34 - 0.32 * (6.75e-11 * 50.0e-4) / (1.584e-5 * 1.35e-9), 2),
                "day90_vascularized_kperf_0p1358_1500_ieq_cm2_with_80um_film_core_po2_mmhg": round(28.34 - 0.32 * (6.75e-11 * 80.0e-4) / (1.584e-5 * 1.35e-9), 2),
                "day90_unvascularized_kperf_0_1500_ieq_cm2_with_50um_film_core_po2_mmhg": 0.08,
                "explanation": (
                    "Exact 1D Fick's law in proteinaceous seroma (D_seroma = 1.584e-5 cm^2/s, alpha = 1.35e-9 mol/cm^3/mmHg) gives "
                    "Delta_P = 9.12 mmHg (basal J = 3.90e-11) and 15.78 mmHg (peak J = 6.75e-11) at 50 um (25.25 mmHg at 80 um, with a 47.5 um critical thickness for a 15.0 mmHg drop) "
                    "if 100% of graft O2 demand crosses the external fluid film; once the outer vascularized hydrogel band anastomoses (k_perf = 0.1358 s^-1 >= 0.10 s^-1), "
                    "68% of O2 is supplied by intra-band microvessels and 32% crosses the outer boundary, reducing the effective external-film drop to 2.92 mmHg (basal) / 5.05 mmHg (peak) at 50 um "
                    "and 8.08 mmHg (peak) at 80 um, maintaining coupled Day-90 slab/outer-band pO2 at 24.80 mmHg (35 um), 23.29 mmHg (50 um), and 20.26 mmHg (80 um; AUDIT-REF & AUDIT-REF [DEC-050]). "
                    "When coupled in series with the live chronic zero-source Nz=201 BVP (capsule = 15 um, k_perf = 0.1358 s^-1, 1,500 IEQ/cm^2) and internal spherical cluster diffusion, "
                    "a 100-um cluster drops from core 7.96 mmHg [7.9650 mmHg 4-dec / 7.97 mmHg direct 2-dec] (0 um film) to 6.23 mmHg (35 um), 5.65 mmHg (50 um), and 4.71 mmHg (< 5.0 mmHg at 80 um film, surface 13.09 mmHg), whereas the DX-b 80-um cluster cap "
                    "maintains core pO2 = 12.35 mmHg (0 um), 10.55 mmHg (35 um), 9.95 mmHg (50 um, surface 15.45 mmHg >= 15.0 mmHg), and 8.95 mmHg (80 um, surface 14.43 mmHg; AUDIT-REF & MW-R6-S2-R4 [DEC-052/053/054/059])."
                ),
                "live_chronic_bvp_and_spherical_cluster_series_film_table_astra6_r6": live_series_film_table_r6,
                "cao2_hydroxide_peroxide_inventory_and_peak_ocr_seroma_fick_audit_muse_r6": {
                    "finding_ids": ["MW-R6-S1-12", "MW-R6-S1-14", "MW-R6-S1-15", "MW-R6-S2-F01", "MW-R6-S2-F02", "MW-R6-S2-R4", "L4A-F01", "L4A-F02"],
                    "cao2_total_alkaline_and_peroxide_stoichiometric_inventory_7cm3_pouch": {
                        "active_cao2_mass_mg": 100.78,
                        "active_cao2_mmol": 1.3982,
                        "total_caoh2_produced_mmol": 1.3982,
                        "total_hydroxide_equivalents_mmol": 2.7964,
                        "total_h2o2_intermediate_generated_mmol": 1.3982,
                        "effective_14d_first_order_release_rate_s_inv": 1.24e-6,
                        "effective_14d_release_half_life_h": round(math.log(2.0) / (1.24e-6 * 3600.0), 2),
                        "peak_day0_oh_generation_flux_mol_cm3_s": round((2.7964e-3 / 7.0) * 1.24e-6, 10),
                        "bicarbonate_co2_vascular_washout_clearance_ratio_vs_oh_flux": 48.5,
                        "sentinel_patch_volume_cm3_at_12cm2_350um": 0.42,
                        "sentinel_patch_volume_range_cm3_10_to_14cm2_350um": [0.35, 0.49],
                        "sentinel_local_peak_day0_oh_generation_flux_at_100p78mg_in_0p42cm3_mol_cm3_s": round((2.7964e-3 / 0.42) * 1.24e-6, 10),
                        "sentinel_local_peak_day0_oh_generation_flux_range_0p35_to_0p49cm3_mol_cm3_s": [
                            round((2.7964e-3 / 0.49) * 1.24e-6, 10),
                            round((2.7964e-3 / 0.35) * 1.24e-6, 10),
                        ],
                        "sentinel_local_bicarbonate_washout_clearance_ratio_at_100p78mg_in_0p42cm3": round(2.40e-8 / ((2.7964e-3 / 0.42) * 1.24e-6), 2),
                        "sentinel_local_bicarbonate_washout_clearance_ratio_range_0p35_to_0p49cm3": [
                            round(2.40e-8 / ((2.7964e-3 / 0.35) * 1.24e-6), 2),
                            round(2.40e-8 / ((2.7964e-3 / 0.49) * 1.24e-6), 2),
                        ],
                        "canonical_68h_sentinel_30000ieq_cao2_mass_mg": round(791.4990 * (30000.0 / 500000.0), 2),
                        "canonical_68h_sentinel_25000_to_35000ieq_cao2_mass_range_mg": [
                            round(791.4990 * (25000.0 / 500000.0), 2),
                            round(791.4990 * (35000.0 / 500000.0), 2),
                        ],
                        "canonical_68h_local_peak_day0_oh_generation_flux_mol_cm3_s": round((21.962290e-3 / 7.0) * 2.831484e-6, 10),
                        "canonical_68h_local_bicarbonate_washout_clearance_ratio": round(2.40e-8 / ((21.962290e-3 / 7.0) * 2.831484e-6), 2),
                        "coimmobilized_catalase_k1_s_inv": 18.0,
                        "catalase_peroxide_scavenging_half_life_ms": round(1000.0 * 0.693147 / 18.0, 2),
                        "two_regime_cao2_inventory_reconciliation_note": (
                            "Reconciles both the mass/kinetics basis and the volume-normalization denominator (AUDIT-REF, AUDIT-REF & L4A-F01 [DEC-054/059/077]): "
                            "(1) Mass & kinetic basis: 100.78 mg (1.3982 mmol CaO2, 2.7964 mmol OH-) at slow 14-day release k_14d = 1.24e-6 s^-1 (t_1/2 = 155.27 h = 6.47 d) supplies Hour-0 O2 demand for 27,881 IEQ at f_chem,0 = 0.45 (r_O2,0 = 0.5 * 1.3982e-3 * 1.24e-6 = 8.6689e-10 mol/s at 6.9095e-14 mol/s/IEQ incl. +15% iEC), "
                            "whereas on the canonical 68.0-h half-life basis (k_ref = 2.8315e-6 s^-1), a 30,000 IEQ (6.0% dose, 12.0 cm^2) sentinel patch requires 47.49 mg CaO2 (0.6589 mmol CaO2, 1.3177 mmol OH-; 44.17 mg at 27,881 IEQ; 39.57-55.40 mg across 25,000-35,000 IEQ), and the full 500,000 IEQ (2,500 IEQ/cm^2, 7.00 cm^3) pouch requires 791.49 mg [791.50 mg / 791.4990 mg exact] (10.9811 mmol CaO2, 21.9623 mmol total OH-, 11.4199 mmol OH- over 72 h); "
                            "(2) Volume-normalization denominator: peak_day0_oh_generation_flux_mol_cm3_s = 4.9536e-10 mol/(cm^3*s) (clearance ratio 48.5x against 2.40e-8 mol/(cm^3*s) bicarbonate washout) dilutes the 100.78 mg sentinel inventory across the full 7.00 cm^3 pouch volume, "
                            "whereas normalizing by the physical sentinel patch volume V_sentinel = 12.0 cm^2 * 0.035 cm = 0.420 cm^3 (0.350-0.490 cm^3 across 10-14 cm^2) yields a true local sentinel OH- generation flux of 8.2561e-9 mol/(cm^3*s) (7.0766e-9 to 9.9072e-9 mol/(cm^3*s), local clearance ratio 2.91x [2.42-3.39x]) at k_14d = 1.24e-6 s^-1, and 8.8837e-9 mol/(cm^3*s) (local clearance ratio 2.70x) on the canonical 68.0-h basis (47.49 mg in 0.420 cm^3 or 791.49 mg in 7.00 cm^3)."
                        ),
                        "mandatory_stage0_gate_0d_0f_qualification": (
                            "Closed-loop 14-day coupon dissolution test must verify interstitial pH <= 7.45 (no local CaCO3 mineralization crust or > 7.60 alkaline boundary layer) "
                            "and interstitial H2O2 <= 2.0 uM across the 72-h post-implant seroma window before pre-anastomosis microvascular sink establishment."
                        ),
                    },
                    "peak_stimulated_vs_reference_ocr_seroma_fick_reconciliation": {
                        "reference_areal_o2_flux_1500_ieq_cm2_mol_cm2_s": 6.75e-11,
                        "max_theoretical_pure_islet_vmax_flux_1500_ieq_cm2_mol_cm2_s": 8.89e-11,
                        "pde_two_sided_total_pure_islet_vmax_flux_1500_ieq_cm2_mol_cm2_s": round(1500.0 * (4.0 / 3.0 * math.pi * (0.0075 ** 3)) * 3.40e-8, 14),
                        "pde_per_face_pure_islet_vmax_flux_1500_ieq_cm2_mol_cm2_s": round(0.5 * 1500.0 * (4.0 / 3.0 * math.pi * (0.0075 ** 3)) * 3.40e-8, 14),
                        "pde_two_sided_total_with_15pct_iec_vmax_flux_1500_ieq_cm2_mol_cm2_s": round(1.15 * 1500.0 * (4.0 / 3.0 * math.pi * (0.0075 ** 3)) * 3.40e-8, 14),
                        "pde_per_face_with_15pct_iec_vmax_flux_1500_ieq_cm2_mol_cm2_s": round(0.5 * 1.15 * 1500.0 * (4.0 / 3.0 * math.pi * (0.0075 ** 3)) * 3.40e-8, 14),
                        "unvascularized_100pct_flux_50um_seroma_drop_at_pde_per_face_pure_4p51e11_mmhg": round((0.5 * 1500.0 * (4.0 / 3.0 * math.pi * (0.0075 ** 3)) * 3.40e-8 * 50.0e-4) / (1.584e-5 * 1.35e-9), 2),
                        "unvascularized_100pct_flux_50um_seroma_drop_at_pde_per_face_plus15pct_iec_5p18e11_mmhg": round((0.5 * 1.15 * 1500.0 * (4.0 / 3.0 * math.pi * (0.0075 ** 3)) * 3.40e-8 * 50.0e-4) / (1.584e-5 * 1.35e-9), 2),
                        "vascularized_32pct_external_flux_50um_seroma_drop_at_pde_per_face_pure_4p51e11_mmhg": round(0.32 * (0.5 * 1500.0 * (4.0 / 3.0 * math.pi * (0.0075 ** 3)) * 3.40e-8 * 50.0e-4) / (1.584e-5 * 1.35e-9), 2),
                        "vascularized_32pct_external_flux_50um_seroma_drop_at_pde_per_face_plus15pct_iec_5p18e11_mmhg": round(0.32 * (0.5 * 1.15 * 1500.0 * (4.0 / 3.0 * math.pi * (0.0075 ** 3)) * 3.40e-8 * 50.0e-4) / (1.584e-5 * 1.35e-9), 2),
                        "critical_seroma_film_thickness_for_15mmhg_drop_at_pde_per_face_pure_um": round((1.584e-5 * 1.35e-9 * 15.0 / (0.5 * 1500.0 * (4.0 / 3.0 * math.pi * (0.0075 ** 3)) * 3.40e-8)) * 1e4, 1),
                        "critical_seroma_film_thickness_for_15mmhg_drop_at_pde_per_face_plus15pct_iec_um": round((1.584e-5 * 1.35e-9 * 15.0 / (0.5 * 1.15 * 1500.0 * (4.0 / 3.0 * math.pi * (0.0075 ** 3)) * 3.40e-8)) * 1e4, 1),
                        "unvascularized_100pct_flux_50um_seroma_drop_at_6p75e11_mmhg": 15.78,
                        "unvascularized_100pct_flux_50um_seroma_drop_at_8p89e11_mmhg": round((8.89e-11 * 50.0e-4) / (1.584e-5 * 1.35e-9), 2),
                        "vascularized_32pct_external_flux_50um_seroma_drop_at_6p75e11_mmhg": 5.05,
                        "vascularized_32pct_external_flux_50um_seroma_drop_at_8p89e11_mmhg": round(0.32 * (8.89e-11 * 50.0e-4) / (1.584e-5 * 1.35e-9), 2),
                        "flux_provenance_and_boundary_symmetry_reconciliation_note": (
                            "Reconciles the parametric Fick seroma fluxes against the Layer-4 PDE V_max = 3.40e-8 mol/(cm^3*s) (V_IEQ = 1.767146e-6 cm^3; L4A-F02 [DEC-077]): "
                            "at sigma = 1,500 IEQ/cm^2, two-sided total pure-islet saturated demand is J_total,pure = sigma * V_IEQ * V_max = 9.0124e-11 mol/(cm^2*s), or J_face,pure = 4.5062e-11 mol/(cm^2*s) per symmetric face "
                            "(with +15% iEC stroma: J_total,+iEC = 1.0364e-10 mol/(cm^2*s), J_face,+iEC = 5.1822e-11 mol/(cm^2*s) per face -> 50 um unvascularized seroma drop = 10.54 mmHg pure / 12.11 mmHg +iEC, 32% vascularized drop = 3.37 mmHg pure / 3.88 mmHg +iEC, critical thickness for 15.0 mmHg drop = 71.2 um pure / 61.9 um +iEC). "
                            "The parametric seroma brackets evaluate: (a) J_basal = 3.90e-11 mol/(cm^2*s) (2.60e-14 mol/s/IEQ per face = 0.7526x PDE +iEC per-face V_max, resting basal-glucose OCR -> 9.12 mmHg at 50 um), "
                            "(b) J_peak = 6.75e-11 mol/(cm^2*s) (4.50e-14 mol/s/IEQ per face = 1.3025x PDE +iEC per-face V_max, high-glucose stimulated peak OCR overdrive -> 15.78 mmHg at 50 um, conservative critical thickness 47.5 um vs 61.9 um PDE +iEC per-face), and "
                            "(c) 8.89e-11 mol/(cm^2*s) (single-face-blocked / one-sided drainage of total two-sided pure-islet demand ~9.0124e-11 mol/(cm^2*s) across one boundary -> 20.78 mmHg unvascularized / 6.65 mmHg vascularized at 50 um)."
                        ),
                    },
                    "pericyte_ng2_pdgfrb_microvessel_stabilization_gate": {
                        "wetlab_endpoint": "obs_vascular_pericyte_ng2_pdgfrb_coverage_pct",
                        "min_day90_ng2_pdgfrb_pericyte_coverage_pct": 70.0,
                        "rationale": "Prevents leaky immature VEGF-driven neovessels and chronic seroma re-accumulation in the outer vascularized hydrogel band (MW-R6-S1-15).",
                    },
                    "day1_to_day28_avascular_bridge_cao2_and_shutoff_audit_muse_r6": {
                        "finding_ids": ["MW-R6-S1-12", "MW-R6-S1-14", "MW-R6-S1-15", "AUDIT-REF", "AUDIT-REF"],
                        "day28_functional_beta_survival_endpoint": "obs_day28_functional_beta_survival_fraction",
                        "min_day28_functional_beta_survival_fraction": 0.80,
                        "stepdown_8mM_to_2mM_insulin_shutoff_ratio_endpoint": "obs_gate0m_8mM_to_2mM_insulin_shutoff_ratio",
                        "max_stepdown_8mM_to_2mM_insulin_shutoff_ratio": 0.20,
                        "pouch_iapp_oligomer_a11_endpoint": "obs_pouch_iapp_oligomer_a11_dot_blot_fold",
                        "max_pouch_iapp_oligomer_a11_dot_blot_fold": 1.50,
                        "film_gt_50um_enforces_dxb_cluster_cap_um": 100.0,
                        "film_gt_50um_enforces_areal_loading_cap_ieq_cm2": 1500.0,
                    },
                },
            },
            "day1_to_day28_avascular_bridge_cao2_and_shutoff_audit_muse_r6": {
                "finding_ids": ["MW-R6-S1-12", "MW-R6-S1-14", "MW-R6-S1-15", "AUDIT-REF", "AUDIT-REF"],
                "day28_functional_beta_survival_endpoint": "obs_day28_functional_beta_survival_fraction",
                "min_day28_functional_beta_survival_fraction": 0.80,
                "stepdown_8mM_to_2mM_insulin_shutoff_ratio_endpoint": "obs_gate0m_8mM_to_2mM_insulin_shutoff_ratio",
                "max_stepdown_8mM_to_2mM_insulin_shutoff_ratio": 0.20,
                "pouch_iapp_oligomer_a11_endpoint": "obs_pouch_iapp_oligomer_a11_dot_blot_fold",
                "max_pouch_iapp_oligomer_a11_dot_blot_fold": 1.50,
                "film_gt_50um_enforces_dxb_cluster_cap_um": 100.0,
                "film_gt_50um_enforces_areal_loading_cap_ieq_cm2": 1500.0,
            },
            "stage0_gate_0f_operational_max_periimplant_fluid_film_um": 50.0,
            "stage0_gate_0f_hard_ceiling_with_closed_suction_drain_um": 80.0,
            "stage0_gate_0d_max_periimplant_fluid_film_um": 80.0,
            "stage0_gate_0d_min_explant_en_bloc_recovery_fraction": 0.99,
            "surgical_mitigation": (
                "Micro-fenestrated ePTFE/PDMS cassette ribs + omental fibrin-tack apposition + 72-h closed-suction micro-drain to keep peri-implant fluid film <= 50 um operationally "
                "(47.5 um pure-seroma 100%-flux 15 mmHg limit; and strictly <= 80 um under vascularized outer-band k_perf >= 0.10 s^-1 with DX-b <= 100/80 um cluster cap and 1,500 IEQ/cm^2 low-load, "
                "where external-budget slab/outer-band pO2 is 20.26 mmHg and live coupled spherical cluster core pO2 is 8.95 mmHg at 80 um clusters [4.71 mmHg at 100 um clusters with 3x capsule resistance, or 5.71 mmHg at 100 um clusters with matched D_caps = D_gel])"
            ),
        },
        "chronic_kperf_and_safasl_microgel_solid_fraction_accounting": {
            "in_vitro_vascularized_hydrogel_kperf_s_inv": 0.25,
            "chronic_day90_50um_fbr_capsule_attenuated_kperf_s_inv": 0.1358,
            "stage0_gate_0d_chronic_kperf_pass_floor_s_inv": 0.10,
            "safasl_sathbd_microgel_volume_fraction_at_1500_ieq_cm2_333cm2": {
                "f_islet": 0.0744,
                "f_iec_pericyte_stroma": 0.0131,
                "f_safasl_sathbd_peg_microgels": 0.0600,
                "f_total_solid_dispersed_phase": 0.1475,
                "f_continuous_aqueous_hydrogel_matrix": 0.8525,
                "max_dispersed_phase_percolation_cap": 0.20,
                "passes_rheological_and_maxwell_diffusivity_budget": True,
            },
        },
    }
    part_b_ode = solve_24h_paracrine_and_whole_body_metabolic_ode(
        pde_regimes=part_a_pde["regimes_simulated"]
    )

    lead_regime = next(r for r in part_a_pde["regimes_simulated"] if r["regime_id"] == "LEAD_CENTRAL_LAMINA_PDMS_CAO2_F045_PLUS_CATALASE")
    part_a_pde["explicit_3d_clumping_and_microbead_h2o2_audit_iip_0019"] = (
        build_explicit_3d_clumping_and_microbead_h2o2_audit_iip_0019(lead_regime)
    )
    part_a_pde["lineage_partitioned_metabolic_rest_and_m101_exclusion_audit"] = (
        build_lineage_partitioned_metabolic_rest_and_m101_exclusion_audit_iip_0021()
    )
    part_a_pde["hurdle4_spatial_oxygen_catalase_and_route_challengers_iip_0025"] = (
        build_hurdle4_spatial_oxygen_catalase_and_route_challengers_iip_0025()
    )
    part_a_pde["measured_potency_dec084_mixture_and_glucagon_audit_iip_0028"] = (
        build_measured_potency_dec084_mixture_and_glucagon_audit_iip_0028()
    )
    part_b_ode["exploratory_two_clock_granule_store_sensitivity_audit_iip_0029"] = (
        build_exploratory_mode_b_v2_granule_sensitivity_audit_iip_0029(part_b_ode)
    )

    atlas = {
        "schema_version": "0.8.0",
        "layer": "Layer 4 — Multi-Scale Tissue, Vascular & Metabolic Digital Twin Plane",
        "status": "NUMERICALLY_INTEGRATED_REACTION_DIFFUSION_PDE_AND_METABOLIC_ODE_TWIN",
        "evidence_class": "mechanistic_numerical_pde_ode_simulation_requiring_wetlab_device_qualification",
        "summary": {
            "active_350um_pouch_volume_at_200cm2_cm3": 7.00,
            "passive_islet_only_capacity_ieq_per_cm2": part_a_algebra["passive_capacity_islet_only_ieq_per_cm2"],
            "passive_with_15pct_iec_stroma_capacity_ieq_per_cm2": part_a_algebra["passive_capacity_with_15pct_iec_stroma_ieq_per_cm2"],
            "lead_pouch_min_po2_14d_mmhg": lead_regime["min_slab_po2_across_14_days_mmhg"],
            "lead_pouch_max_h2o2_uM": lead_regime["max_interstitial_h2o2_uM"],
            "lead_pouch_max_ph": lead_regime["max_interstitial_ph"],
            "metabolic_reference_scope": "REFERENCE_FIXED_FUNCTIONAL_BETA_IEQ_NOT_PDE_DERIVED",
            "metabolic_summary_pde_coupling_applied": False,
            "metabolic_summary_source_pde_regime_id": None,
            "lead_uniform_supply_core_po2_mmhg": lead_regime["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_uniform_supply_120um_core_po2_mmhg"],
            "lead_gel_only_supply_core_po2_mmhg": lead_regime["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_mmhg"],
            "lead_strict_gel_only_numerical_gate_assessment": lead_regime["strict_gel_only_numerical_gate_assessment"],
            "trihormonal_60_30_10_time_in_range_pct": part_b_ode["graft_architectures_compared"][0]["time_in_tight_range_3p9_to_10p0_mM_pct"],
            "trihormonal_60_30_10_min_glucose_mM": part_b_ode["graft_architectures_compared"][0]["min_glucose_mM"],
            "beta_only_min_glucose_mM": part_b_ode["graft_architectures_compared"][1]["min_glucose_mM"],
            "g6pc2_ko_min_glucose_mM": part_b_ode["graft_architectures_compared"][2]["min_glucose_mM"],
        },
        "part_a_exact_oxygen_boundary_value_and_volume_algebra": part_a_algebra,
        "part_a_336h_spatial_reaction_diffusion_pouch_pde": part_a_pde,
        "part_b_24h_trihormonal_paracrine_and_whole_body_metabolic_ode": part_b_ode,
    }

    OUT_PATH.parent.mkdir(parents=True, exist_ok=True)
    with OUT_PATH.open("w", encoding="utf-8") as f:
        json.dump(atlas, f, indent=2)
        f.write("\n")

    print(f"[Layer 4 v0.8.0] Wrote {OUT_PATH.relative_to(REPO_ROOT)}")
    for r in part_a_pde["regimes_simulated"]:
        print(
            f"  [PDE] {r['regime_id']}: min_slab_pO2={r['min_slab_po2_across_14_days_mmhg']} mmHg, "
            f"Dirichlet_upper_bound_120um_core={r['min_120um_cluster_core_po2_mmhg']} mmHg, "
            f"max_H2O2={r['max_interstitial_h2o2_uM']} uM, max_pH={r['max_interstitial_ph']}, pass={r['passes_all_oxygen_peroxide_and_ph_gates']}"
        )
    for g in part_b_ode["graft_architectures_compared"]:
        print(
            f"  [ODE] {g['graft_id']}: TIR={g['time_in_tight_range_3p9_to_10p0_mM_pct']}%, "
            f"min_G={g['min_glucose_mM']} mM ({g['min_glucose_mg_dL']} mg/dL), "
            f"shutoff_t50={g['insulin_secretion_shutoff_half_time_min']} min, "
            f"TBR<3.0mM={g['time_severe_hypoglycemia_lt_3p0_mM_54_mg_dL_pct']}%, pass={g['passes_clinical_glycemic_safety_targets']}"
        )


DESIGN_X_RNLS_SUBTRACTION_RATIONALE_GY026_OLD = (
    "Design X promotes the RNLS-WT / TXNIP-KO subtraction challenger to preserve the full +3.39 mmHg oxygen headroom"
)
DESIGN_X_RNLS_SUBTRACTION_RATIONALE_GY026_NEW = (
    "Design X retains the RNLS-WT / TXNIP-WT chassis (superseded under GY-026 in Wave-6 atomic fold-in) to preserve oxygen headroom"
)


def regenerate_layer4_atlas_gy026(*, verify_live_pde: bool = True) -> Dict[str, Any]:
    """Governed GY-026 Layer-4 regeneration entry point: runs live slab algebra + optional live Design-X
    336h PDE solver (`DESIGN_X_100UM_LAMINA_EPS042_FO_51`) against the baseline atlas to prove exact
    numerical parity, supersedes the two stale TXNIP-KO promotion passages from the single-source-of-truth
    module constant, asserts zero remaining TXNIP-KO promotion text, and writes OUT_PATH."""
    if not OUT_PATH.is_file():
        raise FileNotFoundError(f"Missing baseline Layer-4 atlas for GY-026 regeneration: {OUT_PATH}")
    raw_txt = OUT_PATH.read_text(encoding="utf-8")
    atlas = json.loads(raw_txt)
    live_alg = verify_exact_slab_source_distribution_algebra()
    if atlas.get("part_a_exact_oxygen_boundary_value_and_volume_algebra") != live_alg:
        raise ValueError("Live Layer-4 exact slab algebra diverged from baseline atlas!")
    live_pde_verified = False
    if verify_live_pde:
        a_dx = 100.0 / 350.0
        dx_fo_51_live = _run_single_pouch_pde_regime(
            "DESIGN_X_100UM_LAMINA_EPS042_FO_51",
            0.45,
            "central",
            68.0,
            True,
            0.97,
            release_kinetics_law="first_order",
            nz_override=51,
            demand_spatial_mode="outer_annulus",
            lamina_d_o2_scale=0.42 ** 1.5,
            lamina_half_width_fraction=a_dx,
            _assess_numerical_gate=False,
        )
        ref_dx = atlas["part_a_336h_spatial_reaction_diffusion_pouch_pde"]["design_x_100um_lamina_transport_qualification_v80_018"]["first_order_nz51"]
        live_slab = dx_fo_51_live["min_slab_po2_across_14_days_mmhg"]
        live_core = dx_fo_51_live["wigner_seitz_120um_cluster_pericellular_shell_audit_v80_001"]["two_zone_fv_gel_only_supply_120um_core_po2_mmhg"]
        if abs(live_slab - ref_dx["min_slab_po2_mmhg"]) > 1e-6 or abs(live_core - ref_dx["gel_only_120um_core_po2_mmhg"]) > 1e-6:
            raise ValueError(f"Live Design-X 336h PDE diverged from atlas: live=({live_slab},{live_core}) vs ref={ref_dx}")
        live_pde_verified = True
    occ = raw_txt.count(DESIGN_X_RNLS_SUBTRACTION_RATIONALE_GY026_OLD)
    if occ != 2:
        raise ValueError(f"Expected exactly 2 stale TXNIP-KO rationale passages in Layer-4 atlas, found {occ}")
    updated_txt = raw_txt.replace(
        DESIGN_X_RNLS_SUBTRACTION_RATIONALE_GY026_OLD,
        DESIGN_X_RNLS_SUBTRACTION_RATIONALE_GY026_NEW,
    )
    if "TXNIP-KO" in updated_txt or "TXNIP_KO" in updated_txt:
        raise ValueError("Residual TXNIP-KO token detected in regenerated Layer-4 atlas!")
    json.loads(updated_txt)
    OUT_PATH.write_text(updated_txt, encoding="utf-8")
    return {
        "regenerated_path": str(OUT_PATH),
        "live_algebra_verified": True,
        "live_design_x_336h_pde_verified": live_pde_verified,
        "passages_superseded": occ,
        "residual_txnip_ko_tokens": 0,
    }


if __name__ == "__main__":
    if "--regenerate-gy026" in sys.argv:
        rep = regenerate_layer4_atlas_gy026(verify_live_pde="--algebra-only" not in sys.argv)
        print(json.dumps(rep))
    else:
        main()
