  A self-regulating magnetic flux pumping mechanism in tokamaks that maintains
the core safety factor at $q\approx 1$, thus preventing sawteeth, is analyzed
in nonlinear 3D magnetohydrodynamic simulations using the M3D-C$^1$ code. In
these simulations, the most important mechanism responsible for the flux
pumping is that a saturated $(m=1,n=1)$ quasi-interchange instability generates
an effective negative loop voltage in the plasma center via a dynamo effect. It
is shown that sawtoothing is prevented in the simulations if $\beta$ is
sufficiently high to provide the necessary drive for the $(m=1,n=1)$
instability that generates the dynamo loop voltage. The necessary amount of
dynamo loop voltage is determined by the tendency of the current density
profile to centrally peak which, in our simulations, is controlled by the
peakedness of the applied heat source profile.
