  In stars and planets, magnetic fields are believed to originate from the
motion of electrically conducting fluids in their interior, through a process
known as the dynamo mechanism. In this Letter, an optimization procedure is
used to simultaneously address two fundamental questions of dynamo theory:
"Which velocity field leads to the most magnetic energy growth?" and "How large
does the velocity need to be relative to magnetic diffusion?" In general, this
requires optimization over the full space of continuous solenoidal velocity
fields possible within the geometry. Here the case of a periodic box is
considered. Measuring the strength of the flow with the root-mean-square
amplitude, an optimal velocity field is shown to exist, but without limitation
on the strain rate, optimization is prone to divergence. Measuring the flow in
terms of its associated dissipation leads to the identification of a single
optimal at the critical magnetic Reynolds number necessary for a dynamo. This
magnetic Reynolds number is found to be only 15% higher than that necessary for
transient growth of the magnetic field.
