Three-dimensional numerical simulations of convection and magnetic field generation in the Earth's core now span several hundred thousand years; the magnetic field created during most of this time has an intensity, structure and time dependence similar to the present geomagnetic field. Five models are described here. The first is a homogeneous Boussinesq model, driven steadily by heat sources on the inner core boundary. At about 36 000 years into the simulation, a reversal of the dipole moment occurs that resembles those seen in the paleomagnetic reversal record. The four subsequent models are inhomogeneous, that is they allow for the varying properties of the Earth with depth. They are also evolutionary, in that they are powered by the secular cooling of the Earth over geological time. This cooling causes the inner core to grow through freezing, with the concomitant release at the inner core boundary of not only latent heat of crystallization but also light constituents of core fluid that provide respectively thermal and compositional sources of buoyancy that maintain core convection. The behaviour of these models depends on what is assumed about the heat flux from the core into the mantle. Two of the models studied are superadiabatic, that is they postulate that the heat flux from the core exceeds the flux that thermal conduction alone would allow; two are subadiabatic, where the opposite is assumed. In two of the models it is supposed that the heat is extracted uniformly across the core- mantle boundary; in the other two, substantial horizontal variations are allowed, the precise choice of which is guided by the seismically inferred lower mantle tomography. The very different behaviours of the four models are described here. Reasons are given why, for the homogeneous model and for the two superadiabatic models, the solid core should rotate faster than the mantle by a couple of degrees per year, our prediction for the Earth that was subsequently supported by two independent seismic analyses.