A two-layer model of soil hydrology