A lumped model of a thermophilic compost pile. Change size, wetness, C:N ratio and aeration, turn the pile, and watch the core heat to 60-70 °C.
The science
The pile is treated as one well-mixed (lumped) body. Two microbial populations (mesophiles, thermophiles) eat a labile organic pool S; the heat they release warms the pile, and air flow, evaporation and conduction take it away.
Biology
r = qmax · f(T) · f(moisture) · f(C:N) · O₂/(Ko+O₂) · S/(Ks+S) · X kg of S eaten per day. The temperature factor f(T) is the Rosso cardinal model with Tmin, Topt, Tmax = 5, 35, 52 °C (mesophiles) and 20, 58, 76 °C (thermophiles). Growth dX/dt = Y·r − kdX; dead cells return half their mass to S.
Energy
C dT/dt = qgen − UA(T−Ta) − ṁair[cp(T−Ta) + Lvη(wsat(T)−wa)]. Heat release uses about 14 MJ per kg of volatile solids (roughly 13.6 MJ per kg of O₂ consumed, the oxygen-calorimetry value). wsat comes from the Magnus vapour-pressure formula; the latent term shows why a hot pile dries out and needs water. Surface area scales as V2/3, so big piles keep heat much better than small ones.
Oxygen
Vg dO₂/dt = Q(0.209 − O₂) − OUR with oxygen uptake OUR = 1.2 kg O₂ per kg S. Wet piles have little air-filled porosity, so their effective fresh-air supply is throttled; that is how a too-wet pile turns anaerobic.
Honest simplifications
One temperature for the whole pile (the 2D cross-section profile is an illustrative parabola-like shape, not a solved heat equation); a single labile pool and no slowly-degrading lignin, so the final curing tail is too short; the moisture, C:N and oxygen factors are empirical shapes, not fitted to one dataset; no pH, ammonia or odour chemistry; no wind or rain. Numbers are realistic in magnitude (peak 60-72 °C, a hot phase of days to weeks) but are not a design tool for a real facility.
Time is shown in days; the integrator is 4th-order Runge-Kutta with a step of at most 0.01 day.