driftlet 0.14.0 → 0.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -1
- package/docs/alignment.md +6 -3
- package/docs/data.md +3 -1
- package/docs/device.md +102 -33
- package/docs/kit.md +55 -17
- package/docs/numerics.md +244 -121
- package/docs/reliability.md +15 -9
- package/docs/statistics.md +28 -4
- package/llms.txt +73 -41
- package/package.json +1 -1
- package/src/blockTridiagonal.js +85 -7
- package/src/checks.js +83 -6
- package/src/describe.js +46 -5
- package/src/device.js +33 -10
- package/src/index.js +23 -10
- package/src/particles.js +131 -55
- package/src/solution.js +164 -8
- package/src/solver.js +923 -277
- package/src/sources.js +10 -2
- package/src/stack.js +16 -6
- package/src/statistics.js +7 -3
- package/types/blockTridiagonal.d.ts +1 -0
- package/types/checks.d.ts +8 -2
- package/types/index.d.ts +2 -2
- package/types/particles.d.ts +3 -6
- package/types/solver.d.ts +50 -29
- package/types/stack.d.ts +6 -4
package/docs/numerics.md
CHANGED
|
@@ -275,13 +275,30 @@ current into the device, $`I`$. Assembly records, for each:
|
|
|
275
275
|
A floating terminal's voltage is an extra unknown, with its circuit law as an extra row:
|
|
276
276
|
$`I - I_{\mathrm{set}} = 0`$ (driven by a current) or $`I - (V_{\mathrm{src}} - V)/R = 0`$ (behind a
|
|
277
277
|
resistance). These don't fit the block-tridiagonal matrix $`T`$ (a port couples to its whole
|
|
278
|
-
window), so they're solved by bordering, together with
|
|
279
|
-
[steady
|
|
280
|
-
$`Q_q = T^{-1} e_q`$ (the response to a unit
|
|
278
|
+
window), so they're solved by bordering, together with a steady solve's dense rows, the
|
|
279
|
+
conserved amounts' and islands' (see [the steady system](#the-steady-system)): with
|
|
280
|
+
$`y = T^{-1}\,\mathrm{rhs}`$, $`X_k = T^{-1} B_k`$ and $`Q_q = T^{-1} e_q`$ (the response to a unit
|
|
281
|
+
pin; for a flat stretch's amount, to its shift), the update is
|
|
281
282
|
$`\delta = y + \sum Q_q \mu_q - \sum X_k\, \delta V_k`$, and the $`\mu`$ (pins) and $`\delta V`$ (terminals)
|
|
282
283
|
come from a small dense system of the extra rows. Each costs one more back-substitution per
|
|
283
284
|
Newton iteration.
|
|
284
285
|
|
|
286
|
+
A floating terminal (driven by a current, or behind a resistance) that alone feeds a conserved
|
|
287
|
+
combination (a host's electrons behind an open circuit, a gate's metal) can read its current
|
|
288
|
+
another way in a time step: as the combination's change, $`F\,(S - S^*)/(\lambda\, dt)`$, which the step's balance rows
|
|
289
|
+
sum to exactly (λ is its weight over the terminal's charge, $`w/z`$). Both readings are exact;
|
|
290
|
+
they differ in round-off, and in what Newton can see. Through a metal, the flux is $`G\,\Delta\eta`$
|
|
291
|
+
with its two $`\eta`$ all but equal: a floating gate's charging current fell below that at steps
|
|
292
|
+
of ~0.03 s, and the bordered system came out exactly singular (a gate at rest took 5000 steps
|
|
293
|
+
per 100 s, half rejected, where a held one takes 44). Over long steps the flux lets a closed host
|
|
294
|
+
drift from its charge (3 mV over 5e11 s, and steps failed by 4e12 s), where the change keeps
|
|
295
|
+
it. Over short ones the change is the amount's round-off over $`dt`$ (a cathode's 0.04 mol/m² of
|
|
296
|
+
electrons, 1e-6 A/m² at 1 µs), and the flux, its levels carried in two words, is far cleaner. So
|
|
297
|
+
a step reads the change where its round-off, $`\varepsilon F S/(\lambda\, dt)`$, is below 1e-6 of
|
|
298
|
+
the flux's estimate, $`\varepsilon\,\max|C|`$, and a step read by the flux that fails is tried once
|
|
299
|
+
more read by the change. (A gate charged through a resistance, read by its flux, was 0.9% off
|
|
300
|
+
backward Euler's exact RC response, silently; read by its change, it's exact to round-off.)
|
|
301
|
+
|
|
285
302
|
Sources are read at the end of a step (implicit), or at the present time in a steady solve.
|
|
286
303
|
`advance()` lands on every waveform breakpoint and restarts its order there.
|
|
287
304
|
|
|
@@ -430,7 +447,7 @@ test checks the compact Jacobian column by column on devices that cover every as
|
|
|
430
447
|
### Exact J·v
|
|
431
448
|
|
|
432
449
|
The assembled matrix loses what a flux's two entries share. A Scharfetter–Gummel flux depends on
|
|
433
|
-
$`\eta`$ at its two ends through $`G`$ and $`-G(1 + E)`$, with $`E = \
|
|
450
|
+
$`\eta`$ at its two ends through $`G`$ and $`-G(1 + E)`$, with $`E = \mathrm{expm1}(\Delta\eta)`$;
|
|
434
451
|
for a nearly uniform $`v`$ they cancel, and $`J \cdot v`$ keeps only round-off of $`G|v|`$, which in
|
|
435
452
|
an inversion layer's 0.1 nm cells ($`G`$ ~ 1e11) dwarfs the flux. Where a solve needs
|
|
436
453
|
$`J \cdot v`$ itself (GMRES, in the impedance and in Newton's refined solves), the dilute kernels'
|
|
@@ -453,9 +470,14 @@ which cost four assemblies per product.
|
|
|
453
470
|
## Newton
|
|
454
471
|
|
|
455
472
|
- The update of the device's potentials ($`\hat\phi`$, $`\eta`$) is limited to 10 thermal units per
|
|
456
|
-
iteration by uniform scaling
|
|
457
|
-
|
|
458
|
-
|
|
473
|
+
iteration by uniform scaling: one factor for the whole update, concentrations' $`\eta`$ with
|
|
474
|
+
their $`\hat\phi`$, gates, coverages and floating terminal voltages alike, so the damped update
|
|
475
|
+
keeps Newton's direction. Clipping each unknown at its own limit would not: where it bit,
|
|
476
|
+
$`\eta - z\hat\phi`$ (a concentration) would move by up to a factor $`e^{10}`$ that Newton never
|
|
477
|
+
asked for. Either way damping shapes only the path, since convergence needs a full, undamped
|
|
478
|
+
update. A floating terminal voltage's update doesn't count toward the limit, though: it enters
|
|
479
|
+
only linearly (conductance links, held levels, a capacitive face), so a large swing in it is
|
|
480
|
+
safe. When it did count, a port driven by
|
|
459
481
|
a current pulse, its voltage collapsing by hundreds of volts as the current switched off,
|
|
460
482
|
dragged every unknown along 10 thermal units at a time (and a swing past 1e4 tripped the
|
|
461
483
|
divergence check): the strong-injection Haynes–Shockley benchmark took 55% more
|
|
@@ -499,7 +521,14 @@ which cost four assemblies per product.
|
|
|
499
521
|
~1 per m³ beside a face, are held through conductances 1e-16 of the face flux's coefficient in
|
|
500
522
|
their row, and the elimination cancels them exactly: such devices now solve, even at
|
|
501
523
|
equilibrium. Newton's updates stay meaningful (the factorisation only amplifies the residual,
|
|
502
|
-
so a small update still means a small residual), and its refined solves correct the rest.
|
|
524
|
+
so a small update still means a small residual), and its refined solves correct the rest. So
|
|
525
|
+
is a pivot that's round-off alone without being exactly zero, below 1e-18 of the magnitudes it
|
|
526
|
+
was formed from (the running bound below, carried only for a block whose pivots look small):
|
|
527
|
+
otherwise its value, whatever the round-off happened to leave, scales all that follows. Strictly
|
|
528
|
+
neutral water whose level only the fast couple at its far face held had its last node's pivot
|
|
529
|
+
at 7e-32 with the species listed one way and 3e-16 the other; at 7e-32 the face's block was
|
|
530
|
+
scaled by 1e31, lost its own pivot outright, and the solve failed in that listing alone. (At
|
|
531
|
+
1e-15 a pivot can still hold a digit Newton needs: a port's steady solve then wandered.)
|
|
503
532
|
- When a steady solve fails, the solution's warnings say how nearly singular the system was,
|
|
504
533
|
and where. A running error bound through the factorisation compares each pivot with the
|
|
505
534
|
magnitudes it was formed from, $`\log_{10}(\sum|\mathrm{terms}| / |\mathrm{pivot}|)`$: the digits
|
|
@@ -569,8 +598,11 @@ which cost four assemblies per product.
|
|
|
569
598
|
- A target within round-off of the present time (1e-10 relative), such as an animation
|
|
570
599
|
frame's that lands a hair past a breakpoint just reached, is snapped to rather than
|
|
571
600
|
stepped to: a step of 1e-13 s can't be resolved.
|
|
572
|
-
- Newton starts each step from
|
|
573
|
-
about a third of the iterations.
|
|
601
|
+
- Newton starts each step from its unknowns extrapolated through the last three states, which
|
|
602
|
+
saves about a third of the iterations. Only its unknowns: the slots it never solves for
|
|
603
|
+
include a gauge, an insertion host's $`\hat\phi`$, which extrapolated through steps that grow
|
|
604
|
+
wandered off geometrically (to 1e11 thermal units by 1e5 s), until the levels measured from
|
|
605
|
+
it lost their digits and every step failed.
|
|
574
606
|
- The wall-clock budget is checked between steps.
|
|
575
607
|
|
|
576
608
|
## Small-signal impedance
|
|
@@ -638,78 +670,147 @@ only resolved to ~1e-4 of $`|Z|`$.
|
|
|
638
670
|
|
|
639
671
|
## Steady state
|
|
640
672
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
673
|
+
A steady state is where a transient from the present state ends. `solve()` finds it without
|
|
674
|
+
stepping there, as the solution of the steady equations ($`dt = \infty`$, no storage term): slow
|
|
675
|
+
physics can take seconds or hours, far beyond any $`L^2/D`$ estimate (exponentially scarce
|
|
676
|
+
minority carriers slowly filling an inversion layer behind a Schottky contact), and stepping
|
|
677
|
+
would never finish. Three things make that more than one Newton solve: without the storage term,
|
|
678
|
+
the steady equations say nothing of what the transient conserved; some levels are held so weakly
|
|
679
|
+
that a factorisation loses them; and Newton needs a start near enough. `solve()` does not advance
|
|
680
|
+
the clock. Nor does it ask whether the steady state is stable: an axon held at a current that
|
|
681
|
+
makes it fire over and over has a resting point all the same, which `solve()` returns, and only
|
|
682
|
+
a transient leaves it.
|
|
683
|
+
|
|
684
|
+
### The steady system
|
|
685
|
+
|
|
686
|
+
Every row of a steady solve that differs from a time step's is a sum of balance rows, or (a
|
|
687
|
+
reaction's affinity) a condition equivalent to one. It's written out in its telescoped form,
|
|
688
|
+
never added up from the rows themselves, so what the sum leaves is exact, however small beside
|
|
689
|
+
the terms that cancel:
|
|
690
|
+
|
|
691
|
+
- **A conserved amount.** A combination of stretches (weights $`w`$) that no reaction changes and
|
|
692
|
+
nothing outside feeds has balance rows that sum to zero identically in a steady state: the
|
|
693
|
+
fluxes cancel across its stretches, and the reactions by $`w \cdot \nu = 0`$. One of those rows
|
|
694
|
+
is redundant, and the combination's amount, $`\sum_k w_k \sum v c_k`$, stands in for it. That's
|
|
695
|
+
what a time step's own sum, $`w \cdot (S - S_0)/dt = 0`$, says at any $`dt`$.
|
|
696
|
+
|
|
697
|
+
The combinations are the null space of the stoichiometry (a row per reaction, over the
|
|
698
|
+
stretches it touches) together with what the terminals feed, worked out once and again after a
|
|
699
|
+
change of drive. A terminal held at a voltage (or behind a resistance, which holds it at steady
|
|
700
|
+
state) feeds each stretch it links freely. One driven by a current feeds its charged species
|
|
701
|
+
only as that current allows, in proportion to their charges. So:
|
|
702
|
+
- a **spectator** (a species blocked all round) keeps its amount;
|
|
703
|
+
- so does each **moiety**: the total iron of Fe³⁺, Fe²⁺ and FeCl²⁺ in a closed cell with a
|
|
704
|
+
complexation reaction;
|
|
705
|
+
- so does what a **terminal at no current** alone feeds. A closed battery at open circuit
|
|
706
|
+
has one steady state per state of charge, and a solve that imposed only I = 0 had converged
|
|
707
|
+
to another (4.145 V where its start said 3.958 V). A terminal that passes current only by
|
|
708
|
+
charging a capacitance (a gate, a port's capacitance) is the same, its charge in place of an
|
|
709
|
+
amount; and an electrode port's reactions draw on what the electrode holds, its charge
|
|
710
|
+
$`Q/(zF)`$ a column of its own under a current, so a port at no current reducing a closed
|
|
711
|
+
M⁺ (M⁺ + e⁻ = M(s)) keeps M⁺ + Q/F, or with no capacitance, M⁺ alone. At any other current such a terminal only stores what comes in, which has no steady
|
|
712
|
+
state, and the solve says so at once.
|
|
713
|
+
- an **immobile** combination (trap states X⁰ and X⁻ under e⁻ + X⁰ = X⁻, with D = 0) keeps it
|
|
714
|
+
node by node, since nothing carries it anywhere, as do an electrode's surface species
|
|
715
|
+
(adsorbates that only turn into each other keep their total on every site), its row local,
|
|
716
|
+
one per node in its own block. (The null space is taken with the immobile columns first, so
|
|
717
|
+
that these come out apart from the combinations that move.) A combination of immobile
|
|
718
|
+
stretches with a moving one (the electrons the traps hold, $`e^- - X^0`$, in a closed film) is
|
|
719
|
+
an amount like any other, its immobile parts summed over their nodes;
|
|
720
|
+
- a **floating metal** keeps the charge on its faces, its sheets' displacement.
|
|
721
|
+
|
|
722
|
+
A closed stretch keeps the amount it was given (its `c0`, or what it held when `set()`
|
|
723
|
+
closed it); a combination behind a terminal at no current keeps what the state holds when the
|
|
724
|
+
solve begins. The amount's row is dense, so it's bordered (see [terminals](#terminals)): the
|
|
725
|
+
factorised matrix gets a pin, an identity row, in place of the balance row, which makes the
|
|
726
|
+
stretch's level a well-conditioned unknown, and the response to a unit pin (one more
|
|
727
|
+
back-substitution) goes in at whatever weight satisfies the amount. Behind a terminal at no
|
|
728
|
+
current, the amount stands in for the terminal's circuit row instead: at no current that row is
|
|
729
|
+
the sum of the combination's balance rows, so it says nothing new. (An electrode's charge, which
|
|
730
|
+
moves with the terminal's voltage, goes only there.) The rows replaced must be independent:
|
|
731
|
+
each combination's weights over them a nonsingular matrix, or one balance is said twice and
|
|
732
|
+
another not at all. Picked one combination at a time, two complexations sharing A
|
|
733
|
+
(A + B = AB, A + C = AC) had −A + B + C in place of B's row, B + AB of AB's and A − B + AC of
|
|
734
|
+
A's, and the solve converged to a state that wasn't steady, depending on the order the species
|
|
735
|
+
were listed in. So they're chosen by elimination.
|
|
736
|
+
|
|
737
|
+
Holding an amount through a storage term at a huge $`dt`$ instead is badly conditioned: the
|
|
738
|
+
stretch's level is then held only by $`v \cdot c/dt`$, against internal conductances
|
|
739
|
+
$`D \cdot c/h`$ larger by $`D \cdot dt/(hL)`$, around 1e12 for a micron-scale cell (see
|
|
694
740
|
[metal regions](#metal-regions) for the same cancellation). Newton then needs dozens of
|
|
695
|
-
iterations, or fails.
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
741
|
+
iterations, or fails. It's left only where a species is still in one region and moves in the
|
|
742
|
+
next: there, backward-Euler steps at a huge $`dt`$ (10⁶ × the slowest diffusion time) keep
|
|
743
|
+
the storage term, growing ×10 (capped) while the state still moves, each spectator's level
|
|
744
|
+
first shifted uniformly to restore its amount exactly (round-off creeps through the vanishing
|
|
745
|
+
storage term), and one last step at the base huge $`dt`$, where pinning is tight.
|
|
746
|
+
- **A flat level.** A species that no reaction or port touches, reached by one contact at most,
|
|
747
|
+
carries no flux in a steady state: every sum of its balance rows from its closed end is the
|
|
748
|
+
flux through one segment, zero. In an ideal region without flow or mixing that's a level flat
|
|
749
|
+
across the segment, so its level is flat throughout: its contact's, or reaching none (a
|
|
750
|
+
spectator), the level its amount fixes. Steady solves (not the impedance, where it carries a
|
|
751
|
+
current) hold it there in place of its balances, rather than find it through its own
|
|
752
|
+
conduction, which can be all but nothing. A level found that way can't be moved: a MOS
|
|
753
|
+
capacitor's inversion electrons reach the back contact only through a bulk with ~1e3 of them
|
|
754
|
+
per cm³, and with that contact moved, each solve failed through ~90 pseudo-transient steps;
|
|
755
|
+
past a closed zinc cell's limiting current, extended space charge at the cathode excludes the
|
|
756
|
+
blocked sulfate to ~1e-25 mol/m³, and the chain of conductances through it had lost the steady
|
|
757
|
+
system 14 digits (steady solves failed from 0.7 V, and took 37,000 iterations at 0.6 V). (A
|
|
758
|
+
level that starts flat stays exactly so either way: carrying nothing, the flux's expm1 form is
|
|
759
|
+
exactly zero, whatever $`\phi`$ does.) A spectator's first node keeps its amount's row, a pin
|
|
760
|
+
whose response is the whole stretch's shift, so the stretch moves as a whole. At a face inside
|
|
761
|
+
the stretch whose link holds the level continuous, the face's flux, which only the replaced edge
|
|
762
|
+
balances set, is pinned to zero too. (Not through flow or mixing, nor a concentrated material's
|
|
763
|
+
cross-diffusion, where zero flux isn't a flat level.) Species that react only among themselves
|
|
764
|
+
are held flat the same way where each reaches the same one contact and nothing else, their
|
|
765
|
+
reactions balanced at its levels: one reservoir drives nothing, so in a steady state they're at
|
|
766
|
+
equilibrium. A MOS capacitor's electrons and the holes they recombine with reach only its back
|
|
767
|
+
contact; moved, slow generation through a bulk of GaAs with ~1e-4 electrons per cm³ couldn't
|
|
768
|
+
carry the inversion layer's level with it (of 500 random MOS capacitors, 38 failed and 5
|
|
769
|
+
converged to a gate charge up to 2× off).
|
|
770
|
+
- **A reaction's equilibrium.** A face reaction that alone changes some combination (left out, the
|
|
771
|
+
combination would be conserved: Ag⁺ closed in a cell where Ag⁺ + e⁻ = Ag(s) is its one source, or
|
|
772
|
+
Ag⁺ + AgNO₃ where it also complexes) makes that combination's summed balance its rate, which a
|
|
773
|
+
steady state sets to zero. The rate is a poor row, though: $`k_0`$ times a function of the levels,
|
|
774
|
+
beside the round-off of diffusion's terms in the same balances. An Ag⁺/Ag couple 1e-20 as fast as
|
|
775
|
+
Fe³⁺/Fe²⁺ on the same platinum at open circuit was lost to it, the solve settling where silver
|
|
776
|
+
wasn't (−0.4661 V, against the joint equilibrium's −0.5004 V), and 1e-15 to 1e-18 failed. The
|
|
777
|
+
reaction's affinity, $`a = A_\text{fixed} - \sum \nu \eta = 0`$, says the same at any $`k_0`$
|
|
778
|
+
(each kinetic form vanishes only there), so it stands in for one of the combination's balance
|
|
779
|
+
rows, a pin like an amount's, chosen by the same elimination and ahead of the amounts: the slowest
|
|
780
|
+
reaction first, and a row of one of its own species where one is left, never one picked by where
|
|
781
|
+
the species are listed (the rows had differed with the species reversed, and an electrode's
|
|
782
|
+
equilibrium solved in one listing and failed in the other). The combinations come from the null
|
|
783
|
+
space with that reaction's row left out, any conserved amount added to one being as good (its
|
|
784
|
+
summed balance vanishes too), so that one can be found with a row left to take: silver's e⁻ − Fe³⁺
|
|
785
|
+
beside a closed iron couple whose affinity had Fe³⁺'s row is e⁻ + Fe²⁺ with the iron added. Never
|
|
786
|
+
a metal's carriers' row or a row a terminal feeds, which carry its current (the platinum's
|
|
787
|
+
electrons standing for an iron couple put the electrode at 602 V). And not where a terminal driven
|
|
788
|
+
by a current feeds the combination, since the sum is then the rate plus what that terminal passes;
|
|
789
|
+
a current held at zero passes nothing, so an open-circuit electrode feeding a closed pool of Ag⁺
|
|
790
|
+
is covered (from an iron k₀ of 1e-15 beside it, that settled 78 mV off).
|
|
791
|
+
|
|
792
|
+
Where a reaction can't stand on its affinity (a bulk reaction, whose rate summed over the
|
|
793
|
+
region vanishing needn't make it vanish everywhere, or an electrode port's), a steady solve
|
|
794
|
+
that leaves it with one sign of affinity wherever it acts, though nothing else changes what
|
|
795
|
+
it does, can't be a steady state: its rate is merely too small to see. The solution warns of
|
|
796
|
+
it, rather than pass the start's composition off as steady (a slow complexation had kept its
|
|
797
|
+
starting composition, K = 0.1 for 7.5, without a word).
|
|
798
|
+
- **An island's balance.** A piece of a stretch between its faces that nothing else feeds (no
|
|
799
|
+
contact, port or reaction) holds its level only through its faces' fluxes, which can be far
|
|
800
|
+
weaker than its own conduction: a face conductance of 1e-15 S/m² against a region conducting
|
|
801
|
+
~4e2 S/m, or neighbours that conduct 1e20 times less than it. Eliminated, the level was lost to
|
|
802
|
+
round-off below anything Newton could see (the plain solves gave no update along it, so nothing
|
|
803
|
+
stalled), and solves converged to a wrong one silently: currents 2× or 16× off. Summed over the
|
|
804
|
+
piece's nodes, its balance rows are its faces' flux unknowns alone, $`A_R u_R - A_L u_L`$: the
|
|
805
|
+
internal fluxes cancel exactly, by construction rather than in round-off. Across a face that
|
|
806
|
+
holds $`\bar\mu`$ level, $`u`$ is set only by the edge balances, and eliminated it can come out
|
|
807
|
+
of the piece's own, as $`G\,\Delta\eta`$ with its two $`\eta`$ all but equal; so there the
|
|
808
|
+
outside edge node's balance is added too, $`u`$ cancels, and the outside's first segment
|
|
809
|
+
carries the flux. (Seen through one face of two, a level behind neighbours 1e20 times less
|
|
810
|
+
conductive was overshot twofold, and Newton swung it from one contact's level to the other's.)
|
|
811
|
+
That sum replaces the first node's row, bordered like an amount. The response to the unit pin
|
|
812
|
+
is the island's uniform shift, with whatever $`\hat\phi`$ and the other species do along with
|
|
813
|
+
it, so no mode needs guessing; refined solves carry the pinned rows too.
|
|
713
814
|
|
|
714
815
|
Newton exact along such a level can be worse than Newton blind to it, far from the solution
|
|
715
816
|
(cold at bias, a bipolar stack's floating base took 1e5 thermal units in its first update), so
|
|
@@ -723,45 +824,66 @@ only resolved to ~1e-4 of $`|Z|`$.
|
|
|
723
824
|
minority carriers, whose own rows rest on static pivots, at 1e-17 A/m² of noise), the plain
|
|
724
825
|
solution stands; and a steady solve that fails outright is tried once more with the summed rows
|
|
725
826
|
in from the start. Such devices now solve directly, their currents right to ~1e-15.
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
827
|
+
|
|
828
|
+
All four move a weakly held level as a whole, where a factorisation can't: an amount's, an
|
|
829
|
+
affinity's or an island's pin by a shift it solves for, a flat level by holding every node to one. What the
|
|
830
|
+
factorisation still loses elsewhere, Newton's refined solves recover ([Newton](#newton)).
|
|
831
|
+
|
|
832
|
+
### Reaching it
|
|
833
|
+
|
|
834
|
+
A solve that fails falls back stage by stage:
|
|
835
|
+
|
|
836
|
+
1. **Newton from here.** If it diverges, it's retried once with tighter damping (3 thermal units
|
|
837
|
+
per iteration), enough for most large jumps, such as a cold start at forward bias. Where no
|
|
838
|
+
continuation applies, the first stage goes straight on into the pseudo-transient ramp (3).
|
|
839
|
+
Where the state is a transient's, it can be a worse start than a cold one (a nanosecond after
|
|
840
|
+
a lit MOS capacitor's gate jumps, its surface is in deep depletion, minority carriers ten
|
|
841
|
+
orders below where they end): if Newton fails from there, the solve goes on as a cold device
|
|
842
|
+
would, from the layout for the drives, keeping what it took from the state (its amounts and
|
|
843
|
+
charges). Nor does a continuation start from the last steady solve's voltages once a
|
|
844
|
+
transient has moved the state.
|
|
845
|
+
2. **Continuation from a solved state, along the drives,** each step a steady solve warm from
|
|
846
|
+
the last:
|
|
847
|
+
- **The light.** A device with generation reactions (species made only from, or turned only
|
|
848
|
+
into, fixed reservoirs, such as photogeneration from a photon reservoir) can be held far
|
|
849
|
+
from equilibrium even with its terminals level, where a voltage ramp can't help; nor can a
|
|
850
|
+
time step, since light flooding minority carriers 20 orders below their lit level makes even
|
|
851
|
+
a step of 1e-16 s a jump Newton can't take. The generation rates are scaled down to 10⁻³⁰ and
|
|
852
|
+
ramped back up, ×100 a step while each solve converges and by the square root of the factor
|
|
853
|
+
when one doesn't, giving up when that factor falls below 1.5 (crawling, which time steps do
|
|
854
|
+
better); the pseudo-transient ramp then starts from the dimmer light's solution rather than
|
|
855
|
+
cold. (At 10⁻¹², a GaAs layer's generation still exceeded its equilibrium recombination,
|
|
856
|
+
~3e-24 mol/m³ of minority electrons, a billionfold: the first step was the whole jump.) An
|
|
857
|
+
illuminated 80 µm silicon diode solves cold this way in about 80 iterations. (A lit n⁺pn
|
|
858
|
+
stack with a floating base crawled for 20,000 iterations: at a trillionth of the light, the
|
|
859
|
+
base's level is held by couplings of ~1e-17.)
|
|
860
|
+
- **A current.** A cold steady solve at open circuit can fail where the same state is easy
|
|
861
|
+
warm (a solar cell in dim light on a fine grid). The terminal is held at a voltage instead,
|
|
862
|
+
its steady solves having their own continuation, and the voltage marched from the start's,
|
|
863
|
+
the step growing, until the current crosses its target: up where the current is below it,
|
|
864
|
+
since raising a terminal's voltage raises the current into a passive device (the other way
|
|
865
|
+
if 20 V brings no crossing). Bisection narrows the crossing to 0.1 mV, and the terminal is
|
|
866
|
+
floated from beside it. Floated, the system can lose what held it doesn't (a closed
|
|
867
|
+
Fe³⁺/Fe²⁺ cell driven near its limit, Fe³⁺ 20 orders below Fe²⁺: 33 digits short), but the
|
|
868
|
+
current-driven steady state is the held one at the voltage that passes the target, so where
|
|
869
|
+
the floated solve fails, held solves find that voltage instead, by regula falsi within the
|
|
870
|
+
bracket, to 1e-10 of the current. (Not a terminal at no current that keeps an amount or a
|
|
871
|
+
charge: every voltage passes nothing there.)
|
|
872
|
+
- **The voltages.** The right terminal's voltage ramped to its target: from the contacts'
|
|
873
|
+
voltages at the last converged solve when the state is that solution (the left one first,
|
|
874
|
+
where it moved), and otherwise from level terminals, where a cold start is consistent. (A
|
|
875
|
+
device first solved after a `set()` was laid out for its new voltages; if the level start
|
|
876
|
+
fails from there, it's laid out again, level, and retried.) The step starts at 1/8 of the
|
|
877
|
+
way, grows ×1.5 on success and shrinks ×4 on failure. The ramp's own start, with the
|
|
878
|
+
terminals level, ramps the light up when there is some.
|
|
879
|
+
3. **The pseudo-transient ramp.** $`dt`$ ramps up from a small value, through time, ending in
|
|
880
|
+
the direct solve. After a failed step it grows ×2, then ×1.5 more each success, back to ×10.
|
|
881
|
+
Once steps reach the slowest diffusion time, the direct solve is tried from there, once a
|
|
882
|
+
decade of $`dt`$ (the state kept if it fails): with immobile traps and ions of D = 1e-17 m²/s,
|
|
883
|
+
steps from 1e8 to 1e9 s kept failing on the way to the end.
|
|
884
|
+
|
|
885
|
+
Each of these carries cases that nothing else does (switched off one at a time, each fails
|
|
886
|
+
tests or stress cases the others pass).
|
|
765
887
|
|
|
766
888
|
## Conservation
|
|
767
889
|
|
|
@@ -771,7 +893,8 @@ only resolved to ~1e-4 of $`|Z|`$.
|
|
|
771
893
|
charge to round-off.
|
|
772
894
|
- **The iterate conserves to Newton's tolerance.** Storage is nonlinear in $`\eta`$, so each step's
|
|
773
895
|
drift is its summed residual. Converging to 1e-10 in $`\eta`$ makes that ~1e-15 per step in
|
|
774
|
-
practice
|
|
896
|
+
practice; but over steps of 1e10 s, the residual times $`dt`$ adds up, which is why a terminal
|
|
897
|
+
at no current reads its current there by what it keeps ([terminals](#terminals)).
|
|
775
898
|
- **Reported.** Every solution's `conservation` lists each species stretch: its amount, its
|
|
776
899
|
reference, the time-integrated flux through its contacts, and the resulting drift.
|
|
777
900
|
|
package/docs/reliability.md
CHANGED
|
@@ -84,7 +84,7 @@ recipes.
|
|
|
84
84
|
| Electrodes spread through a port | transmission line with the reaction's linear kinetics as the conductance (O(h²)), rates along it; Wagner–Traud mixed potential of two Butler–Volmer couples, floating | 1e-4, 2e-3; 1e-6 V |
|
|
85
85
|
| Impedance | Macdonald blocking-electrode spectrum, 100 Hz–1 GHz; finite-length Warburg (Ag \| AgNO₃ \| Ag); DC limit = differential resistance; a p⁺n⁺ junction without recombination, Re Y → dI/dV and C = dQ/dV; a redox electrode against a bath at its open circuit, Re Y → dI/dV; a MOS capacitor with a metal gate and a channel port, C = dQ/dV at the gate, passive at the back | 3e-4; 3e-5; 1e-6; 1e-4, 1e-6; 1e-4; 1e-3 |
|
|
86
86
|
| Conservation | per step, and against time-integrated contact fluxes | 1e-11 relative |
|
|
87
|
-
| Strictly neutral limit (ε = 0) | Planck EMF; polarization with no overlimiting; Donnan at neutral faces | 1e-5; 1e-4; 1e-9 |
|
|
87
|
+
| Strictly neutral limit (ε = 0) | Planck EMF; polarization with no overlimiting; Donnan at neutral faces; an ion exchanger between baths (Donnan at the contacts, Teorell–Meyer–Sievers salt flux); a capacitive face's edge cell as a diffuse layer in series | 1e-5; 1e-4; 1e-9; 1e-9, 1e-6; 2e-3 |
|
|
88
88
|
| Fermi–Dirac statistics | `𝓕_{±1/2}` vs quadrature; degenerate bulk; accumulation charge via `𝓕_{3/2}` | 1e-13; 1e-12; 1e-3 |
|
|
89
89
|
| Crowded double layer (lattice gas) | Kilic–Bazant–Ajdari charge, up to `ψ = 40 V_T`; custom function reproduces it | 5e-4; 1e-10 |
|
|
90
90
|
| Non-ideal transport | steady flux −(D/L)ΔP of the grand potential (lattice exact, Redlich–Kister O(h²)) | 1e-12; 1e-4 |
|
|
@@ -108,26 +108,29 @@ devices in five families:
|
|
|
108
108
|
|
|
109
109
|
Each device goes through what a user would do with it: a cold solve at no bias, and one at a
|
|
110
110
|
bias; a warm sweep to that bias; open circuit, where it's lit; a current drive (a fraction of
|
|
111
|
-
what passes at 1 V); a
|
|
112
|
-
|
|
111
|
+
what passes at 1 V); a MOS capacitor's back contact moved under its biased gate; a transient
|
|
112
|
+
after a voltage step; and the impedance about equilibrium, from far below its slowest relaxation
|
|
113
|
+
to 1 GHz. Every result is judged by `check()`, and by what must hold whatever the device:
|
|
113
114
|
levels flat at equilibrium with no current, warm and cold solves agreeing, the current driven
|
|
114
115
|
being the one passed, the impedance passive (to 1e-3 of |Z|) and, at low frequency, equal to
|
|
115
|
-
the steady dI/dV,
|
|
116
|
-
|
|
116
|
+
the steady dI/dV, a MOS capacitance never above its oxide's, and its gate charge with the back
|
|
117
|
+
contact moved what it is with the gate moved the other way. Each case is seeded from its family and index, so
|
|
117
118
|
any failure reruns alone (`npm run stress -- semi 79`).
|
|
118
119
|
|
|
119
|
-
At 500 devices per family (about three minutes on a desktop), 11,
|
|
120
|
+
At 500 devices per family (about three minutes on a desktop), 11,880 of 11,881 scenarios pass:
|
|
120
121
|
|
|
121
|
-
| Family | Cold at 0 V | Cold at bias | Warm sweep | Open circuit or
|
|
122
|
+
| Family | Cold at 0 V | Cold at bias | Warm sweep | Open circuit, current or back contact | Transient | Impedance |
|
|
122
123
|
|---|---|---|---|---|---|---|
|
|
123
124
|
| Semiconductor stacks | 500/500 | 500/500 | 500/500 | 105/105 | 500/500 | 395/395 |
|
|
124
|
-
| MOS capacitors | 500/500 | 500/500 | 500/500 | | 500/500 | 500/500 |
|
|
125
|
+
| MOS capacitors | 500/500 | 500/500 | 500/500 | 500/500 | 500/500 | 500/500 |
|
|
125
126
|
| Electrolyte cells | 500/500 | 500/500 | 500/500 | | 500/500 | 381/381 |
|
|
126
127
|
| Electrodes | 500/500 | 500/500 | 500/500 | 500/500 | 500/500 | 500/500 |
|
|
127
128
|
| Liquid junctions | | | | 500/500 | 499/500 | |
|
|
128
129
|
|
|
129
130
|
(Impedance only where the device has an equilibrium to linearise about; open circuit only for
|
|
130
|
-
lit cells.) The
|
|
131
|
+
lit cells.) The MOS back contact came last: before steady solves held a group of reacting
|
|
132
|
+
carriers flat where it reaches one contact alone, 43 of the 500 failed it, 5 of them silently
|
|
133
|
+
(a gate charge up to 2× off). The one that fails is among the known limits below: a junction on a grid far too
|
|
131
134
|
coarse for its double layers.
|
|
132
135
|
`bench/stress.json` keeps the summary.
|
|
133
136
|
|
|
@@ -169,6 +172,9 @@ so a change that makes one worse shows.
|
|
|
169
172
|
- **A surface covered to a bare fraction below ~1e-10** barely affects anything any more, and
|
|
170
173
|
the solver struggles with it (the hard corpus's passivating drop without a double layer stops
|
|
171
174
|
partway through its hour); the solution warns, and suggests a less stable film.
|
|
175
|
+
- **A double layer across more than ~350 thermal voltages** (between 9 and 9.25 V at 25 °C, in a
|
|
176
|
+
crowded lattice-gas electrolyte) doesn't solve, from a cold start or warm, and its warning
|
|
177
|
+
doesn't say why. Ionic-liquid windows (a few volts) are well inside it.
|
|
172
178
|
- **Currents below ~0.1 nA/m²** (a GaAs junction's leakage without recombination) aren't resolved
|
|
173
179
|
between solves; such a current is zero for any practical purpose.
|
|
174
180
|
- **A failed solve says so:** `converged: false`, with a warning naming where the system lost
|
package/docs/statistics.md
CHANGED
|
@@ -53,6 +53,8 @@ most one model.
|
|
|
53
53
|
|
|
54
54
|
### Fermi–Dirac
|
|
55
55
|
|
|
56
|
+
Where electrons or holes under ideal (Boltzmann) statistics exceed $`c_{\mathrm{ref}}`$, the effective
|
|
57
|
+
density of states, the solution warns: they're degenerate, and this is the statistics to give.
|
|
56
58
|
For electrons and holes, $`c_{\mathrm{ref}}`$ is the effective density of states and $`\mu^\circ`$ the
|
|
57
59
|
band edge, as for ideal statistics, and $`c = N_c \mathcal{F}_{1/2}(\zeta)`$ with the normalised
|
|
58
60
|
Fermi–Dirac integral ($`\mathcal{F}_j \to e^\zeta`$ for $`\zeta \to -\infty`$). driftlet evaluates
|
|
@@ -135,7 +137,20 @@ A flat plateau means phase separation, which isn't supported yet. The table is r
|
|
|
135
137
|
$`\zeta = \ln(x/(1-x)) + r(x)`$: the residual $`r`$, the host's non-ideality, is a shape-preserving
|
|
136
138
|
cubic between points and continues linearly beyond them. Ideal and regular-solution curves are
|
|
137
139
|
therefore reproduced exactly, and $`x`$ stays within $`(0, 1)`$ at any potential. The interpolated
|
|
138
|
-
curve is checked for monotonicity at construction.
|
|
140
|
+
curve is checked for monotonicity at construction. A curve far flatter than the ideal term near
|
|
141
|
+
an end (E falling by millivolts over the last few percent of x) can fail that check however
|
|
142
|
+
many points it has, since r then changes as steeply as the logarithm: give the ends some of the
|
|
143
|
+
ideal slope (adding −0.5 (RT/F) ln(x/(1−x)) there passes).
|
|
144
|
+
|
|
145
|
+
With `A` instead, the curve is the isotherm's, against a reference where the combination's
|
|
146
|
+
chemical potential is 0, with $`g`$ the excess chemical potential ($`\Omega(1-2x)`$ for `A: [Ω]`):
|
|
147
|
+
|
|
148
|
+
```math
|
|
149
|
+
E(x) = -\frac{\mu^\circ_{\mathrm{ion}} + \nu\mu^\circ_{\mathrm{carrier}} + RT\ln\frac{x}{1-x} + RT\ln\frac{c_{\mathrm{max}}}{c_{\mathrm{ref}}} + g(x) - g(0)}{zF}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
So an ideal host given `cRef` = `cMax`, the ion's `mu0` $`= -zFE^\circ`$ and the carrier's 0 sits at
|
|
153
|
+
$`E^\circ`$ half full.
|
|
139
154
|
|
|
140
155
|
Because every charged species sits in a neutral combination, **$`\phi`$ is undefined** in such a
|
|
141
156
|
host and is reported as `NaN`. Its faces must be `neutral` (the default next to such a host),
|
|
@@ -147,14 +162,23 @@ the ions. The carrier's `cRef` plays no part (only the combination's $`\mu^\circ
|
|
|
147
162
|
`cRef` enter), but it must still be given.
|
|
148
163
|
|
|
149
164
|
The ion's `D` is its dilute-limit coefficient, as everywhere: the chemical diffusivity, $`D`$
|
|
150
|
-
times the thermodynamic factor, follows from the OCV's slope
|
|
165
|
+
times the thermodynamic factor, follows from the OCV's slope (with the carrier far faster than
|
|
166
|
+
the ion, as usual; else the two combine as $`D_i D_e/(D_i + D_e)`$, ambipolar diffusion). For an ideal-solution curve,
|
|
151
167
|
$`E = E^\circ - (RT/F)\ln(x/(1-x))`$, it's $`D/(1-x)`$, so a host filling toward $`x = 1`$
|
|
152
168
|
diffuses ever faster, and a $`D`$ measured mid-range isn't the one to give. (A constant chemical
|
|
153
169
|
diffusivity isn't expressible.) A host that only stores what comes in, filling at a constant
|
|
154
|
-
current through its collector, has no steady state: `advance()` it from its `c0`.
|
|
170
|
+
current through its collector, has no steady state: `advance()` it from its `c0`. At no
|
|
171
|
+
current it has one per state of charge, and a steady solve keeps the charge it holds, so in a
|
|
172
|
+
titration (GITT) each rest's OCV is a `solve()` at `I: 0` after the pulse's `advance()`, with no
|
|
173
|
+
need to wait out the relaxation. What a pulse measures is the chemical diffusivity, and the
|
|
174
|
+
textbook estimate from it assumes a small pulse: over $`\Delta x \approx 0.1`$ it's off by up to
|
|
175
|
+
×7 near an end of the curve, against a host that has exactly the diffusivity it's given. In a sphere,
|
|
155
176
|
`geometry: { type: 'spherical', r0: 0 }`, with the centre sealed (`{ phi: 'neutral' }`, every
|
|
156
177
|
species blocked), the ion held at the surface by its reference and the electrons fed by a port
|
|
157
|
-
there (a current into the device: negative, to fill a cathode).
|
|
178
|
+
there (a current into the device: negative, to fill a cathode). A port's `conductance` link
|
|
179
|
+
adds its ohmic drop, about $`I/(G w)`$, to the voltage read, which is no part of the host: give it
|
|
180
|
+
a large $`G`$ (1e15 S/m³ over a window of 2% of the radius), and see that the voltage doesn't move
|
|
181
|
+
with it.
|
|
158
182
|
|
|
159
183
|
An insertion host belongs with [conductor regions](device.md#materials) more than with the other
|
|
160
184
|
statistics here. Both are conductors with no $`\phi`$ of their own:
|