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 drift–diffusion solver for semiconductors and a Poisson–Nernst–Planck solver for ions, in steady state, in time and as impedance. 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, and the starters are the smallest whole pages, each in one file: a pn junction and a bias slider, an electrode's double layer and its potential, that double layer charging after a voltage step, and a solar cell's I–V curve in the light. 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.
✓ Kroemergraded-base transistor: base transit time against Kroemer's formula
Graded-base transistorAn AlGaAs/GaAs transistor whose base narrows its gap toward the collector: a field only the electrons feel, and the base transit time against Kroemer's formula.

Electrodese⁻Fe³⁺S₂O₈²⁻O₂Li⁺Fc⁺H(ads)h⁺

✓ independent CVcyclic voltammetry
Cyclic voltammetryFe³⁺/Fe²⁺ at platinum: the Fermi level against the couple's redox level, Butler–Volmer kinetics and diffusion.
✓ Cottrell, Sandpotential and current steps
Potential and current stepsChronoamperometry and chronopotentiometry at platinum: the current after a potential step against Cottrell, kinetics and all, and the potential after a current step to Sand's transition time.
✓ Levich, k⁰ backrotating disk electrode
Rotating diskSteady currents at five rotation rates against Levich, and the Koutecký–Levich and Tafel analysis run on them, as on measured data, giving back the electrode's rate constant.
✓ Randles circuitRandles circuit
Randles circuitA redox electrode's impedance, simulated from the ions and the reaction, against the Randles equivalent circuit: solution resistance, double layer, charge transfer and a finite Warburg, each from the physics.
✓ Frumkin correctionFrumkin effect
Frumkin effectPeroxodisulfate at mercury: past the potential of zero charge the double layer repels the reactant, and in dilute salt the current falls as the drive grows. The double layer opened up, nanometre by nanometre.
✓ load linebistability behind a resistor
BistabilityThe same electrode behind a resistor: two steady states at one source voltage, the jump between them each way, and a Hopf point where the busy state starts to ring. Each traced state marked stable or not.
✓ Evans diagramcorrosion and the Evans diagram
CorrosionIron in aerated salt water settles at a mixed potential between its own redox level and oxygen's: the Evans diagram against closed forms, and why stirring speeds corrosion.
✓ MHC theoryChidsey's experiment
Through a monolayerChidsey's experiment: ferrocene tethered to gold, its electron transfer rate from potential steps against the driving force and temperature, bending toward a ceiling as Marcus–Hush–Chidsey kinetics say, where Butler–Volmer's runs straight on.
✓ steady theoryhydrogen evolution and the volcano
Hydrogen evolutionThe Volmer, Heyrovsky and Tafel steps through adsorbed hydrogen: the Tafel slopes that tell them apart, the coverage that bends them, and Parsons's volcano of the exchange current against the binding energy.
✓ Poisson–Boltzmanna Mott–Schottky plot
Mott–Schottky plotn-type silicon in KCl: 1/C² against the potential, the doping from its slope and the flat band from its intercept, and where the line bends or misleads: accumulation, inversion and the holes it needs, the solution's share, the circuit it's read through.
✓ steady theorylithium plating with Marcus–Hush–Chidsey kinetics
Lithium platingMarcus kinetics as fitted to lithium measurements: a Tafel plot that bends away from Butler–Volmer, two Marcus fits that agree on the data and part beyond it, and why one levels off, from the metal's filled states against lithium's.

Cells and batteriese⁻Zn²⁺Ag⁺NO₃⁻Li⁺

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.
✓ 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.
✓ compartmental 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.