A boundary-layer model of flow in a porous medium at high Rayleigh number