MadSci Network: Astronomy |
While nobody REALLY knows why the Earth and the Sun have magnetic fields, most agree that they are due to 'dynamos' inside. The Earth is almost solid in the centre, I believe, and the field is thought to be generated in a layer around the actual core where motion is possible. The Sun is made mainly of hydrogen, yes, but the core is very dense due to the pressure of the layers from above, and heavier elements settle there. The magnetic field we can detect outside the Sun is generated by the layers below the surface but not near the core - a convective zone (i.e. motion). Some planets have magnetic fields that are frozen into solid rock - the Moon has a weak field, and I think Mercury also has one of these fields. These fields are not being generated all the time, but are relics - like in a permanent magnet.
Try the links in the MadSci Library for more information on Astronomy.