Skip to content

Establish a current-convergence acceptance criterion for drift-diffusion runs #1

Description

@emircbngl

Summary

The 1D and 2D drift-diffusion solvers stop on the potential-step criterion alone. current_rel_change is measured and recorded, but there is no established acceptance criterion for it.

The current wording is appropriately narrow (potential-step-converged), but the CLI still exits 0 and writes a completed artifact. A caller therefore has no machine verdict for whether the current iteration has settled; exit 4 is reached only when the potential step fails.

This is already acknowledged in AGENTS.md and pinned by test_pn1d_grid_robustness.py, but it has no GitHub issue tracking the missing criterion.

Reproduction

Public main at 5100ab0:

tarhan --format json run solve \
  semiconductor.pn.drift-diffusion.1d.steady \
  --bias 0.1 --output /tmp/tarhan-low

tarhan --format json run solve \
  semiconductor.pn.drift-diffusion.1d.steady \
  --bias 0.4 --output /tmp/tarhan-high

Both commands exit 0 after three Gummel iterations and report potential-step-converged:

bias psi_step current_rel_change
0.1 V 1.2079e-13 3.4901e-04
0.4 V 1.2914e-10 2.7995e-09

The 0.1 V artifact records the distinction honestly:

{
  "solver_status": "potential-step-converged",
  "current_convergence": "measured:3.490e-04"
}

Code path

  • models/pn1d.py: the loop breaks when psi_step < gummel_tol; current_rel_change is diagnostic only.
  • models/pn2d.py: the same stopping structure is used.
  • cli.py: the diagnostic is copied into metrics/provenance, while the successful run remains exit 0.

What this issue does not claim

This is not evidence that either reported current is wrong. In particular, 0.1 V is one of the current-validation points in the capability record. The demonstrated problem is narrower: the solver contract has no current-based acceptance verdict, so potential convergence and current convergence cannot be distinguished by exit status.

Definition of done

  1. Establish a defensible current-convergence metric and threshold for 1D and 2D, including the difficult cases already documented:
    • equilibrium, where net current is a cancellation and a relative change may be undefined;
    • a first/single pass, where there is no previous current;
    • platform-dependent floating-point variation.
  2. Decide how that verdict affects solver_status and EXIT_NO_CONVERGENCE without relabelling the existing phase/potential criterion.
  3. Add negative-control tests showing the criterion rejects a sequence that is still materially changing and accepts a genuinely settled sequence.
  4. Keep the existing measured diagnostic in artifacts so the decision remains auditable.

Until a threshold is established, retaining the current honest potential-step-converged wording is preferable to inventing one from the two measurements above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions