Thermal and magnetic evolution of the Earth’s core