Lecture notes originally written for the 2011 Advanced School on Scaling Laws in Geophysics: Mechanical and Thermal Processes in Geodynamics, Abdus Salam Centre for Theoretical Physics, Trieste.