From 2e4e7838114f78bfa26f9bff5c58fc30e7e6daa3 Mon Sep 17 00:00:00 2001
From: Xuan-Yan Chen
Date: Mon, 23 Nov 2026 18:25:28 +0800
Subject: [PATCH] Fix GitHub GFM inline math delimiter/escape rendering across
READMEs & docs and harden CI guard
---
README.md | 36 ++++-----
docs/BeerLambertReferenceProtocolV1.md | 33 +++-----
docs/PhysicsCorrectionsScopeV1.md | 76 +++++++------------
docs/RetiredModelsV1.md | 4 +-
docs/contracts/README.md | 2 +-
examples/research_1d/README.md | 4 +-
examples/research_2d/README.md | 6 +-
tests/ci/test_markdown_contracts.py | 100 +++++++++++++++++++++----
8 files changed, 150 insertions(+), 111 deletions(-)
diff --git a/README.md b/README.md
index b0af42e8..03e4a56a 100644
--- a/README.md
+++ b/README.md
@@ -141,24 +141,24 @@ All characterisation workflows compile from the same validated device declaratio
| Domain | Experiment / Capability | Primary Module | Output & Physical Checks |
|:-------|:------------------------|:---------------|:-------------------------|
-| **1D Steady & Sweeps** | Illuminated $J\text{–}V$ & direct $V_{\mathrm{oc}}$ | `solarlab.experiments.jv` | $V_{\mathrm{oc}}, J_{\mathrm{sc}}, \mathrm{FF}, \mathrm{PCE}$, interior/contact currents, exact $V_{\mathrm{oc}}$ sign bracket |
-| | Dark diode $J\text{–}V$ | `solarlab.experiments.dark_jv` | Auto-windowed $\ln J\text{–}V$ ideality factor $n_{\mathrm{id}}$ and $J_0$ |
+| **1D Steady & Sweeps** | Illuminated $J\text{-}V$ & direct $V_{\mathrm{oc}}$ | `solarlab.experiments.jv` | $V_{\mathrm{oc}}, J_{\mathrm{sc}}, \mathrm{FF}, \mathrm{PCE}$, interior/contact currents, exact $V_{\mathrm{oc}}$ sign bracket |
+| | Dark diode $J\text{-}V$ | `solarlab.experiments.dark_jv` | Auto-windowed $\ln J\text{-}V$ ideality factor $n_{\mathrm{id}}$ and $J_0$ |
| | Parameter sweeps | `solarlab.sweeps` | Cold-compiled multi-parameter studies with persisted `RunStore` attempts |
-| **1D Dynamic & Open-Circuit** | Waveform / Hysteresis $J\text{–}V$ | `solarlab.experiments.waveform_jv` | Continuous preconditioning + forward/reverse mobile-ion loops, $\mathrm{HI}_{\mathrm{norm}}$, current decomposition |
-| | Suns-$V_{\mathrm{oc}}$ & $V_{\mathrm{oc}}(T)$ | `solarlab.experiments.suns_voc`, `voc_t` | Series-resistance-free pseudo-$J\text{–}V$, pseudo-$\mathrm{FF}$, activation-energy intercept |
+| **1D Dynamic & Open-Circuit** | Waveform / Hysteresis $J\text{-}V$ | `solarlab.experiments.waveform_jv` | Continuous preconditioning + forward/reverse mobile-ion loops, $\mathrm{HI}_{\mathrm{norm}}$, current decomposition |
+| | $\text{Suns-}V_{\mathrm{oc}}$ & $V_{\mathrm{oc}}(T)$ | `solarlab.experiments.suns_voc`, `voc_t` | Series-resistance-free $\text{pseudo-}J\text{-}V$, $\text{pseudo-FF}$, activation-energy intercept |
| | Transient Photovoltage (TPV) | `solarlab.experiments.tpv` | Floating-port Maxwell $J_{\mathrm{cond}} + \partial_t D = 0$ pulse + paired unpulsed drift subtraction |
-| | Frozen-ion degradation | `solarlab.experiments.degradation` | Long-time ionic evolution with zero-diffusivity electronic snapshot $J\text{–}V$ probes |
+| | Frozen-ion degradation | `solarlab.experiments.degradation` | Long-time ionic evolution with zero-diffusivity electronic snapshot $J\text{-}V$ probes |
| **1D Small-Signal AC** | Impedance spectroscopy $Z(\omega)$ | `solarlab.experiments.impedance`, `ionic_impedance` | Exact sparse complex solve $(G + i\omega C)\delta u = b$, Nyquist/Bode, coupled ion & dynamic-defect tangents |
-| | Mott–Schottky ($C\text{–}V$ / $C\text{–}f$) | `solarlab.experiments.mott_schottky` | Depletion $1/C^2$ extraction of $V_{\mathrm{bi}}$ and $N_{\mathrm{eff}}$ |
+| | Mott–Schottky ($C\text{-}V$ / $C\text{-}f$) | `solarlab.experiments.mott_schottky` | Depletion $1/C^2$ extraction of $V_{\mathrm{bi}}$ and $N_{\mathrm{eff}}$ |
| **Spectral & Multi-Junction** | Monochromatic EQE & EL | `solarlab.experiments.eqe`, `el_spectrum` | Coherent TMM or spectral Beer–Lambert $\mathrm{EQE}(\lambda)$, AM1.5G $J_{\mathrm{sc}}$, reciprocity EL |
-| | 2T Monolithic Tandem | `solarlab.experiments.tandem_jv` | Joint 4-region coherent TMM photon budget + series current-matched sub-cell $J\text{–}V$ |
-| **2D & Screening** | 2D $J\text{–}V$ & $V_{\mathrm{oc}}(L_g)$ grain sweep | `solarlab.experiments.two_dimensional` | Exact control-volume grain-boundary SRH overlap, frozen-ion DC or coupled 2D mobile-ion BE |
+| | 2T Monolithic Tandem | `solarlab.experiments.tandem_jv` | Joint 4-region coherent TMM photon budget + series current-matched sub-cell $J\text{-}V$ |
+| **2D & Screening** | 2D $J\text{-}V$ & $V_{\mathrm{oc}}(L_g)$ grain sweep | `solarlab.experiments.two_dimensional` | Exact control-volume grain-boundary SRH overlap, frozen-ion DC or coupled 2D mobile-ion BE |
| | SolarScale material screening | `solarlab.experiments.solarscale`, `evaluation_report` | Candidate ingestion, band-alignment gates, sweep manifests, and publication-gated report packs |
**Web Workstation Layout (`web/`):**
- **Left Rail (`Devices / Results`)** — Switch between active device configurations and stored `RunStore` attempts for multi-curve overlay.
- **Center Pane (`Stack & Parameter Editor`)** — Interactive layer builder, grouped parameter editors (*Geometry, Transport, Recombination & Defects, Ions & Optics, Contacts*), live schema preview, and lossless YAML import/export.
-- **Right Pane (`Experiment Runner & Dockable Plots`)** — Protocol controls, live SSE progress/cancellation, and GoldenLayout Plotly views ($J\text{–}V$, Nyquist/Bode, spatial $\varphi, E, n, p, P$ profiles, and 2D heatmaps).
+- **Right Pane (`Experiment Runner & Dockable Plots`)** — Protocol controls, live SSE progress/cancellation, and GoldenLayout Plotly views ($J\text{-}V$, Nyquist/Bode, spatial $\varphi, E, n, p, P$ profiles, and 2D heatmaps).
---
@@ -169,7 +169,7 @@ All characterisation workflows compile from the same validated device declaratio
### 1. Electrostatics & Contact Potentials
-On 1D ($x \in [0, L]$) or 2D ($(y, x)$) control volumes, electrostatic potential $\varphi$ satisfies Gauss's law with exact sub-face series dielectric capacitance $C_f = \varepsilon_0 / (d_{f,L}/\varepsilon_L + d_{f,R}/\varepsilon_R)$:
+On 1D $x \in [0, L]$ or 2D $(y, x)$ control volumes, electrostatic potential $\varphi$ satisfies Gauss's law with exact sub-face series dielectric capacitance $C_f = \varepsilon_0 / (d_{f,L}/\varepsilon_L + d_{f,R}/\varepsilon_R)$:
$$
-\nabla \cdot \bigl(\varepsilon_0 \varepsilon_r \nabla \varphi\bigr)
@@ -192,10 +192,10 @@ $$
R = \frac{np - n_i^2}{\tau_p(n + n_1) + \tau_n(p + p_1)} + k_{\mathrm{rad}}(np - n_i^2) + (C_n n + C_p p)(np - n_i^2).
$$
-Across abrupt heterojunctions ($\Delta E_c, \Delta E_v \neq 0$), two-sided trace models enforce per-side DOS activities $(n_L/N_{C,L}, n_R/N_{C,R})$, reciprocal Richardson constants $\tilde{A}^* = \min(A^*_L, A^*_R)$, and two-sided single-level or 7-level Gaussian quadrature interface SRH without spurious thermal-equilibrium currents.
+Across abrupt heterojunctions ($\Delta E_c, \Delta E_v \neq 0$), two-sided trace models enforce per-side DOS activities $(n_L/N_{C,L}, n_R/N_{C,R})$, reciprocal Richardson constants $\tilde{A}^{\ast} = \min(A_L^{\ast}, A_R^{\ast})$, and two-sided single-level or 7-level Gaussian quadrature interface SRH without spurious thermal-equilibrium currents.
### 3. Finite-Site Mobile-Ion Migration
-Confined single-domain or multi-domain mobile ions obey blocking boundary conditions ($\mathbf{F}_\alpha \cdot \mathbf{n} = 0$) and steric Poisson–Nernst–Planck fluxes (supporting single positive ions, independent dual ions, or shared-vacancy $\theta = (P_+ + P_-)/P_{\mathrm{lim}}$ populations):
+Confined single-domain or multi-domain mobile ions obey normal-blocking boundary conditions ($F_{\alpha,n} = 0$) and steric Poisson–Nernst–Planck fluxes (supporting single positive ions, independent dual ions, or shared-vacancy $\theta = (P^{+} + P^{-})/P_{\mathrm{lim}}$ populations):
$$
F_P = -D_{\mathrm{ion}}\left[\frac{1}{1 - \theta}\frac{\partial P}{\partial x} + \frac{P}{V_t}\frac{\partial \varphi}{\partial x}\right]
@@ -227,7 +227,7 @@ SolarLab separates **engineering verification**, **external solver alignment**,
Evaluated across all **262** single- and two-parameter sweeps (`scaps_cbo`, `scaps_nt_cbo`, `scaps_nt_et`, bulk/interface $N_t$ & $E_t$, donor doping) using the verbatim partner SCAPS 3.3.10 baseline (`scaps_pvk_xy` + [ScapsAm15g1Sun.spe](reproducibility/ScapsAm15g1Sun.spe), driven by [scaps_native_pvk_xy.py](scripts/benchmarks/scaps_native_pvk_xy.py)) with **zero empirical calibration factors** (`het_recomb_despike = 0`, no work-function offsets, no interface-state attenuation, 7-level Gaussian `PVK/ETL` quadrature, and recalculated flat-band contacts):
- **Convergence & Gate Closure:** `262 / 262` cases converged (`0` solver failures); **`221 / 248` (`89.1%`)** numeric reference points pass **all four** strict pointwise contract gates simultaneously ($V_{\mathrm{oc}}$: `236/248` [`95.2%`], $J_{\mathrm{sc}}$: `239/248` [`96.4%`], $\mathrm{FF}$: `221/248` [`89.1%`], $\mathrm{PCE}$: `235/248` [`94.8%`]), achieving `100%` pass across 11 of the 14 groups (including the full 56-case 2D `scaps_nt_et` grid).
-- **Pointwise Accuracy:** Median $|\Delta V_{\mathrm{oc}}| = 0.60\text{ mV}$ (`P90 = 1.01 mV`, `96.0%` $\le 5\text{ mV}$), median $|\Delta J_{\mathrm{sc}}| = 0.0088\text{ mA cm}^{-2}$, median $|\Delta\mathrm{FF}| = 0.031\%$, and median $|\Delta\mathrm{PCE}| = 0.009\%$.
+- **Pointwise Accuracy:** Median $\lvert\Delta V_{\mathrm{oc}}\rvert = 0.60\text{ mV}$ (`P90 = 1.01 mV`, `96.0%` $\le 5\text{ mV}$), median $\lvert\Delta J_{\mathrm{sc}}\rvert = 0.0088\text{ mA cm}^{-2}$, median $\lvert\Delta\mathrm{FF}\rvert$ of `0.031%`, and median $\lvert\Delta\mathrm{PCE}\rvert$ of `0.009%`.
- **Boundary Regime Localization:** The remaining 27 tolerance-exceeding points localize to steep positive conduction-band spikes ($\Delta E_c \ge +0.30\text{ eV}$ in `scaps_cbo` / `scaps_nt_cbo`, plus high-doping $N_{D,\mathrm{PVK}} = 10^{18}\text{ cm}^{-3}$), where finite-difference mesh placement across the sub-nanometre heterointerface barrier governs S-curve knee sensitivity.
### 2. 45-Case Dynamic Mobile-Ion Hysteresis Benchmark
@@ -238,8 +238,8 @@ Evaluated across all **262** single- and two-parameter sweeps (`scaps_cbo`, `sca
Evaluated across the **45-case** 7-stage preconditioning + forward/reverse scan matrix spanning 6 decades of ion diffusivity, mobile-ion density, and scan rate:
- **Completion & Conservation:** `45 / 45` cases completed (`0` stalls), with maximum relative ionic inventory drift $\le 1.80 \times 10^{-13}$.
-- **Hysteresis Index Parity:** Median $|\Delta\mathrm{HI}_{\mathrm{norm}}| = 5.64 \times 10^{-4}$, with `43 / 45` (**`95.6%`**) within $5 \times 10^{-3}$.
-- **Four-Axis Decoupled Refinement Closure:** Phase 0 operator/conservation gates, time-step axis ($\le 6.3 \times 10^{-8}\text{ W m}^{-2}$), solver-tolerance axis ($\le 4.6 \times 10^{-8}\text{ W m}^{-2}$), and weak-peak $\mathrm{HI}_{\mathrm{normalized}}$ (`2.73e-4 <= 3.33e-4` at 241 nodes) are verified; unnormalized ratio $\mathrm{HI}_P$ at sub-nanometre Debye screening ($L_D \approx 0.54\text{ nm}$ on fixed `tanh` grids) and decoupled 100 s `R1-L2/L3` (`RS-G7`) remain explicitly open research gates.
+- **Hysteresis Index Parity:** Median $\lvert\Delta\mathrm{HI}_{\mathrm{norm}}\rvert = 5.64 \times 10^{-4}$, with `43 / 45` (**`95.6%`**) within $5 \times 10^{-3}$.
+- **Four-Axis Decoupled Refinement Closure:** Phase 0 operator/conservation gates, time-step axis ($\le 6.3 \times 10^{-8}\text{ W m}^{-2}$), solver-tolerance axis ($\le 4.6 \times 10^{-8}\text{ W m}^{-2}$), and weak-peak $\mathrm{HI_{normalized}}$ (`2.73e-4 <= 3.33e-4` at 241 nodes) are verified; unnormalized ratio $\mathrm{HI}_P$ at sub-nanometre Debye screening ($L_D \approx 0.54\text{ nm}$ on fixed `tanh` grids) and decoupled 100 s `R1-L2/L3` (`RS-G7`) remain explicitly open research gates.
---
@@ -250,8 +250,8 @@ Evaluated across the **45-case** 7-stage preconditioning + forward/reverse scan
| Preset ID | Stack Topology | Mobile Ions | Optics | Primary Role |
|:----------|:---------------|:-----------:|:------:|:-------------|
| `classical_pin` | HTL / Absorber / ETL | No | Beer–Lambert | Default CLI & 1D/2D steady-state baseline |
-| `scaps_pvk_xy` | SAM / Perovskite / $\mathrm{C_{60}}$ | No | TMM / Spectral BL | Native zero-fit SCAPS-1D benchmark baseline (`PVK-xy.scaps`) |
-| `scaps_mirror_v2` | Glass / Spiro-OMeTAD / $\mathrm{MAPbI_3}$ / $\mathrm{TiO_2}$ | No | TMM / Spectral BL | Historical PDF-table SCAPS contract stack |
+| `scaps_pvk_xy` | SAM / Perovskite / $\mathrm{C}_{60}$ | No | TMM / Spectral BL | Native zero-fit SCAPS-1D benchmark baseline (`PVK-xy.scaps`) |
+| `scaps_mirror_v2` | Glass / Spiro-OMeTAD / $\mathrm{MAPbI}_3$ / $\mathrm{TiO}_2$ | No | TMM / Spectral BL | Historical PDF-table SCAPS contract stack |
| `calado2016_ion_sweep` | HTL / Perovskite / ETL | Yes | Uniform / BL | Workstation dynamic ion-hysteresis waveform preset |
| `calado2016_fig1f` | Calado 2016 SI Table 1 stack | Yes | Beer–Lambert | Literature scan-rate hysteresis comparison preset |
@@ -264,7 +264,7 @@ An additional **52** YAML device and 2D microstructure test fixtures reside unde
.venv/bin/python scripts/test_all.py
# Static lint, strict typing, package boundary contracts, and schema sync
-.venv/bin/ruff check --no-cache src scripts/test_all.py scripts/generate_configuration_schema.py scripts/ci tests/ci
+.venv/bin/ruff check --no-cache src scripts tests
.venv/bin/mypy --cache-dir /dev/null src/solarlab src/solarlab_server
.venv/bin/lint-imports --no-cache
.venv/bin/python scripts/generate_configuration_schema.py --check
diff --git a/docs/BeerLambertReferenceProtocolV1.md b/docs/BeerLambertReferenceProtocolV1.md
index ac960ad7..c551f91e 100644
--- a/docs/BeerLambertReferenceProtocolV1.md
+++ b/docs/BeerLambertReferenceProtocolV1.md
@@ -14,8 +14,8 @@ node-aligned fixed generation resources:
1. **`beer_lambert` (Monochromatic Scalar Control-Volume Beer–Lambert)**:
- Model ID: `beer_lambert_monochromatic_v1` (`BeerLambertBinding`).
- - Uses per-layer scalar `alpha` [$\text{m}^{-1}$] and device-level scalar
- photon flux `Phi` [$\text{m}^{-2}\,\text{s}^{-1}$] on electrical control
+ - Uses per-layer scalar `alpha` ($\mathrm{m}^{-1}$) and device-level scalar
+ photon flux `Phi` ($\mathrm{m}^{-2}\ \mathrm{s}^{-1}$) on electrical control
volumes.
- Applicable to prescribed monochromatic illumination and analytical
verification benchmarks.
@@ -26,28 +26,15 @@ node-aligned fixed generation resources:
- Uses the same tabulated `k(lambda)` (or constant-index `alpha`), metre
wavelength quadrature, front-prefix optical-only substrate offset, and
`SpectralPhotonFlux` (e.g. ASTM G-173-03 AM1.5G) as spectral TMM, with
- per-layer attenuation
-
- $$
- \alpha_\ell(\lambda) = \frac{4\pi\,k_\ell(\lambda)}{\lambda}
- $$
-
+ per-layer attenuation $\alpha_\ell(\lambda) = 4\pi k_\ell(\lambda) / \lambda$
and cancellation-free control-volume cell absorptance
-
- $$
- A_{\mathrm{cell}}(\lambda) = e^{-\tau_j(\lambda)}\bigl(-\mathrm{expm1}(-\Delta\tau_j(\lambda))\bigr).
- $$
-
+ $A_{\mathrm{cell}}(\lambda) = e^{-\tau_j(\lambda)}\bigl(-\mathrm{expm1}(-\Delta\tau_j(\lambda))\bigr)$.
- Zero front/internal Fresnel reflection ($R(\lambda) = 0$), zero coherent
standing-wave interference, zero dropped multipass fraction, and no
TMM-derived photon-recycling reabsorption.
- Per-wavelength and trapezoid-integrated photon accounting close to machine
precision on arbitrary uniform, stretched (`tanh`), or two-sided trace
- meshes:
-
- $$
- \text{transmitted} + \sum_{\ell}\text{absorbed}_\ell = \text{incident}.
- $$
+ meshes ($\text{transmitted} + \sum_{\ell}\text{absorbed}_\ell = \text{incident}$).
- Optical-only front prefix layers (`role: substrate`, `electrical=False`,
including `incoherent=True` front glass) attenuate the spectrum entering
the electrical stack (`parasitic_absorbed_m2_s`) without creating
@@ -57,10 +44,10 @@ node-aligned fixed generation resources:
reflection) and thick/textured stacks without thin-film Fabry–Pérot cavity
effects. On `scaps_mirror_v2.yaml` (`glass` 1 mm + `spiro_OMeTAD` 20 nm +
`MAPbI3` 800 nm + `TiO2` 25 nm, AM1.5G 300–1000 nm), single-pass spectral
- Beer–Lambert absorbs $q\int G\,\mathrm{d}x \approx 260.14\ \text{A}\,\text{m}^{-2}$
- versus $\approx 235.06\ \text{A}\,\text{m}^{-2}$ for coherent-glass TMM
+ Beer–Lambert absorbs $q\int G\ \mathrm{d}x \approx 260.14\ \text{A}\ \text{m}^{-2}$
+ versus $\approx 235.06\ \text{A}\ \text{m}^{-2}$ for coherent-glass TMM
(legacy SCAPS loader effective `incoherent=False`) and
- $\approx 232.52\ \text{A}\,\text{m}^{-2}$ for front-incoherent-glass TMM
+ $\approx 232.52\ \text{A}\ \text{m}^{-2}$ for front-incoherent-glass TMM
(declared `incoherent=True`), where air/glass and internal Fresnel
reflections reject ~5-10% of incident photons. Conversely, on stacks with a reflective rear contact or thin
absorber where back-reflection doubles path length, TMM can exceed
@@ -95,7 +82,7 @@ node-aligned fixed generation resources:
In historical `archive/wip-beer-lambert` (`658baa84`), switching
`scaps_mirror_v2.yaml` (`N=60` electrical intervals, 200 wavelengths over
300–1000 nm) to `beer_lambert_spectral` steepened front-of-absorber ultraviolet/blue
-generation ($q\int G\,\mathrm{d}x \approx 260.14\ \text{A}\,\text{m}^{-2}$).
+generation ($q\int G\ \mathrm{d}x \approx 260.14\ \text{A}\ \text{m}^{-2}$).
Under the legacy density-variable (`[n, p]` linear concentration) Method-of-Lines
Radau transient (`test_interface_flux_balance.py`), hole concentration at the
absorber front (`node 20` of `N=60`, immediately right of the `HTL/PVK`
@@ -112,7 +99,7 @@ On `solarlab`'s refactored 1D kernel:
$S_{\mathrm{old}}\mathrm{expm1}(\log(c_{\mathrm{new}}/c_{\mathrm{old}}))/\Delta t$,
closing cell-wise and global particle and Maxwell total-current balances on
the `scaps_mirror_v2` `N=60` spectral Beer–Lambert stack across DC steady
- state, forward-bias $J\text{--}V$ operating points, and transient illumination
+ state, forward-bias $J\text{-}V$ operating points, and transient illumination
and voltage steps (`tests/integration/test_spectral_beer_lambert_stress.py`).
---
diff --git a/docs/PhysicsCorrectionsScopeV1.md b/docs/PhysicsCorrectionsScopeV1.md
index 4e51c43b..5157f55f 100644
--- a/docs/PhysicsCorrectionsScopeV1.md
+++ b/docs/PhysicsCorrectionsScopeV1.md
@@ -30,7 +30,7 @@ All prospective **physical** corrections (`P`-class) are quarantined into Stage
| `P08-02a` | 1D/2D non-uniform mesh & heterointerface distance-weighted series dielectric capacitance vs nodal harmonic / arithmetic face means | `P` | Pinned to pre-`P08` (`physical_boundary_two_sided_v1` already uses `series_face_capacitance` at split planes) | `test_p08_02_nonuniform_series_capacitor_dielectric_witness` |
| `P08-02b` | Endpoint half-cell vs full-cell control-volume geometry (`sum(w) == L`) coupled across storage, sources, Poisson, sheet traps & ports | `P` | Pinned to pre-`P08` (`physical_boundary_two_sided_v1` already has `sum(w) == L`) | `test_p08_02_endpoint_control_volume_and_hole_step_rounding_witness` |
| `P08-02c` | `hole_separate_increment` (`BandStepsV1`) `4.0107e-4 A/m^2` binary64 differencing disposition & internal vs PV terminal current sign conventions | `N`/`P` boundary (versioned opt-in / isolated commit) | Pinned to pre-`P08` | `test_p08_02_endpoint_control_volume_and_hole_step_rounding_witness` |
-| `P08-03a` | Heterointerface unequal-DOS ($N_{C,L} \neq N_{C,R}$, $m^*_L \neq m^*_R$) reciprocal Bethe/Richardson TE detailed balance on **bare TE** + deep forward-bias conditioning | `P` | Pinned to pre-`P08` | `test_p08_03_unequal_dos_bare_te_equilibrium_and_unit_scaling_witness` |
+| `P08-03a` | Heterointerface unequal-DOS ($N_{C,L} \neq N_{C,R}$, $m_L^{\ast} \neq m_R^{\ast}$) reciprocal Bethe/Richardson TE detailed balance on **bare TE** + deep forward-bias conditioning | `P` | Pinned to pre-`P08` | `test_p08_03_unequal_dos_bare_te_equilibrium_and_unit_scaling_witness` |
| `P08-03b` | Fixed `5 meV` compatible-reservoir contact thermodynamic gate vs permanent `6.025 meV` SCAPS `inconsistent` historical label (`F08`) | Invariant guard (no gate relaxation) | Unchanged (`5 meV` gate enforced) | `test_p08_03_contact_gate_and_falsified_shared_occupancy_refusals` |
| `P08-03c` | Permanent falsification & pre-solve `CapabilityError` refusal of `interface_shared_occupancy` (1D & 2D) and bulk-node Gaussian $E_t$ occupancy | Falsified / permanently rejected | Refused | `test_p08_03_contact_gate_and_falsified_shared_occupancy_refusals` |
| `P08-04a` | Spectral control-volume Beer–Lambert (`archive/wip-beer-lambert` `658baa84`) + optical photon budget + positive log-activity transient readiness | `P` | Pinned to pre-`P08` | `test_p08_04_spectral_beer_lambert_photon_budget_and_positive_log_activity_witness` |
@@ -44,22 +44,13 @@ All prospective **physical** corrections (`P`-class) are quarantined into Stage
### 3.1 `P08-02a`: Non-Uniform Mesh & Heterointerface Face Permittivity
- **Old Semantics (`devel` @ `0b03de5`):**
- - `PoissonOperator1D.from_harmonic_nodes` (`src/solarlab/physics/electrostatics/poisson.py` L67–80) computes unweighted nodal harmonic face permittivity $\tilde{\varepsilon}_{i+1/2} = 2\varepsilon_{r,i}\varepsilon_{r,i+1}/(\varepsilon_{r,i}+\varepsilon_{r,i+1})$ and $C_{i+1/2} = \varepsilon_0 \tilde{\varepsilon}_{i+1/2}/h_i$ for `INTEGER_ENDPOINT_V1` (`legacy_mol_integer_endpoint_v1`), `HALF_ENDPOINT_V1` (`legacy_twod_half_endpoint_v1`), and extruded 2D stack faces in `CompiledDevice2D` (`src/solarlab/equations/dc_2d.py` L148–149).
+ - `PoissonOperator1D.from_harmonic_nodes` (`src/solarlab/physics/electrostatics/poisson.py` L67–80) computes unweighted nodal harmonic face permittivity $\tilde{\varepsilon} = 2\varepsilon_{r,i}\varepsilon_{r,i+1}/(\varepsilon_{r,i}+\varepsilon_{r,i+1})$ and $C_{i+1/2} = \varepsilon_0 \tilde{\varepsilon}/h_i$ for `INTEGER_ENDPOINT_V1` (`legacy_mol_integer_endpoint_v1`), `HALF_ENDPOINT_V1` (`legacy_twod_half_endpoint_v1`), and extruded 2D stack faces in `CompiledDevice2D` (`src/solarlab/equations/dc_2d.py` L148–149).
- On shared-node grids (`plane.shared_node = k`), `RIGHT_LAYER_WINS` (`src/solarlab/mesh/geometry.py` L312, L325) sets $\varepsilon_r[k] = \varepsilon_R$, polluting the left-layer face $[x_{k-1}, x_k]$ with $\varepsilon_R$.
- Only `TWO_SIDED_TRACE_V1` and `PHYSICAL_BOUNDARY_TWO_SIDED_V1` replace split interface faces with `series_face_capacitance(d_L, eps_L, d_R, eps_R)` (`poisson.py` L109–114).
- **Defect / Counterexample Evidence:**
- 1. *Non-uniform split face ($d_L \neq d_R$, $\varepsilon_L \neq \varepsilon_R$):* Exact Gauss-law continuity $D = -\varepsilon_0 \varepsilon_r \partial_x \phi = \text{const}$ across a planar dielectric boundary splitting face $h = d_L + d_R$ yields the exact series capacitance
-
- $$
- C_{\mathrm{exact}} = \frac{\varepsilon_0}{d_L/\varepsilon_L + d_R/\varepsilon_R}.
- $$
-
- Unweighted `harmonic_face_mean` assumes $d_L = d_R = h/2$, producing an $O(1)$ capacitance and potential error whenever mesh clustering makes $d_L \neq d_R$ across a high-contrast heterointerface (e.g. organic HTL $\varepsilon_1 = 3.0$ vs perovskite $\varepsilon_2 = 25.0$). Arithmetic averaging $0.5(\varepsilon_L + \varepsilon_R)/h$ treats series dielectrics as a parallel capacitor and fails even when $d_L = d_R$.
- 2. *Shared-node `RIGHT_LAYER_WINS` interface shift:* When node $x_k = X_{\text{if}}$ sits on the interface, $[x_{k-1}, x_k]$ lies 100% inside material $L$ ($\varepsilon_L$) and $[x_k, x_{k+1}]$ lies 100% inside material $R$ ($\varepsilon_R$). Setting $\varepsilon_r[k] = \varepsilon_R$ gives $C_{k-1/2} = \varepsilon_0 \frac{2\varepsilon_L\varepsilon_R}{\varepsilon_L+\varepsilon_R} / dx_L$, shifting the effective dielectric boundary by $dx_L / 2$ into layer $L$ across the two adjacent faces:
-
- $$
- C_{k-1/2}^{-1} + C_{k+1/2}^{-1} = \frac{dx_L / 2}{\varepsilon_0 \varepsilon_L} + \frac{dx_L / 2 + dx_R}{\varepsilon_0 \varepsilon_R} \neq \frac{dx_L}{\varepsilon_0 \varepsilon_L} + \frac{dx_R}{\varepsilon_0 \varepsilon_R}.
- $$
+ 1. **Non-uniform split face** ($d_L \neq d_R$, $\varepsilon_L \neq \varepsilon_R$): Exact Gauss-law continuity $D = -\varepsilon_0 \varepsilon_r \partial_x \phi = \text{const}$ across a planar dielectric boundary splitting face $h = d_L + d_R$ yields the exact series capacitance $C_{\mathrm{exact}} = \varepsilon_0 / (d_L/\varepsilon_L + d_R/\varepsilon_R)$. Unweighted `harmonic_face_mean` assumes $d_L = d_R = h/2$, producing an $O(1)$ capacitance and potential error whenever mesh clustering makes $d_L \neq d_R$ across a high-contrast heterointerface (e.g. organic HTL $\varepsilon_1 = 3.0$ vs perovskite $\varepsilon_2 = 25.0$). Arithmetic averaging $0.5(\varepsilon_L + \varepsilon_R)/h$ treats series dielectrics as a parallel capacitor and fails even when $d_L = d_R$.
+ 2. **Shared-node `RIGHT_LAYER_WINS` interface shift:** When node $x_k = X_{\text{if}}$ sits on the interface, $[x_{k-1}, x_k]$ lies 100% inside material $L$ ($\varepsilon_L$) and $[x_k, x_{k+1}]$ lies 100% inside material $R$ ($\varepsilon_R$). Setting $\varepsilon_r[k] = \varepsilon_R$ gives $C_{k-1/2} = \varepsilon_0 \frac{2\varepsilon_L\varepsilon_R}{\varepsilon_L+\varepsilon_R} / dx_L$, shifting the effective dielectric boundary by $dx_L / 2$ into layer $L$ across the two adjacent faces:
+ $C_{k-1/2}^{-1} + C_{k+1/2}^{-1} = \frac{dx_L / 2}{\varepsilon_0 \varepsilon_L} + \frac{dx_L / 2 + dx_R}{\varepsilon_0 \varepsilon_R} \neq \frac{dx_L}{\varepsilon_0 \varepsilon_L} + \frac{dx_R}{\varepsilon_0 \varepsilon_R}$.
- **New Target Semantics:**
- Every 1D and 2D electrostatic face (stack and lateral) uses exact sub-face material-extent series capacitance $C_f = \varepsilon_0 / (d_{f,L}/\varepsilon_L + d_{f,R}/\varepsilon_R)$. Within a homogeneous layer ($\varepsilon_L = \varepsilon_R = \varepsilon$), this reduces identically to $\varepsilon_0 \varepsilon / h_f$; on a shared-node interface $x_k = X_{\text{if}}$, $[x_{k-1}, x_k]$ uses $\varepsilon_L$ over $dx_L$ and $[x_k, x_{k+1}]$ uses $\varepsilon_R$ over $dx_R$.
- **Allowed Scope:** `src/solarlab/discretization/face_average.py`, `src/solarlab/physics/electrostatics/`, `src/solarlab/device/compile_1d.py`, `src/solarlab/device/compile_2d.py`, `src/solarlab/equations/dc_2d.py`, and small-signal/displacement-current observers reading `PoissonOperator1D`.
@@ -67,7 +58,7 @@ All prospective **physical** corrections (`P`-class) are quarantined into Stage
- **Affected Consumers:** 1D/2D DC steady-state, transient displacement current $J_{\text{disp}} = \partial_t D$, Mott–Schottky / geometric capacitance $C(\omega)$, and ionic J–V electrostatic screening.
- **Independent Acceptance Criteria & Expected Direction of Change:**
- Two-layer charge-free capacitor ($\varepsilon_1 \neq \varepsilon_2$) reproduces analytical $\phi(x)$, $D$, and $C_{\text{geom}} = (\sum_\ell L_\ell / (\varepsilon_0 \varepsilon_\ell))^{-1}$ to $\le 10^{-14}$ relative error on arbitrary non-uniform 1D and 2D meshes.
- - Expected physical shift: high-contrast transport/absorber stacks ($\varepsilon_{\text{TL}} \approx 3\text{–}9$, $\varepsilon_{\text{PVK}} \approx 25$) see small, mesh-convergent corrections to high-frequency geometric capacitance $C_{\text{hf}}$ and interfacial voltage partition, vanishing as $O(\Delta x_{\text{if}} / L)$ under refinement.
+ - Expected physical shift: high-contrast transport/absorber stacks ($\varepsilon_{\text{TL}} \approx 3\text{-}9$, $\varepsilon_{\text{PVK}} \approx 25$) see small, mesh-convergent corrections to high-frequency geometric capacitance $C_{\text{hf}}$ and interfacial voltage partition, vanishing as $O(\Delta x_{\text{if}} / L)$ under refinement.
- **Versioning & Commit Isolation Rule:** Single `P`-class commit introducing versioned distance-weighted/layer-true Poisson geometry without simultaneously altering endpoint cell measures, TE normalization, or optical generation.
---
@@ -95,7 +86,7 @@ All prospective **physical** corrections (`P`-class) are quarantined into Stage
### 3.3 `P08-02c`: `hole_separate_increment` (`BandStepsV1`) `4.0107e-4 A/m^2` Rounding Disposition & Current Sign Conventions
- **Old Semantics (`devel` @ `0b03de5`):**
- - `BandStructure.transport_potentials(phi)` (`src/solarlab/physics/transport/drift_diffusion.py` L46; `electrochemical_flux.py` L256) forms nodal hole potential $\psi_{p,i} = \phi_i + \chi_{t,i} + E_{g,t,i}$ ($\approx 5.4\text{–}6.0\text{ V}$) first and then differences $\psi_{p,i+1} - \psi_{p,i}$.
+ - `BandStructure.transport_potentials(phi)` (`src/solarlab/physics/transport/drift_diffusion.py` L46; `electrochemical_flux.py` L256) forms nodal hole potential $\psi_{p,i} = \phi_i + \chi_{t,i} + E_{g,t,i}$ ($\approx 5.4\text{-}6.0\text{ V}$) first and then differences $\psi_{p,i+1} - \psi_{p,i}$.
- **Defect / Counterexample Evidence (`ArchitectureRefactorExecutionV1.md` §12 L784, §19.35 L1621):**
- Because $\chi_t + E_{g,t} \approx 5.5\text{ eV}$ has $\mathrm{ulp}(5.5) = 2^{-50} \approx 8.88\times 10^{-16}\text{ V}$, adding $\chi_t + E_{g,t}$ prior to subtracting adjacent nodes quantizes small intra-layer electrostatic steps $\Delta\phi = \phi_{i+1} - \phi_i$. At heavily doped transport-layer faces ($p \sim 10^{24}\text{ m}^{-3}$, $\Delta x \sim 1\text{ nm}$), that 1-ULP quantization perturbs $J_p$ by $O(10^{-4})\text{ A/m}^2$.
- On the saved SCAPS fixed-state native residual screens (`V1` §19.35 L1621), native summed-potential differencing gave `8.79892088904392e-5 A/m^2` on `Final61` and `4.010734989424907e-4 A/m^2` on `Final121` (exceeding the exact $1/3000\text{ A/m}^2 = 3.3333333333333335\times 10^{-4}\text{ A/m}^2$ screen on `Final121`), whereas `BandStepsV1` (`hole_separate_increment`, forming $(\phi_{i+1}-\phi_i) + (\chi_{t,i+1}-\chi_{t,i}) + (E_{g,t,i+1}-E_{g,t,i})$ before summation in `FullRhs01`) reduced carrier-balance sums to `2.9697029217142876e-5 A/m^2` (`61`) and `1.9735726377304774e-5 A/m^2` (`121`).
@@ -110,35 +101,24 @@ All prospective **physical** corrections (`P`-class) are quarantined into Stage
### 4.1 `P08-03a`: Unequal-DOS / Effective-Mass / Physical-Barrier Thermionic Detailed Balance
- **Old Semantics (`devel` @ `0b03de5`):**
- - Deduplicated 1D TE (`compile_1d.py` L367–398; `thermionic_emission_bound_m2_s` in `src/solarlab/physics/interface_transport/thermionic.py` L173–214 with `dos_norm_m3=None`) evaluates left-layer `A_star` only and computes
-
- $$
- J_{\mathrm{TE,legacy}} = A^* T^2 \left(n_L e^{-\max(\Delta E_t, 0)/V_T} - n_R e^{-\max(-\Delta E_t, 0)/V_T}\right),
- $$
-
- which has unphysical units $\text{A}\cdot\text{m}^{-5}$ ($\sim 10^{28}\text{–}10^{35}$ numerically in SI, rendering $\min(|J_{\text{SG}}|, |J_{\text{TE}}|)$ nearly inert and violating length-unit invariance).
- - Single-DOS `settings.te_physical_norm` (`ArchiveDigest.md` X3; `perovskite-sim/CLAUDE.md` F02) divides by a single $N_{\text{dos}}$ to form $v_R = A^* T^2 / (q N_{\text{dos}})$ [$\text{m/s}$], and is currently refused with `CapabilityError` in `compile_device_1d` (`compile_1d.py` L147).
- - Two-sided trace (`thermionic.py` L438–615 `fermi_dirac_richardson_flux` & `fermi_richardson_flux`; `compile_1d.py` L589–594, L670–698) already resolves per-side $N_{C,L}, N_{C,R}, N_{V,L}, N_{V,R}$, true physical band offsets, and reciprocal $\tilde{A}^* = \min(A^*_L, A^*_R)$.
+ - Deduplicated 1D TE (`compile_1d.py` L367–398; `thermionic_emission_bound_m2_s` in `src/solarlab/physics/interface_transport/thermionic.py` L173–214 with `dos_norm_m3=None`) evaluates left-layer `A_star` only and computes $J_{\mathrm{TE,legacy}} = A^{\ast} T^2 \bigl(n_L e^{-\max(\Delta E_t, 0)/V_T} - n_R e^{-\max(-\Delta E_t, 0)/V_T}\bigr)$, which has unphysical units $\text{A}\cdot\text{m}^{-5}$ ($\sim 10^{28}\text{-}10^{35}$ numerically in SI, rendering $\min(\lvert J_{\text{SG}}\rvert, \lvert J_{\text{TE}}\rvert)$ nearly inert and violating length-unit invariance).
+ - Single-DOS `settings.te_physical_norm` (`ArchiveDigest.md` X3; `perovskite-sim/CLAUDE.md` F02) divides by a single $N_{\text{dos}}$ to form $v_R = A^{\ast} T^2 / (q N_{\text{dos}})$ ($\text{m/s}$), and is currently refused with `CapabilityError` in `compile_device_1d` (`compile_1d.py` L147).
+ - Two-sided trace (`thermionic.py` L438–615 `fermi_dirac_richardson_flux` & `fermi_richardson_flux`; `compile_1d.py` L589–594, L670–698) already resolves per-side $N_{C,L}, N_{C,R}, N_{V,L}, N_{V,R}$, true physical band offsets, and reciprocal $\tilde{A}^{\ast} = \min(A_L^{\ast}, A_R^{\ast})$.
- **Defect / Counterexample Evidence:**
- 1. *Unit-system non-invariance:* Rescaling densities and DOS together ($n \to \lambda n$, $N_C \to \lambda N_C$, e.g. $\text{m}^{-3} \leftrightarrow \text{cm}^{-3}$ with $\lambda = 10^{-6}$) changes `thermionic_emission_bound_m2_s(..., dos_norm_m3=None)` by $\lambda$, whereas physical emission flux $J_{\text{TE}} \propto (n / N_C)$ is strictly scale-invariant.
- 2. *Failure of single-DOS / non-reciprocal $A^*$ on unequal-DOS heterojunctions ($N_{C,L} \neq N_{C,R}$, $m^*_L \neq m^*_R$):* At thermal equilibrium ($E_{F,L} = E_{F,R}$), Boltzmann carrier densities across physical conduction-band step $\Delta E_{\text{step}} = \Delta E_{C,\text{phys}} - (\phi_R - \phi_L)$ satisfy
-
- $$
- \frac{n_L}{N_{C,L}} e^{-\max(\Delta E_{\mathrm{step}}, 0)/V_T} = \frac{n_R}{N_{C,R}} e^{-\max(-\Delta E_{\mathrm{step}}, 0)/V_T}.
- $$
- Evaluating bare TE with physical $\Delta E_{\text{step}}$ and a **single** shared divisor $N_{\text{dos}} = N_{C,L}$ yields a nonzero spurious equilibrium current $\propto (1 - N_{C,R}/N_{C,L})$. Likewise, using side-specific $A^*_L \neq A^*_R$ separately on the forward and reverse legs yields a spurious equilibrium current $\propto (A^*_L - A^*_R)$ because transverse momentum conservation across a specular planar barrier restricts both directions to the smaller phase-space cone $\tilde{A}^* = \min(A^*_L, A^*_R)$ (Bethe/Richardson reciprocity).
- 3. *Historical conditioning failures (`ArchiveDigest.md` X3):* Four prior legacy attempts to flip `te_physical_norm` on by default failed solver conditioning in deep forward injection (`V_max = 3.0 V` non-finite density Newton/Radau steps).
+ 1. **Unit-system non-invariance:** Rescaling densities and DOS together ($n \to \lambda n$, $N_C \to \lambda N_C$, e.g. $\text{m}^{-3} \leftrightarrow \text{cm}^{-3}$ with $\lambda = 10^{-6}$) changes `thermionic_emission_bound_m2_s(..., dos_norm_m3=None)` by $\lambda$, whereas physical emission flux $J_{\text{TE}} \propto (n / N_C)$ is strictly scale-invariant.
+ 2. **Failure of single-DOS / non-reciprocal $A^{\ast}$ on unequal-DOS heterojunctions** ($N_{C,L} \neq N_{C,R}$, $m_L^{\ast} \neq m_R^{\ast}$): At thermal equilibrium ($E_{F,L} = E_{F,R}$), Boltzmann carrier densities across physical conduction-band step $\Delta E_{\text{step}} = \Delta E_{C,\text{phys}} - (\phi_R - \phi_L)$ satisfy $\frac{n_L}{N_{C,L}} e^{-\max(\Delta E_{\mathrm{step}}, 0)/V_T} = \frac{n_R}{N_{C,R}} e^{-\max(-\Delta E_{\mathrm{step}}, 0)/V_T}$. Evaluating bare TE with physical $\Delta E_{\text{step}}$ and a **single** shared divisor $N_{\text{dos}} = N_{C,L}$ yields a nonzero spurious equilibrium current $\propto (1 - N_{C,R}/N_{C,L})$. Likewise, using side-specific $A_L^{\ast} \neq A_R^{\ast}$ separately on the forward and reverse legs yields a spurious equilibrium current $\propto (A_L^{\ast} - A_R^{\ast})$ because transverse momentum conservation across a specular planar barrier restricts both directions to the smaller phase-space cone $\tilde{A}^{\ast} = \min(A_L^{\ast}, A_R^{\ast})$ (Bethe/Richardson reciprocity).
+ 3. **Historical conditioning failures (`ArchiveDigest.md` X3):** Four prior legacy attempts to flip `te_physical_norm` on by default failed solver conditioning in deep forward injection (`V_max = 3.0 V` non-finite density Newton/Radau steps).
- **New Target Semantics:**
- - Interface thermionic transport separates: (1) true physical electrostatic + band-edge barrier $\Delta E_{\text{step}}$, (2) per-side DOS activities $n_L/N_{C,L}, n_R/N_{C,R}$ (or degenerate supply $F_1(\eta - \Delta E_{\text{bar}}/V_T)$), (3) reciprocal effective-mass Richardson constant $\tilde{A}^* = \min(A^*_L, A^*_R)$ (or explicit SCAPS effective-velocity variant `scaps_thermionic_flux` when reproducing SCAPS), (4) explicit transmission $\mathcal{T}$, and (5) cancellation-free electrochemical difference $\Delta E_F / k_B T$.
+ - Interface thermionic transport separates: (1) true physical electrostatic + band-edge barrier $\Delta E_{\text{step}}$, (2) per-side DOS activities $n_L/N_{C,L}, n_R/N_{C,R}$ — or degenerate supply $F_1(\eta - \Delta E_{\mathrm{bar}}/V_T)$ — (3) reciprocal effective-mass Richardson constant $\tilde{A}^{\ast} = \min(A_L^{\ast}, A_R^{\ast})$ (or explicit SCAPS effective-velocity variant `scaps_thermionic_flux` when reproducing SCAPS), (4) explicit transmission $\mathcal{T}$, and (5) cancellation-free electrochemical difference $\Delta E_F / k_B T$.
- **Allowed Scope:** `src/solarlab/physics/interface_transport/`, `src/solarlab/device/compile_1d.py`, `src/solarlab/equations/dc_1d.py`, `src/solarlab/equations/assembly/`, and `solvers/nonlinear/` forward-bias continuation guards if required.
- **Falsification & Non-Regression Boundaries:**
- Must be verified on **bare TE** (direct cross-plane TE kernel without SG `min` masking hiding equilibrium or Jacobian defects).
- Must converge without `NaN`/`Inf` across both photovoltaic ($0 \to V_{oc}$) and deep forward-injection ($V > V_{bi}$, including the historical `V_max = 3.0 V` stress regime or explicit physical contact/series-resistance regime).
- **Affected Consumers:** 1D/2D heterojunction J–V ($V_{oc}$, $FF$, S-kinks across CBO/VBO sweeps), dark diode ideality, C–V / impedance across barriers, and transient open-circuit photovoltage decay.
- **Independent Acceptance Criteria & Expected Direction of Change:**
- - Bare TE equilibrium current $|J_{\text{TE}}(V=0, G=0)| \le 10^{-15} \times J_{\text{one-way}}$ across arbitrary $N_{C,L}/N_{C,R} \in [10^{-2}, 10^2]$ and $m^*_L \neq m^*_R$.
+ - Bare TE equilibrium current $\lvert J_{\text{TE}}(V=0, G=0)\rvert \le 10^{-15} \times J_{\text{one-way}}$ across arbitrary $N_{C,L}/N_{C,R} \in [10^{-2}, 10^2]$ and $m_L^{\ast} \neq m_R^{\ast}$.
- Analytical Jacobian wrt $(\phi, z_n, z_p)$ matches central finite differences to $\le 10^{-8}$ relative Frobenius norm.
- - Expected physical direction: activating physical emission-velocity TE lowers the TE ceiling from inert $\sim 10^{10}\text{ A/m}^2$ to physical $\sim 10^3\text{–}10^5\text{ A/m}^2$, increasing extraction resistance / S-shape sensitivity when $|\Delta E_C|$ or $|\Delta E_V|$ is large.
+ - Expected physical direction: activating physical emission-velocity TE lowers the TE ceiling from inert $\sim 10^{10}\text{ A/m}^2$ to physical $\sim 10^3\text{-}10^5\text{ A/m}^2$, increasing extraction resistance / S-shape sensitivity when $\lvert\Delta E_C\rvert$ or $\lvert\Delta E_V\rvert$ is large.
- **Versioning & Commit Isolation Rule:** Dedicated `P`-class commit with an explicit TE normalization/reciprocity model version; legacy `dos_norm_m3=None` retained only under explicit legacy preset selection.
---
@@ -156,7 +136,7 @@ All prospective **physical** corrections (`P`-class) are quarantined into Stage
- **Falsification Record (`perovskite-sim/CLAUDE.md` L86–89; `Specs/ArchitectureRefactorV1.md` L846–847; `ArchiveDigest.md` L176):**
- `interface_shared_occupancy`: **Falsified** — collapses the SCAPS CBO $V_{oc}$ sweep trend from $734\text{ mV}$ to $203\text{ mV}$ because algebraic trap occupancy evaluated directly on adjacent bulk-node densities ignores electrostatic/band projection to the interface plane.
- - Bulk-node Gaussian $E_t$ defect integration: **Pre-falsified** by the same probe lineage — bulk-node carrier sampling is $E_t$-blind by $6\text{–}13$ orders of magnitude in heterointerface depletion spikes.
+ - Bulk-node Gaussian $E_t$ defect integration: **Pre-falsified** by the same probe lineage — bulk-node carrier sampling is $E_t$-blind by $6\text{-}13$ orders of magnitude in heterointerface depletion spikes.
- `interface_two_sided` (legacy additive mirror channel): Measured exact no-op across 1D sweeps (distinct from `TWO_SIDED_TRACE_V1` QSS trace physics and clamp-passive `two_sided_cross_node` 2D sheet SRH).
- **Mandatory Boundary:** `compile_device_1d`, `compile_device_2d`, and `compile_ionic_device_2d` / `build_two_sided_interface_srh_2d` must continue raising `CapabilityError` before any solve whenever `settings.interface_shared_occupancy=True`. It is permanently excluded from `P08`.
@@ -167,28 +147,28 @@ All prospective **physical** corrections (`P`-class) are quarantined into Stage
### 5.1 `P08-04a`: Spectral Beer–Lambert Re-Introduction (`archive/wip-beer-lambert`)
- **Old Semantics (`devel` @ `0b03de5`):**
- - `src/solarlab/physics/generation/beer_lambert.py` (`BeerLambertBinding`) supports monochromatic scalar or piecewise-constant/nodal $\alpha$ [$\text{m}^{-1}$] with scalar photon flux $\Phi$ [$\text{m}^{-2}\text{s}^{-1}$].
+ - `src/solarlab/physics/generation/beer_lambert.py` (`BeerLambertBinding`) supports monochromatic scalar or piecewise-constant/nodal $\alpha$ ($\text{m}^{-1}$) with scalar photon flux $\Phi$ ($\text{m}^{-2}\ \text{s}^{-1}$).
- `src/solarlab/device/optical_generation.py` (`bind_optical_generation_1d`) binds coherent normal-incidence spectral TMM (`OpticalStackBinding`), requiring optical $(n(\lambda), k(\lambda))$ or constant $(n_{\text{opt}}, \alpha)$ on every layer.
- Wavelength-resolved single-pass Beer–Lambert (`beer_lambert_spectral`) was parked at Git tag `archive/wip-beer-lambert` (`658baa84c5106ad3a4c9946d18a0c2860d9a4bff`, 2026-10-05; `BeerLambertReferenceProtocolV1.md`, `perovskite_sim/physics/beer_lambert_spectral.py`).
- **Defect / Counterexample & Historical Evidence:**
- 1. *Spectral vs scalar Beer–Lambert:* For dispersive semiconductors where $\alpha(\lambda) = 4\pi k(\lambda)/\lambda$ spans $\sim 10^5\text{–}2\times 10^7\text{ m}^{-1}$ across `300–1000 nm`, monochromatic Beer–Lambert using wavelength-averaged $\bar{\alpha}$ overpredicts total absorption by Jensen's inequality ($1 - e^{-\bar{\alpha} L} > \int w_\lambda (1 - e^{-\alpha(\lambda) L})\,d\lambda$), while any effective scalar $\alpha_{\text{eff}}$ tuned to match total absorbed photons $\int G\,dx$ severely underpredicts short-wavelength front-surface peak generation $G(0^+)$.
- 2. *Optical photon budget anchors (`Specs/ArchitectureRefactorV1.md` L880–883; `ArchitectureRefactorExecutionV1.md` L800):*
- - On `scaps_mirror_v2`, control-volume spectral Beer–Lambert yields mesh-independent ($N=30$ and $N=60$) absorbed photon current $q \int G\,dx = 260.14\text{ A/m}^2$, aligning with SCAPS single-pass $J_{sc} \approx 262.8\text{ A/m}^2$, whereas coherent TMM reflectance/interference lowers absorbed photon current to $235.06\text{ A/m}^2$.
+ 1. **Spectral vs scalar Beer–Lambert:** For dispersive semiconductors where $\alpha(\lambda) = 4\pi k(\lambda)/\lambda$ spans $\sim 10^5\text{-}2\times 10^7\text{ m}^{-1}$ across `300–1000 nm`, monochromatic Beer–Lambert using wavelength-averaged $\bar{\alpha}$ overpredicts total absorption by Jensen's inequality ($1 - e^{-\bar{\alpha} L} > \int w_\lambda (1 - e^{-\alpha(\lambda) L})\ \mathrm{d}\lambda$), while any effective scalar $\alpha_{\text{eff}}$ tuned to match total absorbed photons $\int G\ \mathrm{d}x$ severely underpredicts short-wavelength front-surface peak generation $G(0^{+})$.
+ 2. **Optical photon budget anchors (`Specs/ArchitectureRefactorV1.md` L880–883; `ArchitectureRefactorExecutionV1.md` L800):**
+ - On `scaps_mirror_v2`, control-volume spectral Beer–Lambert yields mesh-independent ($N=30$ and $N=60$) absorbed photon current $q \int G\ \mathrm{d}x = 260.14\text{ A/m}^2$, aligning with SCAPS single-pass $J_{sc} \approx 262.8\text{ A/m}^2$, whereas coherent TMM reflectance/interference lowers absorbed photon current to $235.06\text{ A/m}^2$.
- On `scaps_mirror`, true electrical-stack TMM absorbed photon budget is $219.01\text{ A/m}^2$, demonstrating that the historical $231.7\text{ A/m}^2$ baseline over-collected photons relative to the electrical-stack TMM budget.
- 3. *Legacy density-Radau negative-$p$ collapse vs new-kernel positivity (`Specs/ArchitectureRefactorV1.md` L297, L879–885):*
- - On `perovskite_sim` (`658baa84`), switching `scaps_mirror_v2` at $N_{\text{grid}} = 60$ to spectral Beer–Lambert ($q \int G\,dx = 260.14\text{ A/m}^2$, $\sim 10\%$ higher front peak $G$) drove linear-density `solve_ivp(Radau)` to negative hole density ($p < 0$) at absorber-front `node 20`, collapsing step size and hanging `tests/integration/test_interface_flux_balance.py` past `600 s` inside `_dense_num_jac`.
+ 3. **Legacy density-Radau negative $p$ collapse vs new-kernel positivity (`Specs/ArchitectureRefactorV1.md` L297, L879–885):**
+ - On `perovskite_sim` (`658baa84`), switching `scaps_mirror_v2` at $N_{\text{grid}} = 60$ to spectral Beer–Lambert ($q \int G\ \mathrm{d}x = 260.14\text{ A/m}^2$, `~10%` higher front peak $G$) drove linear-density `solve_ivp(Radau)` to negative hole density ($p < 0$) at absorber-front `node 20`, collapsing step size and hanging `tests/integration/test_interface_flux_balance.py` past `600 s` inside `_dense_num_jac`.
- On `solarlab`'s new kernel, `State1D` parameterizes carriers via log-activities $n = n_{\text{ref}}\exp(\Delta\phi/V_T + z_n) > 0$, $p = p_{\text{ref}}\exp(-\Delta\phi/V_T - z_p) > 0$, and `BackwardEuler1DStep` integrates physical inventories via `S_old * expm1(log_ratio) / dt` with `generation_inventory` positive logarithmic seeding (`log1p(dt * G / density)`), structurally excluding $p \le 0$ domain violations.
- **New Target Semantics:**
- Introduce immutable `SpectralBeerLambertBinding` in `src/solarlab/physics/generation/` and wire explicit optical-model selection (`beer_lambert` | `beer_lambert_spectral` | `tmm`) in `config/` + `device/`:
- Per-layer $\alpha_\ell(\lambda) = 4\pi k_\ell(\lambda)/\lambda \ge 0$ integrated exactly over each cell's true optical-depth increment $\Delta\tau_{i,\lambda}$ via $\exp(-\tau_{\text{left}, i,\lambda}) \cdot (-\mathrm{expm1}(-\Delta\tau_{i,\lambda}))$, followed by explicit wavelength quadrature over the declared `SpectralPhotonFlux` resource.
- - Optical-only front `substrate` layers attenuate $\tau_{\text{left}}(\lambda)$ without generating electrical carriers (`electrical=False`), with closed spectral photon budget ($\text{attenuated\_substrate} + \text{absorbed\_electrical} + \text{transmitted} = \Phi_{\text{incident}}$ to `rtol <= 1e-12`).
+ - Optical-only front `substrate` layers attenuate $\tau_{\mathrm{left}}(\lambda)$ without generating electrical carriers (`electrical=False`), with closed spectral photon budget ($\Phi_{\mathrm{sub}} + \Phi_{\mathrm{elec}} + \Phi_{\mathrm{trans}} = \Phi_{\mathrm{incident}}$ to `rtol <= 1e-12`).
- **Allowed Scope:** `src/solarlab/physics/generation/`, `src/solarlab/device/optical_generation.py`, `src/solarlab/device/optical_generation_2d.py`, `src/solarlab/device/compile_1d.py`, `src/solarlab/device/compile_2d.py`, and typed optical-model selector fields in `src/solarlab/config/` + `src/solarlab/device/inputs.py`.
- **Falsification & Non-Regression Boundaries:**
- Must **not** relabel historical TMM runs (`2026-07-02` `FormalVerify.pdf`) or uniform-generation literature benchmarks as spectral Beer–Lambert (`BeerLambertReferenceProtocolV1.md`).
- Must pass the $N_{\text{grid}} = 60$ high-front-generation heterojunction transient / steady-state stress case cleanly in $< 5\text{ s}$ with strict $n > 0, p > 0$ and zero step collapse.
-- **Affected Consumers:** 1D/2D steady & transient J–V, `scaps_mirror_v2` reference studies, Suns-$V_{oc}$, TPV/TPC, and EQE/spectral-response pipelines that opt into single-pass optics.
+- **Affected Consumers:** 1D/2D steady & transient J–V, `scaps_mirror_v2` reference studies, $\text{Suns-}V_{\mathrm{oc}}$, TPV/TPC, and EQE/spectral-response pipelines that opt into single-pass optics.
- **Independent Acceptance Criteria & Expected Direction of Change:**
- - Mesh-independent electrical photon conservation $\sum_i w_i G_i = \int \Phi_\lambda e^{-\tau_{\text{sub}}(\lambda)} (1 - e^{-\tau_{\text{elec}}(\lambda)})\,d\lambda$ to `rtol <= 1e-13` across $N=15, 30, 60, 120$ non-uniform grids.
+ - Mesh-independent electrical photon conservation $\sum_i w_i G_i = \int \Phi_\lambda e^{-\tau_{\mathrm{sub}}(\lambda)} (1 - e^{-\tau_{\mathrm{elec}}(\lambda)})\ \mathrm{d}\lambda$ to `rtol <= 1e-13` across $N=15, 30, 60, 120$ non-uniform grids.
- Expected physical direction: removing air/glass/TCO Fresnel reflection & Fabry–Pérot interference increases `scaps_mirror_v2` absorbed photon current from $235.06\text{ A/m}^2$ (TMM) to $260.14\text{ A/m}^2$ (spectral BL), shifting $J_{sc}$ upward toward single-pass SCAPS ($\sim 262.8\text{ A/m}^2$).
- **Versioning & Commit Isolation Rule:** Isolated `P`-class commit adding `SpectralBeerLambertBinding` (`beer_lambert_spectral_v1`) and explicit `optical_model` selection; monochromatic `beer_lambert` and coherent `tmm` presets remain unchanged unless explicitly version-bumped in a separate preset commit.
@@ -205,7 +185,7 @@ All prospective **physical** corrections (`P`-class) are quarantined into Stage
## 6. Deferred, Non-Smooth & Out-of-Scope Dispositions
1. **`F14` Switching-Surface Non-Smoothness (`R_tot = 0`, Hard TE `min`, Poole–Frenkel `|E| = 0`):**
- - Piecewise kinks at dark radiative/recombination floors (`R_tot == 0`), hard thermionic flux capping (`te_softness == 0.0`, $\min(|J_{\text{SG}}|, |J_{\text{TE}}|)$), and Poole–Frenkel field-assisted mobility ($\exp(\gamma_{\text{PF}}\sqrt{|E|})$ at $|E| = 0$) have discontinuous or singular classical derivatives on their switching manifolds.
+ - Piecewise kinks at dark radiative/recombination floors (`R_tot == 0`), hard thermionic flux capping $\min(\lvert J_{\mathrm{SG}}\rvert, \lvert J_{\mathrm{TE}}\rvert)$ (`te_softness == 0.0`), and Poole–Frenkel field-assisted mobility $\exp(\gamma_{\mathrm{PF}}\sqrt{\lvert E\rvert})$ at $\lvert E\rvert = 0$ have discontinuous or singular classical derivatives on their switching manifolds.
- Current disposition (`P04-12` / `solve_nonlocal_small_signal_1d` / `FieldMobilityCapabilityError`): AC small-signal linearization fails closed with `CapabilityError` on uncertified non-smooth switching surfaces rather than silently returning one-sided subgradients; smooth $C^2$ `compact_support` / `legacy_logistic` TE regularization (`te_softness > 0`) remains explicit opt-in. Any future smooth replacement of Poole–Frenkel near $E=0$ or default `te_softness > 0` requires its own `P`-class commit and convergence/AC verification.
2. **Coupled Time-Domain Electrothermal PDE $T(x, t)$:**
- Static isothermal temperature scaling (`T`, `mu_T_gamma`, `B_rad_T_gamma`, `varshni_alpha`/`varshni_beta`, `E_a_ion`) is bound at compile time (`time_domain_temperature_qualified = False`). Dynamic self-heating / coupled heat-equation PDEs $c_p \partial_t T - \nabla\cdot(\kappa\nabla T) = Q_{\text{Joule}} + Q_{\text{rec}}$ are out of `P08` scope.
@@ -227,7 +207,7 @@ All prospective **physical** corrections (`P`-class) are quarantined into Stage
| `P08-02a` | `electrostatics_face_permittivity` | `electrostatics.face_permittivity@v1` (`nodal_harmonic_dielectric_v1`) | `electrostatics.face_permittivity@v2` (`dielectric_rule="layer_series_capacitance_v2"`) | Replaces unweighted nodal harmonic face permittivity and shared-node right-layer bleed with exact sub-face material-extent series capacitance $C_f = \varepsilon_0 / (d_L/\varepsilon_L + d_R/\varepsilon_R)$ and 2D cell-parallel lateral permittivity. |
| `P08-02b` | `control_volume_geometry` | `mesh.endpoint_control_volume@v1` (`legacy_mol_integer_endpoint_v1` in 1D; `legacy_twod_half_endpoint_v1` in 2D) | `mesh.endpoint_control_volume@v2` (`geometry_name="physical_half_endpoint_v2"` in 1D; `stack_geometry="physical_half_endpoint_v2"` in 2D) | Binds contact half-cells ($w_0 = dx_0/2, w_{N-1} = dx_{N-1}/2$, $\sum_i w_i = L$) simultaneously across storage, mobile ions, optical generation, Poisson contact displacement, and terminal ports. |
| `P08-02c` | `band_step_differencing` | `transport.band_step_differencing@v1` (`legacy_summed_potential_v1`) | `transport.band_step_differencing@v2` (`band_step_mode="hole_separate_increment_v1"`) | Forms $(\Delta\phi + \Delta\chi_t) + \Delta E_{g,t}$ per face before summation in 1D/2D SG transport so $\sim 5.5\text{ eV}$ valence-band offsets do not quantize sub-mV electrostatic steps in binary64. |
-| `P08-03` | `interface_thermionic` | `interface_transport.thermionic_emission@v1` (`legacy_unnormalized_thermionic_v1`) | `prospective_interface_p08@v2` / `prospective_interface_p08_compact_support@v2` (`thermionic_mode="reciprocal_physical_thermionic_v2"`, `combination_mode="harmonic_series" \| "compact_support"`) | Separates unfolded physical band-edge barriers ($\chi_{\text{phys}}, E_{g,\text{phys}}$), per-side DOS activities ($c_L/N_L, c_R/N_R$), reciprocal $\tilde{A}^* = \min(A^*_L, A^*_R)$, transmission $\mathcal{T}$, and cancellation-free `expm1` electrochemical drive across both `deduplicated` and `two_sided_trace` (`statistics="maxwell_boltzmann"`) 1D/2D heterointerfaces. |
+| `P08-03` | `interface_thermionic` | `interface_transport.thermionic_emission@v1` (`legacy_unnormalized_thermionic_v1`) | `prospective_interface_p08@v2` / `prospective_interface_p08_compact_support@v2` (`thermionic_mode="reciprocal_physical_thermionic_v2"`, `combination_mode="harmonic_series" \| "compact_support"`) | Separates unfolded physical band-edge barriers ($\chi_{\mathrm{phys}}, E_{g,\mathrm{phys}}$), per-side DOS activities ($c_L/N_L, c_R/N_R$), reciprocal $\tilde{A}^{\ast} = \min(A_L^{\ast}, A_R^{\ast})$, transmission $\mathcal{T}$, and cancellation-free `expm1` electrochemical drive across both `deduplicated` and `two_sided_trace` (`statistics="maxwell_boltzmann"`) 1D/2D heterointerfaces. |
| `P08-04` | `optical_generation` | `monochromatic_beer_lambert_1d@v1` (`"beer_lambert"` / coherent `"tmm"` per device declaration) | `spectral_control_volume_beer_lambert@v2` (`optical_model="beer_lambert_spectral"`) | Integrates wavelength-resolved $\alpha_\ell(\lambda) = 4\pi k_\ell(\lambda)/\lambda$ over exact physical control-volume optical depths with closed front-substrate + electrical + transmitted photon budget (`rtol <= 1e-12`). |
### 7.2 Identity Separation, Certificate Non-Reuse & Historical Disable Tracking
diff --git a/docs/RetiredModelsV1.md b/docs/RetiredModelsV1.md
index 097827be..db339668 100644
--- a/docs/RetiredModelsV1.md
+++ b/docs/RetiredModelsV1.md
@@ -48,7 +48,7 @@ All 8 legacy notebooks and notebook-style benchmark scripts (`legacy-notebooks`,
| `perovskite-sim/notebooks/DeviceParameterSweep.ipynb` | Ad-hoc 1D parameter-grid sensitivity notebook over thickness/doping/lifetime | Superseded by deterministic `PreparedDevice` rebinding and public sweep orchestration | `solarlab.sweeps`, `solarlab steady-jv` CLI | `tests/unit/materials/test_packaged_resources_and_cli.py`, `tests/refactor/test_legacy_consumer_registration.py` |
| `perovskite-sim/notebooks/ComprehensiveBenchmark.py` | Legacy multi-experiment timing and smoke script across old 1D drivers | Superseded by pinned `PerformanceCasesV1.json` exclusive-CPU benchmark harness | `scripts/benchmarks/p09_candidate_validation.py` | `tests/integration/test_p09_benchmark_and_qualification_hooks.py` |
| `perovskite-sim/notebooks/IonmongerBenchmark.py` | Ad-hoc IonMonger transient J–V comparison script on legacy Radau DAE | Superseded by locked `TransientJvN80` / `TransientJvN200` benchmark & parity suites | `scripts/benchmarks/p09_candidate_validation.py`, `solarlab.experiments.waveform_jv`, `solarlab.experiments.ionic_transient` | `tests/integration/test_p09_benchmark_and_qualification_hooks.py` |
-| `perovskite-sim/notebooks/Phase2CharacterisationBenchmark.py` | Legacy Phase-2 EQE / TPV / Suns-$V_{\text{oc}}$ / dark J–V script | Superseded by public `solarlab.experiments` characterisation drivers | `solarlab.experiments.jv`, `solarlab.experiments.transient`, `solarlab.experiments.eqe`, `solarlab.experiments.tpv`, `solarlab.experiments.suns_voc`, `solarlab.experiments.dark_jv`, `solarlab_server` V2 workstation | `tests/integration/test_p09_benchmark_and_qualification_hooks.py` |
+| `perovskite-sim/notebooks/Phase2CharacterisationBenchmark.py` | Legacy Phase-2 EQE / TPV / $\text{Suns-}V_{\mathrm{oc}}$ / dark J–V script | Superseded by public `solarlab.experiments` characterisation drivers | `solarlab.experiments.jv`, `solarlab.experiments.transient`, `solarlab.experiments.eqe`, `solarlab.experiments.tpv`, `solarlab.experiments.suns_voc`, `solarlab.experiments.dark_jv`, `solarlab_server` V2 workstation | `tests/integration/test_p09_benchmark_and_qualification_hooks.py` |
| `perovskite-sim/notebooks/E2eNotebookVsApi.py` | Ad-hoc script comparing notebook calls against legacy `POST /api/*` FastAPI endpoints | Legacy `/api/*` execution retired (`410 Gone`); V2 HTTP/worker parity verified in runtime CI | `solarlab_server.cli` (`solarlab-server`), `tests/runtime/test_p09_server_cutover.py` | `tests/runtime/test_p09_server_cutover.py` |
---
@@ -83,7 +83,7 @@ The following subsystems and model flags have **zero** active product execution
| `perovskite_sim/solver/{mol,dae*,newton,small_signal}.py` | Linear carrier-density $(n, p)$ method-of-lines / `scipy.integrate.solve_ivp(Radau)` DAE, dense/FD Jacobians, and ad-hoc density floors | **Active product execution retired**; linear-density coordinates suffer positivity/scaling breakdown at high barriers and $O(N^2)$ Jacobian cost | Positive log-activity coordinates $(z_n, z_p)$, exact sparse analytical `Assembler` (`solarlab.equations.assembly`), `solarlab.solvers.nonlinear`, `solarlab.solvers.time`, `solarlab.solvers.linear` | `tests/unit/equations/`, `tests/integration/test_time_method_selection.py` |
| `perovskite_sim/twod/*` (`legacy-2d`) | Legacy 2D finite-difference / ad-hoc sweep solver (`twod/solver_2d.py`, `twod/experiments/jv_sweep_2d.py`, empirical scaling $\beta \approx 3.54$) | **Active product execution retired** (`e87cccff21976a546f516c5169db575824a1b00a`); replaced by sparse 2D control-volume assembly ($\beta \approx 0.9868 < 2.5$, $49.43\times$ speedup at $N_x = 16$) | `solarlab.mesh.geometry_2d`, `solarlab.equations.dc_2d`, `solarlab.solvers.nonlinear.steady_2d`, `solarlab.experiments.two_dimensional` | `tests/unit/assembly/test_production_wiring_2d.py`, `tests/runtime/test_p09_server_cutover.py` |
| `interface_shared_occupancy` (1D & 2D) and unqualified `interface_two_sided` mirror/shared-occupancy channels | Single shared trap occupancy $f$ driven simultaneously by two distinct interface carrier trace pairs without a physical two-sided sheet-state Hamiltonian, plus falsified mirror-trace shortcuts | **Permanently falsified & refused pre-solve (`P08-01` / `P08-03c`)**: violates detailed balance under split quasi-Fermi levels across finite-transport heterointerfaces. Meanwhile, qualified two-sided trace electrostatics + reciprocal Bethe/Richardson TE (`TWO_SIDED_TRACE_V1`, `PHYSICAL_BOUNDARY_TWO_SIDED_V1`, `P08-03a`) are migrated into `solarlab` and `solarlab_research` | Raises `CapabilityError` pre-solve in `compile_device_1d` / `compile_device_2d`; qualified two-sided TE & interface SRH/sheet-charge closures live in `solarlab.physics.interface_transport` and `solarlab.physics.recombination.interface` | `tests/refactor/test_p08_counterexamples.py`, `tests/unit/physics/`, `docs/PhysicsCorrectionsScopeV1.md` §4 |
-| Single-DOS `settings.te_physical_norm` on unequal-DOS heterojunctions (`P08-03a`) | Dividing bare thermionic emission across $N_{C,L} \neq N_{C,R}$ by a single shared DOS $N_{\text{dos}}$ | **Permanently refused (`CapabilityError`)**: creates spurious nonzero thermal-equilibrium current $\propto (1 - N_{C,R}/N_{C,L})$ | Per-side DOS activity + reciprocal $\tilde{A}^* = \min(A^*_L, A^*_R)$ in `solarlab.physics.interface_transport.thermionic` (`P08-03a`) | `tests/refactor/test_p08_counterexamples.py` |
+| Single-DOS `settings.te_physical_norm` on unequal-DOS heterojunctions (`P08-03a`) | Dividing bare thermionic emission across $N_{C,L} \neq N_{C,R}$ by a single shared DOS $N_{\text{dos}}$ | **Permanently refused (`CapabilityError`)**: creates spurious nonzero thermal-equilibrium current $\propto (1 - N_{C,R}/N_{C,L})$ | Per-side DOS activity + reciprocal $\tilde{A}^{\ast} = \min(A_L^{\ast}, A_R^{\ast})$ in `solarlab.physics.interface_transport.thermionic` (`P08-03a`) | `tests/refactor/test_p08_counterexamples.py` |
| Bulk-node Gaussian $E_t$ occupancy integration & incompatible contact work-function overrides (`> 5 meV`, `F08`) | Ad-hoc quadrature over Gaussian energetic disorder on nodal single-level SRH equations; overriding contact $\phi_{\text{contact}}$ incompatible with equilibrium bulk Fermi level by `6.025 meV` | **Permanently refused / retained `inconsistent` (`P08-03b`, `P08-03c`)**: historical `6.025 meV` SCAPS deck remains permanently labeled `inconsistent` (`5 meV` gate never relaxed) | Explicit discrete multi-level / multivalent defect closures in `solarlab.physics.recombination` (`P04-10`); compatible contact reservoir thermodynamics in `solarlab.physics.contacts` | `tests/refactor/test_p08_counterexamples.py`, `docs/PhysicsCorrectionsScopeV1.md` §4.2–4.3 |
---
diff --git a/docs/contracts/README.md b/docs/contracts/README.md
index 607aa537..dcd07874 100644
--- a/docs/contracts/README.md
+++ b/docs/contracts/README.md
@@ -48,7 +48,7 @@ For cross-cutting solver architecture and extension rules, see [../DevelopmentGu
| Specification | Scope |
|:--------------|:------|
| [ExperimentProtocol.md](ExperimentProtocol.md) | Canonical 1D sweep, preconditioning, and measurement protocol semantics |
-| [FrozenIonSnapshotContract.md](FrozenIonSnapshotContract.md) | Zero-diffusivity electronic snapshot $J\text{–}V$ probes during ionic aging |
+| [FrozenIonSnapshotContract.md](FrozenIonSnapshotContract.md) | Zero-diffusivity electronic snapshot $J\text{-}V$ probes during ionic aging |
| [TpvOpenCircuitContract.md](TpvOpenCircuitContract.md) | Floating-port Maxwell total-current open-circuit integration and TPV decay identifiability |
| [IonSweepFigureReference.md](IonSweepFigureReference.md) | Dense mobile-ion waveform reference protocol (`calado2016_ion_sweep`) |
diff --git a/examples/research_1d/README.md b/examples/research_1d/README.md
index baa6705a..7616e842 100644
--- a/examples/research_1d/README.md
+++ b/examples/research_1d/README.md
@@ -40,7 +40,7 @@ All 1D workflows below enforce the same runtime invariants:
| | [shared_site_ionic.py](shared_site_ionic.py) | Coupled dual-ion steady & transient sharing a common vacancy fraction |
| | [immobile_ions.py](immobile_ions.py) | Zero-diffusivity ($D_{\mathrm{ion}} = 0$) exact profile preservation in single and mixed shared-site stacks |
| | [ionic_initialization.py](ionic_initialization.py) | `direct_density_seed_v1` dark-to-illuminated coupled ionic state preparation |
-| | [ionic_jv.py](ionic_jv.py), [ionic_pv.py](ionic_pv.py) | Equilibrium coupled-ion $J\text{–}V$ slices and full 51-point illuminated PV curve ($0 \to 1.25\text{ V}$) |
+| | [ionic_jv.py](ionic_jv.py), [ionic_pv.py](ionic_pv.py) | Equilibrium coupled-ion $J\text{-}V$ slices and full 51-point illuminated PV curve ($0 \to 1.25\text{ V}$) |
| | [multiple_ionic_domains.py](multiple_ionic_domains.py), [multiple_ionic_steady.py](multiple_ionic_steady.py), [multiple_ionic_transient.py](multiple_ionic_transient.py) | Two separated blocking ionic layer domains coupled to one shared electronic mesh (steady & BE transient) |
| **5. Physics Extensions** | [neutral_defects.py](neutral_defects.py) | Explicit neutral single-level bulk SRH defects (including `--unequal-dos` $N_C \neq N_V$ binding) |
| | [field_transport.py](field_transport.py) | Smooth Caughey–Thomas electric-field velocity saturation ($\beta > 1$) in DC assembly |
@@ -93,7 +93,7 @@ voc = solve_direct_voc(compiled, curve, voltage_tolerance_V=1e-6)
.venv/bin/python -B -m examples.research_1d.impedance
```
-### 3. Coupled Shared-Site Mobile Ions (Dark $\to$ Illuminated $J\text{–}V$ $\to$ AC)
+### 3. Coupled Shared-Site Mobile Ions (Dark $\to$ Illuminated $J\text{-}V$ $\to$ AC)
```sh
# 1) Coupled dark steady state + 4-step ramp for shared-site positive & negative ions
diff --git a/examples/research_2d/README.md b/examples/research_2d/README.md
index 32d5388a..318d1895 100644
--- a/examples/research_2d/README.md
+++ b/examples/research_2d/README.md
@@ -12,9 +12,9 @@ For installation, single-thread BLAS environment variables, and the shared `RunS
|:-------|:-------------------------|
| [dc_assembly.py](dc_assembly.py) | Exports 2D $(13 \times 5)$ coordinates, residuals, sparse Jacobian, lateral/vertical fluxes, and 1D uniform-column reduction checks without solving |
| [steady.py](steady.py) | Solves dark and illuminated 2 mV operating points across all $195$ coupled 2D unknowns from a cold 1D continuation seed |
-| [jv.py](jv.py) | Runs a 51-point illuminated 2D steady $J\text{–}V$ sweep ($0 \to 1.25\text{ V}$) with explicit prefix/tail `continue` support |
+| [jv.py](jv.py) | Runs a 51-point illuminated 2D steady $J\text{-}V$ sweep ($0 \to 1.25\text{ V}$) with explicit prefix/tail `continue` support |
| [grains.py](grains.py) | Neutral vertical grain-boundary SRH recombination blended by exact lateral control-volume overlap fraction |
-| [grain_jv.py](grain_jv.py) | Complete 51-point illuminated 2D $J\text{–}V$ sweep on the grain-boundary stack + optional baseline comparison |
+| [grain_jv.py](grain_jv.py) | Complete 51-point illuminated 2D $J\text{-}V$ sweep on the grain-boundary stack + optional baseline comparison |
| [contacts.py](contacts.py) | Four-channel 2D carrier contact algebra (blocking, fixed Dirichlet, and finite-rate Robin exchange) + bounded Newton solve |
| [field_transport.py](field_transport.py) | Normal-face 2D Caughey–Thomas velocity saturation ($\beta = 2$) arithmetic checks and dark 2 mV steady solve |
| [optical_generation.py](optical_generation.py) | 2D half-endpoint control-volume coherent spectral optical source construction and photon-budget check |
@@ -25,7 +25,7 @@ For installation, single-thread BLAS environment variables, and the shared `RunS
## Representative Command Recipes
-### 1. Inspect 2D Assembly, Solve Steady Operating Points & Run 2D $J\text{–}V$
+### 1. Inspect 2D Assembly, Solve Steady Operating Points & Run 2D $J\text{-}V$
```sh
# 1) Export and verify 2D residuals, sparse Jacobian, and 1D uniform reduction
diff --git a/tests/ci/test_markdown_contracts.py b/tests/ci/test_markdown_contracts.py
index f8dd666b..1a371f4c 100644
--- a/tests/ci/test_markdown_contracts.py
+++ b/tests/ci/test_markdown_contracts.py
@@ -1,4 +1,4 @@
-"""CI guards for GitHub MathJax macro compatibility and local Markdown links."""
+"""CI guards for GitHub cmark-gfm / MathJax compatibility and local Markdown links."""
from __future__ import annotations
@@ -21,10 +21,13 @@
"si",
"pu",
"ce",
+ "colorbox",
+ "fcolorbox",
)
MACRO_PATTERN = re.compile(
r"\\(?:" + "|".join(DISALLOWED_MATHJAX_MACROS) + r")\b"
)
+INLINE_CODE_PATTERN = re.compile(r"(`+)([^`]*?)\1")
MD_LINK_PATTERN = re.compile(r"!?\[[^\]]*\]\(([^)]+)\)")
IMG_SRC_PATTERN = re.compile(r'
]*src="([^"]+)"')
@@ -33,6 +36,8 @@
"CLAUDE.md",
"docs/DevelopmentGuide.md",
"docs/RetiredModelsV1.md",
+ "docs/BeerLambertReferenceProtocolV1.md",
+ "docs/PhysicsCorrectionsScopeV1.md",
"docs/contracts/README.md",
"reproducibility/README.md",
"examples/research_1d/README.md",
@@ -62,27 +67,93 @@ def _iter_non_code_lines(path: Path) -> list[tuple[int, str]]:
return lines
+def _check_inline_gfm_math_line(rel: str, lineno: int, line: str) -> list[str]:
+ """Validate cmark-gfm inline $...$ delimiter and backslash-escape invariants."""
+ errors: list[str] = []
+ scrubbed = INLINE_CODE_PATTERN.sub("CODE", line)
+ if "$" not in scrubbed:
+ return errors
+
+ dollar_positions = [
+ m.start() for m in re.finditer(r"(? 0 and scrubbed[s_pos - 1] in "-[" or (
+ s_pos > 0 and scrubbed[s_pos - 1].isalnum()
+ ):
+ errors.append(
+ f"{rel}:{lineno}: invalid character {scrubbed[s_pos - 1]!r} "
+ f"immediately before opening '$' in ${span}$"
+ )
+ if e_pos + 1 < len(scrubbed) and scrubbed[e_pos + 1].isalnum():
+ errors.append(
+ f"{rel}:{lineno}: alphanumeric character {scrubbed[e_pos + 1]!r} "
+ f"immediately after closing '$' in ${span}$"
+ )
+ if span.endswith(")") and e_pos + 1 < len(scrubbed) and scrubbed[e_pos + 1] == ")":
+ errors.append(
+ f"{rel}:{lineno}: cmark-gfm breaks on ')$)' boundary in (${span}$)"
+ )
+ if re.search(r"\\[%,]", span):
+ errors.append(
+ f"{rel}:{lineno}: CommonMark strips backslash in '\\%' or '\\,' "
+ f"inside single-dollar math ${span}$"
+ )
+ if any(ord(ch) > 127 for ch in span):
+ errors.append(
+ f"{rel}:{lineno}: non-ASCII character inside inline math ${span}$"
+ )
+ if span.count("*") >= 2:
+ errors.append(
+ f"{rel}:{lineno}: multiple '*' in inline math ${span}$ "
+ "(use \\ast to prevent GFM emphasis collision)"
+ )
+ if re.search(r"\}_(?=[{\\])", span):
+ brace_underscore_spans += 1
+ if line.lstrip().startswith("|") and re.search(r"(? 0 and scrubbed.count("_") >= 2 and len(dollar_positions) >= 4:
+ errors.append(
+ f"{rel}:{lineno}: '}}_' inside multi-span inline math risks GFM '_' emphasis across '$'"
+ )
+ return errors
+
+
def test_markdown_files_contain_no_disallowed_github_mathjax_macros() -> None:
violations: list[str] = []
for path in _tracked_markdown_files():
rel = path.relative_to(ROOT).as_posix()
+ in_display_math = False
for lineno, line in _iter_non_code_lines(path):
match = MACRO_PATTERN.search(line)
if match is not None:
violations.append(
f"{rel}:{lineno}: disallowed macro {match.group(0)!r}"
)
- stripped = line.strip()
- if "$$" in line and stripped != "$$":
- violations.append(
- f"{rel}:{lineno}: inline/single-line $$ fence (put $$ on its own line)"
- )
- if stripped.startswith("|") and "$" in stripped:
- for span in re.finditer(r"\$(?!\$)(.+?)\$", line):
- if re.search(r"(? None:
doc_path = ROOT / rel
assert doc_path.is_file(), f"missing expected documentation file: {rel}"
for lineno, line in _iter_non_code_lines(doc_path):
+ scrubbed = INLINE_CODE_PATTERN.sub("", line)
targets = [
- *MD_LINK_PATTERN.findall(line),
- *IMG_SRC_PATTERN.findall(line),
+ *MD_LINK_PATTERN.findall(scrubbed),
+ *IMG_SRC_PATTERN.findall(scrubbed),
]
for raw_target in targets:
target = raw_target.strip().strip("<>")