Thermodynamics of Earth Systems