Ferrofluid is a liquid that becomes strongly magnetized in the presence of a magnetic field. A grinding process for ferrofluid was invented in 1963 by NASA’s Steve Papell as a liquid rocket fuel that could be drawn toward a pump inlet in a weightless environment by applying a magnetic field. Ferrofluids are colloidal liquids made of nanoscale ferromagnetic, or ferrimagnetic, particles suspended in a carrier fluid (usually an organic solvent or water). Each tiny particle is thoroughly coated with a surfactant to inhibit clumping.

When a paramagnetic fluid is subjected to a strong vertical magnetic field, the surface forms a regular pattern of peaks and valleys. This effect is known as the Rosensweig or normal-field instability. The instability is driven by the magnetic field; it can be explained by considering which shape of the fluid minimizes the total energy of the system.

From the point of view of magnetic energy, peaks and valleys are energetically favorable. In the corrugated configuration, the magnetic field is concentrated in the peaks; since the fluid is more easily magnetized than the air, this lowers the magnetic energy. In consequence, the spikes of fluid ride the field lines out into space until there is a balance of the forces involved.

At the same time, the formation of peaks and valleys is resisted by gravity and surface tension. It requires energy both to move fluid out of the valleys and up into the spikes and to increase the surface area of the fluid. In summary, the formation of the corrugations increases the surface free energy and the gravitational energy of the liquid but reduces the magnetic energy. The corrugations will only form above a critical magnetic field strength when the reduction in magnetic energy outweighs the increase in surface and gravitation energy terms.

Ferrofluids have an exceptionally high magnetic susceptibility and the critical magnetic field for the onset of the corrugations can be realized by a small bar magnet. – Wikipedia