Skip to content

feat(iodine): add 1D coupled iodine chemistry aging model, presets, CLI, and web workstation - #31

Merged
ShaneLogic merged 9 commits into
mainfrom
devel
Nov 25, 2026
Merged

ShaneLogic merged 9 commits into
mainfrom
devel

Conversation

@ShaneLogic

Copy link
Copy Markdown
Owner

Summary

Adds SolarLab's coupled 1D iodine reaction–diffusion–electrostatics perovskite aging subsystem (solarlab.iodine_aging.v1 / solarlab.iodine-deck.v1) built directly on the shared SystemLayout / Assembler / StorageProblem architecture, verified against Bitton & Tessler (Energy Environ. Sci. 16, 2621–2628, 2023) and integrated across CLI, FastAPI server, and Web workstation.

Key Additions (9 commits: 37a5383..bb1a92f)

  1. Constitutive Kinetics, Transport & Sparse Assembly (src/solarlab/physics/chemistry/, src/solarlab/equations/, src/solarlab/device/compile_iodine_1d.py)
    • Coupled 5-reaction $(\mathrm{I}^-, \mathrm{I}^0, \mathrm{I}_2, n, p)$ stoichiometric network with machine-checked charge and elemental iodine nullspace invariants, Wegscheider detailed balance, Smoluchowski diffusion-limited rate factories, softplus / steric coordinate maps, and heterointerface partition fluxes.
    • Online volumetric layer $\mathrm{I}2$ outgassing (volumetric_mol_escape_s_1 / IodineVolumetricEscapeTerm with shared heterointerface seal protection) and outer-contact Faradaic metal corrosion (metal_faradaic_corrosion, $\mathrm{M} + \mathrm{I}^- \to \mathrm{MI}(s) + e^-{\mathrm{metal}}$).
  2. Steady, Variable-Step BDF Aging & Small-Signal AC Impedance (src/solarlab/solvers/, src/solarlab/experiments/)
    • Coupled steady-state homotopy, variable-step BDF-1/BDF-2 long-horizon ($10^4;\mathrm{h}$) time integration with exact per-step elemental iodine conservation accounting (< 2e-8), non-destructive frozen-chemistry & dynamic $J\text{-}V$ checkpoint probes, RunStore / bundle persistence, and mobile vs frozen small-signal AC redox capacitance spectroscopy.
  3. Declarative Presets, CLI, FastAPI Routes & Web Workstation (src/solarlab/cli.py, src/solarlab_server/routes/iodine.py, web/src/panels/iodine-aging.ts)
    • Declarative solarlab.iodine-deck.v1 Pydantic V2 schema (keeping the frozen 20-DTO frontend configuration schema a0b73b19... byte-identical) and 5 packaged YAML presets (bitton_tessler_2023_{blocking,permeable,outgassing,ag_corrosion,self_healing}).
    • New solarlab CLI subcommands (iodine-presets, iodine-steady, iodine-impedance, iodine-aging), solver-free-startup bounded /iodine/* FastAPI routes, and interactive ?view=iodine-aging browser panel.
  4. Contracts, Public API & Documentation
    • Added docs/contracts/IodineReactionAgingContractV1.md (35 normative contracts), updated PublicAPI.json, README.md, and examples/research_1d/.

Verification & Qualification Scope

  • Local root CI (scripts/test_all.py, 8 isolated suites): 4,130 passed, 0 failed, 0 errors
  • Frontend (vitest + tsc && vite build): 965 passed, clean production bundle
  • Static & architecture gates: ruff, mypy (328 files), lint-imports --no-cache (12/12 contracts kept), solarlab check-install --require-no-legacy all green
  • Qualification boundary: All CLI, HTTP, and experiment outputs explicitly retain scientific_qualification = False and scientific_acceptance = "not_evaluated".

@sourcery-ai

sourcery-ai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Sorry @ShaneLogic, your pull request is larger than the review limit of 150,000 diff characters

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T03:10:34.751517Z bb1a92f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb1a92f13b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +810 to +811
manifest_json = json.dumps(manifest, sort_keys=True, separators=(",", ":"))
digest = hashlib.sha256(manifest_json.encode()).hexdigest()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include transport inputs in the compiled device hash

When two direct compile_iodine_device_1d calls reuse the same PreparedDevice and kinetics but differ only in an iodine diffusivity or partition factor, those inputs are absent from this manifest, so the digest stays the same. Since CompiledIodineDevice1D.identity uses this hash and downstream state checks compare it, a state from one transport model can be accepted by another, and persisted physics identities collide. Include the compiled transport and partition inputs in the hash.

Useful? React with 👍 / 👎.

Comment on lines +187 to +188
},
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include BDF controls in the aging protocol hash

If two aging protocols differ only in bdf_options—for example, relative tolerance or maximum order—this payload produces the same hash even though run_iodine_aging_protocol uses those controls for integration. The runs can therefore produce different trajectories while sharing protocol_sha256 and the RunStore execution identity; serialize the BDF options into the hashed document.

Useful? React with 👍 / 👎.

Comment on lines +88 to +92
if effective.aging is not None:
if len(effective.aging.stages) > _MAX_HTTP_STAGES:
raise ValueError(
f"HTTP aging stages ({len(effective.aging.stages)}) exceed {_MAX_HTTP_STAGES}"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Cap HTTP aging checkpoint counts

An /iodine/aging request can provide an arbitrarily large list of unique aging.checkpoint_times_s: the deck schema has no list-length cap, and this HTTP guard limits stages and BDF steps but not checkpoints. The aging runner splits integration at each checkpoint and runs the configured probes for each split, so a single request can trigger unbounded solver and probe work and exhaust server workers; cap the checkpoint count here.

Useful? React with 👍 / 👎.

@ShaneLogic
ShaneLogic merged commit c59f592 into main Nov 25, 2026
35 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant