Electromagnetic core—mantle coupling—I. Explaining decadal changes in the length of day