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"],