Silicon pn junction
A silicon pn diode between metal contacts, with electrons and holes simulated as ordinary species: its current–voltage curve against Shockley's law, and the band diagram and carrier densities at the bias you choose. The lifetime takes it from a short diode, whose carriers recombine at the contacts, to a long one, whose carriers recombine inside. (More about the model below.)
About this simulation
The band diagram is the familiar one, electron energy up: the band edges Ec and Ev (thin) and the quasi-Fermi levels EFn and EFp (thick), one Fermi level wherever the carriers are in equilibrium with each other. A slope in a quasi-Fermi level is what drives its carriers' current. Underneath, driftlet works in electrochemical potentials: electrons are a species of charge −1 with μ̄e⁻ = EFn per particle, holes one of +1 with μ̄h⁺ = −EFp, which is exactly the usual drift–diffusion (van Roosbroeck) model, and generation and recombination are the reaction e⁻ + h⁺ ⇌ 0. (The same lines in volts and turned over are species voltages, which earn their place where ions share the diagram, as in the electrochemistry and perovskite demos.) The bias moves the p side's metal contact: forward bias splits the quasi-Fermi levels across the junction, and the carriers recombine as they cross, in the layers or at the contacts.
The lifetime control sets band-to-band recombination. With a long lifetime the minority carriers' diffusion length L far exceeds the 1.5 µm layers: they cross to the contacts and recombine there (a short diode). With a short one, L shrinks below the layer thickness and they recombine inside (a long diode). Shockley's law covers both, with the current J₀(eV/VT − 1) and J₀ = qni²[Dn/(NALn) coth(Wp/Ln) + Dp/(NDLp) coth(Wn/Lp)], plus the recombination in the depletion layer (dashed). It holds to a few percent until the current is large, where series resistance and rising injection bend the curve below it.
The carriers, drawn as dots
An illustration of the solution above, not a separate simulation: driftlet solves for densities and
potentials, and particles() from the kit samples them as dots. Each dot is a fixed number of
carriers, hopping between cells at rates taken from the solution, so that on average the dots fill the
space as the densities do and cross each place at the currents. Where carriers are plentiful a dot would
be lost among millions, so they're a shaded sea, darker where denser; the dots are the minority carriers
the bias injects, diffusing until they reach a contact or recombine (an amber line across the gap; a
green one is a pair generated, as goes on in balance with recombination even at equilibrium). A short
lifetime makes recombination common; a long one sends them to the contacts. The majority carriers'
drift is there too, but at about 10⁻⁷ of their thermal motion, no sample of them would show it.