Heat loss to the ground from a building—I. General theory