Run one season (1 April to 27 October) of a terraced kitchen garden above a mountain lake. Balance soil water, nutrients, pollination, pests and compost with real daily equations.
Runs until day 210. A rain-fed comparison season (same weather, no tools) is shown at the end.
Educational model: crop parameters, soil values and the energy goal are model values, not agronomic advice. A 17 m² plot covers only a small part of one person's food.
The science
Soil water. Each bed is a 0.3 m bucket: dS/dt = P + I − ETc − D − R (mm per day). Field capacity 0.30, wilting point 0.12, saturation 0.45 m³/m³ (a loam; model values). Drainage D = 0.5 (S − Sfc) above field capacity; the rest above saturation runs off. Water stress Ks = clamp((θ − θwp) / (0.5(θfc − θwp)), 0, 1).
Evaporative demand. Hargreaves: ET0 = 0.0023 (Tmean + 17.8) √(Tmax − Tmin) Ra, with Ra from the FAO-56 solar geometry at 46°N; ETc = Kc ET0 with simplified crop coefficients. The page reproduces the FAO-56 worked example for Ra (32.2 MJ m−² d−¹).
Growth. Development follows degree-days GDD = Σ max(0, (Tmax+Tmin)/2 − Tbase), so a cool spell delays every stage. Daily biomass ΔB = RUE · 0.48 Rs · fint · Ks · Kt · Kn · Kpest with Rs from Hargreaves–Samani, a triangular temperature response Kt, a nutrient factor Kn and a pest factor. Yield = B · harvest index · fruit set / dry-matter fraction.
Nutrients. Mineralisation m = km · OM · Q10(T−20)/10 (Q10 = 2); crops take N-P-K in proportion to growth; beans fix part of their nitrogen; compost adds N, P, K and organic matter.
Pollination. Fruit set 1 − (1 − s0) e−λV where V is bee visits per flower per day (hives, flower strip, weather) and s0 the self-pollination baseline (tomato 0.4, beans 0.8, zucchini 0).
Pests. Aphids grow logistically (dA/dt = rA(1 − A/K) − cLA), ladybirds (L) come with flowers; planting the same plant family again in a bed raises r by 40%.
Compost. The heap warms up when C:N is near 30 and moisture near 55%; three days above 55°C and 25 days of age give mature compost.
Honest simplifications. One uniform soil column per bed, no erosion or disease, no shading by buildings, a synthetic weather generator, one crop per bed at a time, and a rough energy goal. Sources (by type): FAO Irrigation and Drainage Paper 56, soil-science textbooks, horticultural extension tables.
Models built with Blender (terrain, house, beds, plants) and rendered with Three.js.