  Young neutron stars (NSs) have exterior magnetic fields ranging over three or
more orders of magnitude, up to around $10^{15}$ G. These fields are believed
to be amplified to such high strengths by dynamo action, but neither the
details of this, nor the resulting range of field strengths, is satisfactorily
understood. Here we consider three possible eras in which a dynamo may operate.
For the first, proto-NS, phase, we argue that generation of large-scale field
is inefficient, inhibited by the relatively high fluid viscosity. Understanding
dynamo action under these conditions calls for a revised theory of mean-field
electrodynamics, potentially analogous to the equations for magnetic-field
evolution in a type-II superconductor. In the second phase we propose a new
dynamo mechanism, driven by precession. Such a dynamo would be effective even
at relatively low rotation rates, and can produce the observed variation of
exterior-field strengths from small differences in birth physics. It could also
be a viable mechanism for long-term field generation in main-sequence stars.
Finally, dynamo action in a cold NS is disfavoured, due to both a lack of
suitable fluid motions and inhibition of magnetic reconnection by
superconductivity.
