A from-scratch 1-D solver with a full Si p-n junction verification suite
English · 简体中文
A from-scratch 1-D steady-state drift-diffusion–Poisson solver (finite volume, Scharfetter–Gummel links, analytic sparse Jacobian, damped Newton with adaptive bias continuation), verified against closed-form semiconductor theory and against an independent third-party device simulator (NIST Sesame 2.0) — numpy/scipy only, no GPU, no build chain, whole verification suite reproducible in about 50 seconds.
118 collected / 118 passed / 0 skipped (≈23 s) · 9 verification cases (≈93 s) · green on CI for Python 3.10 / 3.12 / 3.13 · MIT (the vendored Sesame part stays 3-clause BSD)
| # | what is checked | measured | verdict |
|---|---|---|---|
| 1 | Thermal equilibrium invariants (V = 0, 1601 nodes) | terminal current 1.63e-26 A/cm², quasi-Fermi flatness 1.77e-15 V, max |np/n_i²−1| = 6.37e-14, V_bi matches the analytic value to 0.0 | ✅ |
| 2 | Forward I-V, 0 → 0.70 V (51 points) | ≤ 4 Newton iterations per point, weighted residual 9.68e-9; ideality 1.58 (low bias) → 1.12 (mid bias); thermal voltage recovered from the ln J – V_j slope within 3.1 % | ✅ |
| 3 | Reverse branch + C-V, 0 → −0.70 V (71 points) | depletion width from ε/C within 1.67 % of the analytic value; Mott–Schottky R² = 0.99977 (effective doping 6.5 % off); SRH generation reaches 0.99999 of its theoretical ceiling | ✅ |
| 4 | Mesh independence, 201 → 3201 nodes | observed order 1.95 (J@0.60) / 1.99 (W); 1601 vs 3201 differ by 1.8e-5 / 3.3e-5. Boundary of validity: this device and this mesh template. The J@0.30 difference has dropped to the 7.2e-8 solver noise floor, so its order is distorted (4.52) and is not used as a criterion. | ✅ 2nd order |
| 5 | Cross-check vs NIST Sesame 2.0, identical inputs, 23 bias points | max relative deviation of terminal current 2.85e-4, median 1.29e-6; J(0.60 V) = −0.8014472 vs −0.8014469 A/cm²; this solver is 8.6× faster on this machine. This case compares the terminal current alone — the internal profiles are compared in case 7; both codes share the same model set, so this layer says nothing about model completeness, and reference truth stays with L1. | ✅ |
| 6 | Realistic silicon (Arora mobility + Slotboom band-gap narrowing) | V_bi drops 21.3 mV, local n_i ×1.60, J_s ×1.90, J(0.60 V) ×1.54; equilibrium invariant stays at 7.99e-14 | ✅ |
| 7 | Cross-check of the internal profiles vs NIST Sesame 2.0 (same node array, same inputs, 4 biases: −0.60 / 0 / 0.30 / 0.60 V) | max potential difference 1.29e-8 V; max relative density deviation 7.91e-9 at equilibrium and reverse bias; bulk-region field deviation 1.50e-7. The two potentials differ by the constant −4.615497472 V, which matches the analytic intrinsic-level reference bit for bit (error 0.0) and does not drift with bias (spread 0.0). Forward density deviation 1.48e-3, peaking at the contact (x = 119.6 µm); refining the mesh to 1601 nodes makes it larger, not smaller (8.50e-4 → 1.76e-3) — a contact/scheme premise difference, not a resolution limit | ✅ |
| 8 | Transient slab: two analytic time constants + integrator order (the exam the solver now has to pass after gaining a time term) | measured relative error 4.0e-7 / 2.0e-5 for the dielectric-relaxation rate σ/ε (τ = 47.9 fs) and the plasma-mode rate 1/τ + D_a k² (τ = 9.92 ns) — five orders of magnitude apart, each with its own step size and tolerance (tolerances taken from a scan, not from taste); measured θ-scheme convergence orders 0.98 (BE, theory 1) / 2.01 (CN, theory 2); single-exponential decay (fit rms ≤ 2.8e-6) with the extracted rate insensitive to fit window, perturbation amplitude and tolerance; an injection scan bounds the linear regime (rate/λ > 0.99999 up to Δn = 1e12 cm⁻³; ignoring the ambipolar diffusion term would err by 8.5e-3, above the 5e-3 gate — it cannot be dropped); displacement-current invariant: particle current alone is non-uniform to 1.0000264, adding ε dE/dt brings it to 5.29e-5 (×1.9e4) and the two terms sum to nothing by mirror symmetry (4.1e-13) | ✅ (all 23 gates pass) |
| 9 | Junction turn-off: 0.60 V → −0.60 V voltage step (switching behaviour) | the displacement current makes the total current uniform over the extraction plateau to 6.4e-10 (particle current alone: 0.445 — a 7e8× improvement); carrier bookkeeping closes to 8.8e-10 / 1.0e-10; the long chain lands on the cold steady solve (potential 6.9e-8 V, excess sheet charge 8.1e-5); the plateau matches the parameter-free forward sheet-conductance prediction to 1.2%; extracted charge converges at temporal order 1.00 and spatial order 2.08; all 14 gates pass | ✅ (all 14 gates pass) |
| 10 | Unit tests | 118 collected / 118 passed / 0 skipped, incl. analytic-vs-finite-difference Jacobian, a band-gap-narrowing generalised-SG regression test, an exact-degeneracy assertion when narrowing is absent, 8 Sesame profile-agreement assertions and transient modal / time-discretisation-map tests | ✅ |
| 11 | Reproduction cost | all nine cases ≈93 s (≈9 s with --fast); every product is a local CSV/PNG/JSON |
✅ |
Scale check, Si p-n junction (N_D = 1e17, N_A = 1e16 cm⁻³, 300 K): V_bi = 0.78013 V, W(0) = 0.3331 µm, E_max(0) = 4.68e4 V/cm, L_n = 5.91 µm, L_p = 3.52 µm, J_s = 7.87e-11 A/cm².
| Forward I-V | Ideality factor | Depletion / C-V | Mesh convergence |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
| Equilibrium profiles | Band diagram | Sesame cross-check | Realistic vs ideal Si |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
| Sesame profile cross-check: potential / density / field at 0.60 V |
|---|
![]() |
Figure text is English: matplotlib uses the default font, so Chinese labels would render as boxes in a clean container without a CJK font.
pip install -r requirements.txt
python scripts/run_all.py # all nine verification cases, ≈93 s -> data/ figures/ + summary table
python scripts/run_all.py --fast # skip the mesh study, the Sesame cross-checks and the transient slab, ≈9 s
python scripts/run_all.py --only 2 5 # selected cases only
python -m pytest -q # 118 tests, ≈23 sEach case also runs standalone and prints its metrics, e.g. python scripts/case1_equilibrium.py.
pip install -e . works too (src/p5dd), but the scripts and the test suite insert src/
into sys.path themselves, so a plain clone runs everything with no install step.
Products: data/metrics_caseN.json (structured metrics — every number quoted here is read
back from these files), data/caseN_*.csv (per-bias / per-node data), figures/caseN_*.png
(13 figures), data/summary.json (rollup with per-case wall clock).
Six concrete jobs, each with a runnable entry point (CPU only, numpy/scipy only, no build chain, no external data):
| Job | Entry point |
|---|---|
| Call the solver as a library (solve one bias point, sweep an I-V curve, read the dimensional physical state) | p5dd.DDSolver.solve_point / .iv_sweep / .physical_state / .currents · src/p5dd/solver.py |
| Reproduce the three evidence layers (L1 analytic invariants → L2 mesh independence → L3 third-party cross-check) | python scripts/run_all.py · L1: scripts/case1_equilibrium.py, scripts/case2_forward_iv.py, scripts/case3_reverse_cv.py · L2: scripts/case4_mesh_convergence.py · L3: scripts/case5_sesame_crosscheck.py, scripts/case7_sesame_profiles.py |
| Use the analytic references and post-processing on their own (V_bi, depletion, Shockley, C = dQ/dV, Mott–Schottky) | p5dd.built_in_potential, p5dd.depletion, p5dd.shockley, p5dd.mott_schottky · src/p5dd/theory.py, src/p5dd/analysis.py |
| Study mesh convergence and benchmark this device (201 → 3201 nodes, observed order) | scripts/case4_mesh_convergence.py · tests/test_mesh_convergence.py · data/metrics_case4.json |
| Reproduce the transient / switching behaviour (dielectric and plasma modes, a 0.60 → −0.60 V turn-off) | scripts/case8_slab_time_constants.py · scripts/case9_turnoff.py · src/p5dd/transients.py |
| Validate somebody else's solver against this one (same node array, same inputs, per-point deviations published) | reference/PROVENANCE.md · data/case5_sesame_crosscheck.csv · data/case7_sesame_profiles.csv |
Typical uses: (1) a reference implementation to check a new drift-diffusion discretisation against; (2) a reproducibility harness for a semiconductor-device paper — one command, ≈93 s; (3) teaching material for a numerical-devices course, since the L1 invariants and the L2 observed order are the two things a reader can measure on day one; (4) a pre-flight check before trusting a third-party TCAD number on this device.
Everything runs offline: python -m pytest -q (118 tests, ≈23 s) needs no dataset and no build
chain — requirements.txt is numpy + scipy + matplotlib + pytest. The Sesame cross-check is
optional (its copy is vendored under reference/); without it 12 tests skip, and skips are never
counted as passes. CI runs the test suite and all nine cases on
Python 3.10 / 3.12 / 3.13 on Linux and Windows (.github/workflows/ci.yml).
import sys; sys.path.insert(0, "src")
import numpy as np
from p5dd import DDSolver, reference_device, realistic_device
dev = reference_device(n_nodes=1601) # constant mobility, no BGN -> comparable to analytics/Sesame
sol = DDSolver(dev, tol=1e-8)
u, rep = sol.solve_point(0.0) # rep: iterations / residual / converged / backtracks
st = sol.physical_state(u) # x, psi, n, p, E, Jn, Jp, J, Ec, Ev, Ei, Ef (dimensional)
Jn, Jp = sol.currents(u) # link currents [A/cm^2]
print(sol.total_current(u)) # terminal current [A/cm^2]
U, J, reps = sol.iv_sweep(np.arange(0.0, 0.71, 0.02)) # adaptive bias continuationSign convention: the n-side is at x = 0, so forward bias is a negative terminal current
(conventional current flows from the p contact to the n contact inside the device).
theory.shockley() uses the same convention and can be compared point by point.
Analytic references and post-processing are importable on their own:
built_in_potential, depletion, minority_transport, saturation_current, shockley,
ideality_factor, peak_field, depletion_charge, capacitance, mott_schottky,
expected_capacitance, net_recombination_rate.
Unknowns. Dual-potential (Slotboom) variables psi, phi_n, phi_p in units of V_t, with
n = r_ni·exp(psi − phi_n) and p = r_ni·exp(phi_p − psi). Densities are carried in
exponential form, so they are strictly positive — no negative-density or underflow
failure at large bias. Ohmic contacts pin phi_n, phi_p and psi together, which is
equivalent to pinning both carrier densities, but every boundary row is O(1) instead of 1e-15.
Fluxes: Scharfetter–Gummel links. A SG link is the exact integral of the
drift-diffusion ODE across one link assuming a linear potential drop inside it; its
coefficient is the Bernoulli function. The property that matters: when the quasi-Fermi level
is constant, the discrete flux is identically zero, so zero current at equilibrium and
np = n_i² are analytic properties of the scheme rather than something tuned. That is why
case 1 reaches 1e-14.
Band-gap narrowing requires the generalised SG. If n_i varies with position, the
equilibrium density ratio becomes n_R/n_L = (n_iR/n_iL)·exp(Δpsi), so a bare Δpsi no
longer reproduces the Boltzmann factor: a naive scheme leaves a spurious flux at the doping
step and breaks np = n_i(x)². This implementation takes the Bernoulli argument as
Δpsi + Δln n_i for electrons, Δpsi − Δln n_i for holes
(src/p5dd/solver.py), and B(−x)/B(x) = e^x then proves both link
currents vanish for any n_i(x). Regression test in
tests/test_equilibrium.py: the realistic device's equilibrium
violation goes from 0.125 to 7.99e-14 and Newton from 5 to 4 iterations; without band-gap
narrowing the generalisation is provably inert (_dln_ni == 0 node by node), so the
reference device is bit-for-bit unchanged.
Mesh. Nodes are placed at equal arc length in the 1/h metric: 4 nm near the junction,
50 nm in the neutral regions, neighbour ratio < 1.15 (no abrupt grading), and doubling the
node count halves both h_min and h_max — which is what makes case 4's observed order a clean
second order.
Linear algebra. Analytic sparse Jacobian (per-link Bernoulli derivatives + SRH chain
rule), scipy.sparse.linalg.spsolve; damped Newton with an infinity-norm step cap
du_cap = 4 V_t so the first step cannot push the Slotboom exponent out of range, plus
backtracking on the same directional residual.
Stopping criterion. Term-scaled weighted infinity norm max|F_i|/s_i, where s_i is the
sum of the magnitudes of that equation's own terms (floor 1) and the weights are frozen
within a Newton step. This makes the criterion mesh-independent — an absolute residual
amplified by 1/h² cannot express "how well equilibrium is satisfied". The achievable floor
is set by the sparse LU (≈3e-9 at 1601 nodes), i.e. terminal-current error < 1e-6 A/cm².
Bias sweeps. Adaptive continuation halves the step on failure (down to 1e-13 V), so every
point from 0 to 0.70 V converges in ≤ 4 Newton iterations with no manual tuning; tightening
du_cap to 0.5 still converges to the same state.
The reusable output here is the framework, not a device result, so every claim states its layer. Rules: reports/technical-report.md §1.2–§1.5 (Chinese), checked criterion by criterion in reports/acceptance-checklist.md (Chinese).
| layer | evidence | status | what it does not prove |
|---|---|---|---|
| L1 | analytic invariants: zero equilibrium current, flat quasi-Fermi levels, np = n_i², V_bi / W / E_max against closed forms |
mandatory floor | model completeness — it certifies the discretisation, not the physics you chose |
| L2 | mesh independence over 5 grids, observed order ≈ 2 | mandatory floor | that the converged limit is the right answer |
| L3 | vs NIST Sesame 2.0 on identical inputs: terminal current over 23 bias points (case 5) plus the internal profiles — potential, n, p, electric field — at 4 biases (case 7) | bonus | any independent ground truth — independent code ≠ independent validation chain; and because both codes share the same model set, this layer has zero power over model completeness |
Gate: an L1 or L2 failure means the deliverable fails and L3 cannot compensate; L3 missing
alone means "external consistency unproven", not "rejected". A cross-check is only
meaningful under stated premises (same mesh, doping, material constants, boundary conditions,
tolerances, model set). Here the contact treatment (Dirichlet dual potentials vs contact_S
surface recombination velocities) and the residual norm/tolerance are only approximately
equivalent — which is precisely where the observed 2.85e-4 deviation sits (near-zero current,
small reverse bias). Premises P1–P6 are declared item by item in §1.3.
Two measurements that qualify that 2.85e-4 headline:
- It is not one of the |J| > 1e-3 gated numbers. The case-5 full-sweep metric gates on
|J_ref| > 1e-12(scripts/case5_sesame_crosscheck.py:67), deliberately kept loose so almost all 23 bias points participate (22 comparable; only the 8e-27 A/cm² point at V = 0 is excluded). Recomputing the maximum inside the |J| > 1e-3 gate used by every other relative metric here (10 points) gives 1.60e-6, straight from data/case5_sesame_crosscheck.csv. - The full-sweep maximum is not version-determined; it flips between two values.
Run 39049024057 (before case 7): 9.15e-5 on 3.10 and 3.13, 2.85e-4 on 3.12.
Run 39052802145 (with case 7): 2.85e-4 on 3.10 and 9.15e-5 on 3.12 and 3.13 —
the same interpreter took the other run's value, while each of the two values reproduces
digit for digit. So it is which node wins the argmax at |J| ≈ 1.7e-7 A/cm² flipping in the
last digits, not a systematic difference. The median agrees across both runs at 1.292e-6
(relative difference 1.2e-5) and
agree_to_3_digitsis display-only — no assertion depends on it. No criterion changes. By contrast, case 7's profile criteria stay stable to more than 7 significant digits across all three versions and this machine (technical report §6).
Skips are never counted as passes: without reference/, the suite reports 89 passed /
12 skipped, and both case 5 and case 7 vanish; that state is labelled "not executed", not
"passed".
Case 5 proves that two codes agree on one scalar per bias point. Different internal
distributions can integrate to the same scalar, so that layer never touched the shape of
the solution. Case 7 reads Sesame's converged internal state back (IVcurve pickles every
sweep point as .gzip; load_sim + Analyzer return n, p and potential) and compares it
node-by-node on the same mesh array. It required no change to the vendored code — only its
public API — so the byte-exact SHA-256 promise above still holds.
Six thresholds are declared in GATES before any number is read off them, but they answer
four different questions rather than one "error < x":
- The potential zero is a gauge, not physics. Sesame references its potential to the
intrinsic level of the homogeneous neutral region, this solver to its own electrostatic
potential, so the two must differ by the constant
−(χ + E_g/2 + (V_t/2)·ln(N_c/N_v)). Measured offset: −4.615497472 V, agreeing with that analytic value to 0.0, and invariant across all four biases (spread 0.0). After removing the constant, the node-wise potential difference is at most 1.29e-8 V. This criterion is what makes the comparison a comparison of the same physical quantity rather than of two independently drifting curves. - Equilibrium and reverse bias are precision: max relative density deviation 7.91e-9, field 3.2e-9 — the same order as the case-1 L1 invariants. Two independent implementations drive the same thermal-equilibrium solution to the noise floor.
- Forward bias is a premise difference, and it is localised: density deviation 1.48e-3
(0.30 V) and 8.5e-4 (0.60 V), peaking at the p-contact (x = 119.6 µm); refining to 1601
nodes makes that point worse (8.50e-4 → 1.76e-3) while the bulk stays at 2.2e-5. So it is
the contact model (Dirichlet dual potentials vs
contact_Ssurface velocities), not the discretisation. One of the 8 new tests asserts "contact deviation > 10× bulk deviation", which turns that sentence into an executable criterion instead of explanatory prose. - The field is precision: with the identical edge-difference stencil (Sesame does not output field, so both codes must difference their own potential), bulk relative deviation 1.50e-7, max absolute difference 8.0e-4 V/cm.
So L3 does not depend on one machine, everything needed to re-check it lives in this repository (reference/PROVENANCE.md):
| item | value |
|---|---|
| reference code | NIST Sesame 2.0 (reference/sesame/sesame/_version.py, and sesame.__version__ at run time) |
| how obtained | vendored, not pip-installed (pip show sesame → not found), so no version ambiguity for a reviewer |
| modifications | none in any retained file; LICENSE.rst / AUTHORS.rst and per-file copyright headers verbatim. doc/, examples/, test_suite/ (no solver code) were removed to keep the repository near 4 MB |
| integrity digest | 24 shipped .py files → SHA-256 fa1698474ee02d89c632761742c122df5e8f3a13cbe0f68fdcf9f8a481f1ee30; complete pre-trim copy (44 .py) → b1b093cf389a487b8d249b9b782e6343ca17aeb36272c94054ccca851cca9cb0 |
| raw point data | data/case5_sesame_crosscheck.csv — 23 rows (V_V, J_self_A_cm-2, J_sesame_A_cm-2, rel_dev), so the deviation is recomputable without running any solver; data/case7_sesame_profiles.csv — per-node profiles (801 rows per bias: x, n / p / potential from each code, field from each code), so every deviation quoted above is recomputable offline |
| dependency isolation | the solver core never imports Sesame; only devices.sesame_system() and the case-5/7 scripts do |
| was the vendored code touched | no. Case 7 reads Sesame's internal state through its public API (IVcurve → load_sim → Analyzer); nothing under reference/ was added or modified, so the SHA-256 digest above still holds after case 7 was added |
# check the vendored reference against the digest above
cd reference/sesame && find . -name "*.py" -type f | sort | xargs cat | sha256sumThe three evidence layers above are also importable as one structured report, so the same
declared criteria can be pointed at a foreign solver without copying this repository's
numbers into your own code. The API only re-runs the case scripts that already exist
(scripts/case1_equilibrium.py::run, scripts/case4_mesh_convergence.py::run,
scripts/case5_sesame_crosscheck.py::run, scripts/case7_sesame_profiles.py::run) or reads the
products they committed under data/: it adds no new metric and no new threshold.
import sys; sys.path.insert(0, "src")
from p5dd.verify import evaluate_layer, verify_all
report = verify_all(source="products") # fast, offline: reads data/metrics_caseN.json
print(report.format_table()) # one row per layer + the deliverable-level gate
print(report.status) # pass / fail / external consistency unproven
print(report.layer("L1").checks[0].to_dict())
# point the same declared gates at your own solver's numbers (L1 shown here)
mine = {"current_abs_A_cm2": 3.1e-24, "quasi_fermi_flatness_V": 4.0e-15,
"max_np_over_ni2_deviation": 9.0e-14, "Vbi_rel_error": 1.0e-12,
"W_rel_error": 2.4e-2, "Emax_rel_error": 2.5e-2, "residual_absolute": 6.0e-9}
layer = evaluate_layer("L1", mine)
print(layer.status, layer.failed)verify_all(source="cases") re-runs the cases instead of reading the products (the full suite,
writing the same data/ and figures/ paths as always). Every layer in the report carries the
wording of what it cannot show, taken from the table above: L1 certifies the discretisation and
not the physics model chosen, L2 does not show that the converged limit is the right answer,
and L3 is an independent code, not an independent validation chain, with zero power over model
completeness. A layer that could not be run is reported as not_executed with passed still
False; a metric missing from a submitted report fails its check instead of passing silently;
the thresholds come from this repository's declared gates, so a submitted report cannot widen
them. Passing all three layers therefore means "this discretisation met these criteria on this
device" - it does not shrink the scope boundary below.
Wording rule: verified = a measured value exists in data/metrics_caseN.json;
extrapolation = same-family evidence or a mechanism argument only, with the verification
path named. All six items are measurements on this Si abrupt junction at these parameters
and are not general device claims.
- The textbook generation current is an upper bound here, not a prediction.
q·n_i·W/(τ_n+τ_p)assumes the whole depletion region generates at the limiting rate; only the doubly-depleted window (where n and p are both below n_i) actually does, because Boltzmann tails keep the majority carrier above n_i over most of the region. Measured reverse current: 11 % / 23 % / 36 % of that bound at −0.10 / −0.30 / −0.70 V, and the effective generation width inferred from|J|(τ_n+τ_p)/(q·n_i)exceeds the window width by a factor of only 1.06 — the window width, not the depletion width, sets the current. (Verified for τ = 10 ns, W ≈ 0.33 µm, 1e16–1e17 cm⁻³; other lifetimes/dopings untested.) - The applied bias does not all fall across the junction. At 0.70 V the neutral-region
drop is 49.2 mV, within 11 % of the
|J|·R_sheetestimate (R_sheet = 8.08e-3 Ω·cm²), while at ≤ 0.20 V it is < 1e-5 V. Regressing ln J against the junction voltage V_j is what recovers the thermal voltage (3.1 % error); regressing against V inflates the ideality factor at high bias (2.23 here). - The three ideality regimes emerge on their own: ≈1.58 where SRH recombination dominates at low bias, ≈1.12 in the diffusion-dominated middle, > 2 once series resistance takes over. No piecewise rule exists anywhere in the solver — one equation set, three behaviours.
- Band-gap narrowing pulls the built-in potential down: ΔE_g ≈ 24 meV on the 1e17 cm⁻³ side, n_i ×1.60, V_bi 0.78013 → 0.75880 V (−21.3 mV), J_s ×1.90, J(0.60 V) ×1.54. Model sensitivity (a physics result), not solver error.
np = n_i²holds to 6.4e-14 even inside the space-charge region — a direct consequence of the zero-flux property, not an imposed constraint.- Photogeneration runs through the same entry point (
generation=): J(0) > 0, J_sc matchesqG(W + L_n + L_p), total current stays continuous. Evidence about the framework, deliberately not expanded into an optoelectronic device result.
Framework-level deliverables and device-level results are counted separately, and this repository makes no capability claim for the following, none of which was built or tested:
MOS / MOSFET capacitance structures · pin junctions · heterojunctions · graded-doping junctions · transient and switching · AC small-signal admittance · 2-D devices · high injection (V approaching V_bi).
Device.cdot accepts an arbitrary doping profile, r_ni may vary node by node and
generation(x) is injectable, so these are structurally supported — but "structurally
supported" ≠ "numerically verified". Each extrapolation and its verification path (inversion
charge and interface states for MOS; band offsets and fixed interface charge for
heterojunctions; the doping-gradient effect on the depletion-edge criterion for graded
junctions) is listed in reports/technical-report.md §1.5.2 and
§8.2 (Chinese).
Other declared limits: steady state, 1-D, uniform lifetime, a single mid-gap SRH level, no
Auger / tunnelling / Schottky recombination, no displacement current (so no AC and no C-V
frequency dispersion — case 3's capacitance is a quasi-static dQ/dV); abrupt doping at x_j;
the 0.70 V sweep stays on the weak-injection side. The Sesame comparison now covers the
internal profiles as well as the terminal current, but only for this one abrupt junction, this
one parameter set and those 4 biases; Sesame does not output field, so the fields compared in
case 7 are each code's own difference of its own potential. And since the residual floor is
≈3e-9, every relative metric is gated on magnitude — |J| > 1e-3 A/cm², and in case 7
densities below 1e6 cm⁻³ are excluded from the ratio rather than counted as zero error
(otherwise the depletion-edge Boltzmann tails read as disagreement), while the field, which
changes sign inside the device, uses a floored denominator max(|E|, 1e3 V/cm).
The second route named in the original project brief (FEniCS finite elements) was not used: 1-D finite volume with SG fluxes already delivers provable equilibrium exactness and a clean second order, with numpy/scipy only and no build chain, which fits the CPU-only, one-command-reproduction constraint better.
src/p5dd/ constants · bernoulli · material (Arora / Slotboom / SRH) · device (graded
mesh, scaling, initial guess) · devices (reference / realistic / Sesame
adapters) · solver (residual + analytic Jacobian + damped Newton +
continuation) · theory (V_bi, depletion, Shockley, ideality) · analysis
(peak field, depletion charge, C = dQ/dV, Mott-Schottky) · viz (Agg styling)
verify (reusable L1/L2/L3 reports for third-party solvers)
scripts/ case1..case9 + run_all.py
tests/ 118 tests, session-scoped solved fixtures
reports/ technical-report.md · acceptance-checklist.md (both in Chinese)
data/ figures/ committed metrics, per-point CSV, 15 PNG
reference/ vendored Sesame 2.0 (trimmed; retained files unmodified) + PROVENANCE.md
.github/workflows/ CI: test suite + all seven cases on Python 3.10 / 3.12 / 3.13
MIT for the code written in this repository (src/, scripts/, tests/, reports/,
data/, figures/). reference/sesame/ remains under its own 3-clause BSD license
("Copyright 2017 University of Maryland"), redistributed unmodified together with
LICENSE.rst, AUTHORS.rst and reference/PROVENANCE.md.
This repository is part of a set of work on batteries and transport modelling by the same author:
| Repository | What it covers |
|---|---|
| battery-cathode-ml | Cathode material screening: band gap, formation energy, voltage, capacity + uncertainty and multi-objective decisions |
| battery-lifetime-guide | From-scratch reproduction of Severson et al. 2019 (cycle-life prediction), crash scenes included |
| battery-soh-tsfm-benchmark | Do zero-shot time-series foundation models beat linear extrapolation? Three-dataset SOH benchmark |
| battery-ecm-rul | Thevenin ECM parameter identification + early cycle-life prediction + PyBaMM simulation |
| drift-diffusion-pn-junction | Self-contained 1D drift–diffusion–Poisson solver with three-layer verification |
| car-following | Car-following traffic modelling toolkit (7 models, stability, calibration, lane changing, EV energy) |
| project-packer | Turning real project work into interview-defensible experience (fact dossier + question tree) |








