# Porous-wall flow and a separate daily water ledger

Run `python reproduce.py` with numpy and matplotlib. Standalone hypothetical study with runtime and generator hash. CSV counts603wall-flow,630daily bucket,21summaries:1254total.

Wall contract: wall(K,A,H,L) returns flow in m³/s and L/h. Q=KAH/L; conversion factor3600000. K is saturated hydraulic conductivity (m/s), not intrinsic permeability or pore-water speed. H is head on first side minus second side; positive flow runs first-to-second, negative reverses direction. Chosen flat area0.1m², thickness0.005m, K1e-9/1e-8/1e-7m/s; signed H-2..2m by.02. At K1e-8,H1m flow0.72L/h. Steady saturated homogeneous wall, prescribed heads, no pipe curvature, soil feedback, clogging, unsaturated transport or network pressure loss. Zero K/area allowed; negative K/area, nonpositive thickness and nonfinite inputs rejected.

Daily ledger contract: initial S20mm, hard capacity40mm, assigned infiltrated irrigation I0..20mm/day by1, assigned demand5mm/day,30days. Each day available=S+I; drainage=max(available-40,0); withdrawal=min(5,available-drainage); unmet=5-withdrawal; Snext=available-drainage-withdrawal. Drainage explicitly precedes withdrawal. These are chosen discrete event rules, not soil hydraulic physics or field capacity. I already denotes infiltrated water, not applied irrigation. Rain, capillary rise, runoff and lateral exchange are zero; no crop-response law is modeled. Unmet demand is an accounting deficit, not a predicted crop loss.

Daily and telescoping checks establish S0+sum I=sum drainage+sum withdrawal+Sfinal. At I0 stored water reaches zero after four days and unmet demand starts day5. I5 maintains20mm. At I20, day2 drains15mm before withdrawing5mm, ending35mm. This sequencing matters. One mm over one m² equals one litre, but no area/time conversion couples the bucket to the wall model in this study.

Both original figures are SVG/PDF/PNG. Checks cover signed flow, zero head/conductivity, L/h conversion, daily and full-run conservation, event order, balanced input and six invalid cases. No irrigation efficiency, water saving, wetting-front or crop performance is inferred.

Official Darcy source verified through substantive USGS text: [Introduction to Ground-Water Hydraulics](https://water.usgs.gov/ogw/pubs/TWRI3-B2/TWRI3-B2-with-links.pdf), describing conductivity times hydraulic gradient. [USGS Basic Ground-Water Hydrology](https://pubs.usgs.gov/wsp/2220/report.pdf) specifies Q,K,area and head gradient. These support the wall equation, not the chosen bucket rule or invented soil properties. [FAO root-zone accounting context](https://www.fao.org/4/x0490e/x0490e0e.htm) distinguishes physical water-availability concepts that this hard-cap example does not claim to reproduce.
