A multidomain discretization of the Richards equation in layered soil