  We study theoretically the cooling of an ensemble of nuclear spins coupled to
the spin of a localized electron in a quantum dot. We obtain a master equation
for the state of the nuclear spins interacting with a sequence of polarized
electrons that allows us to study quantitatively the cooling process including
the effect of nuclear spin coherences, which can lead to ``dark states'' of the
nuclear system in which further cooling is inhibited. We show that the
inhomogeneous Knight field mitigates this effect strongly and that the
remaining dark state limitations can be overcome by very few shifts of the
electron wave function, allowing for cooling far beyond the dark state limit.
Numerical integration of the master equation indicates, that polarizations
larger than 90% can be achieved within a millisecond timescale.
