The generation of electrical current and magnetic field by the motion of an electrically conducting fluid. It is generally believed that the magnetic fields of the earth and the sun are produced by dynamo action in the molten iron–nickel core of the earth and in the plasma of the solar interior respectively.