driftlet

Charged species drifting and diffusing through one-dimensional devices, solved as continuous fields, live in your browser.

driftlet is a small JavaScript library with no dependencies. A pn junction, a battery and a nerve look like different subjects, but to driftlet they're one problem with a different cast: electrons and holes, or ions, each a continuous concentration drifting and diffusing down its own electrochemical potential, reacting, and crossing interfaces.

Each page builds its device with driftlet/kit, solves it as you move the controls, and draws what you'd measure (an I–V curve, a voltammogram, a discharge), mostly against closed-form theory as a check. Beneath it are the level diagrams and profiles across the device, on one x axis. Every page shows its whole script at the bottom, as a worked example to copy. The stamp on a card names what its page is drawn against (✓), or what the test suite checks it against.

Semiconductorse⁻h⁺excitonvacancy⁺

✓ Shockleypn junction level diagram
pn junctionQuasi-Fermi levels and band edges under bias; the I–V curve against Shockley, short diode to long.
✓ collection theorysolar cell
Solar cellLight absorbed as it goes in, colour by colour: J–V and the spectral response against collection theory, blue lost in the emitter, the split quasi-Fermi levels.
✓ exciton theoryorganic bilayer solar cell
Organic solar cellLight makes neutral excitons that diffuse to a donor/acceptor interface and split: Jsc against thickness and Voc by detailed balance, both against theory.
✓ IonMongerperovskite hysteresis
Perovskite hysteresisMobile iodide vacancies make the J–V curve depend on scan rate: the loop opening and closing, the vacancies' layers at each face, against IonMonger.
✓ ideal C–VMOS capacitor
MOS capacitorAccumulation, depletion and inversion under a metal gate; C–V at any frequency, from the low-frequency curve to the high, as generation stops keeping up.

Electrochemistrye⁻Fe³⁺Ag⁺NO₃⁻Zn²⁺Li⁺

tested: Butler–Volmercyclic voltammetry
Cyclic voltammetryFe³⁺/Fe²⁺ at platinum: the Fermi level against the couple's redox level, Butler–Volmer kinetics and diffusion.
Daniell cell
Daniell cellZn | Zn²⁺ | separator | Cu²⁺ | Cu through a load: a KCl salt bridge or a porous pot simulated ion by ion, leaking, and copper plating onto the zinc.
✓ steady theoryconcentration polarisation and saturation
SaturationAg | AgNO₃ | Ag under a square wave: the salt piling up and reversing, live, and the current saturating at its limit. And a thin-film transistor pinching off, for the same reason.
✓ Warburgimpedance
ImpedanceThe same cell's spectrum against the finite-length Warburg, and its small-signal response inside, frequency by frequency.
✓ OCVintercalation host
Intercalation hostGalvanostatic cycling between cutoffs: the loop settling against a regular-solution OCV, Li⁺ and e⁻ level by level.

Ions at interfacesK⁺H⁺Cl⁻fixed charge

✓ Henderson, Planckliquid junctions
Liquid junctionsA patch pipette's junction growing from contact against Henderson and Planck, and a salt bridge whose charged frit turns into a membrane against a dilute sample.
✓ TMSa charged nanochannel
Charged nanochannelA channel's charged walls: Donnan layers at each mouth that overlap in dilute salt, K⁺ selectivity, a conductance plateau against Teorell–Meyer–Sievers, and a bipolar channel that rectifies like a pn junction.
✓ TMSion-exchange membrane
Ion-exchange membraneDonnan exclusion and permselectivity, ion by ion, against Teorell–Meyer–Sievers theory; unstirred layers.
✓ Gouy–Chapmandouble layer
Double layerIdeal against crowded (lattice-gas) ions at a blocking electrode, each against its closed-form theory; ion by ion.

Cells and nervesNa⁺K⁺Cl⁻gates

✓ Mullins–Nodaa cell's resting potential
Resting potentialA cell membrane's leaks and the Na⁺/K⁺ pump: Vm against Mullins–Noda, each ion's driving force, and the run-down to Donnan equilibrium when the pump stops.
tested: HH equationsan action potential
Action potentialHodgkin and Huxley's voltage-gated channels, with the ions solved for: the spike, its currents and gates, and each ion's driving force through it; temperature, TTX and TEA.
✓ HH’s 18.8 m/san action potential travelling along an axon
PropagationAn action potential travelling along a squid axon, at Hodgkin and Huxley's speed, out of the ions drifting along it: the local circuit, which ions carry it, and each one's driving force along the axon; radius, temperature, TTX.
tested: cablesaltatory conduction in a myelinated axon
MyelinTwo thin axons race: one bare, one myelinated, its spike jumping from node of Ranvier to node over ten times faster, against a compartmental cable; myelin thickness, node spacing and channel density.