The answer to your question can get very complicated, very quickly. A quick google search turned up the following soil temperature and heat flow lecture notes. perhaps you should start there and come back with a more detailed question.
you must be more specified. Howevere see my paper that estimate temperature distibution through asphalt pavement in tropical region where the situation can easly modified from asphalt to soil where heat equation is solved using FEM with a suitable varying boundary conditions ( enviernmental , solar radiation).