Hydromagnetic flow in planetary cores