  We investigate the problem of an ultracold atomic gas in the superfluid phase
flowing in the presence of a potential barrier or a periodic potential. We use
a hydrodynamic scheme in the local density approximation (LDA) to obtain an
analytic expression for the critical current as a function of the barrier
height or the lattice intensity, which applies to both Bose and Fermi
superfluids. In this scheme, the stationary flow becomes energetically unstable
when the local superfluid velocity is equal to the local sound velocity at the
point where the external potential is maximum. We compare this prediction with
the results of the numerical solutions of the Gross-Pitaevskii and
Bogoliubov-de Gennes equations. We discuss the role of long wavelength
excitations in determining the critical velocity. Our results allow one to
identify the different regimes of superfluid flow, namely, the LDA hydrodynamic
regime, the regime of quantum effects beyond LDA for weak barriers and the
regime of tunneling between weakly coupled superfluids for strong barriers. We
finally discuss the relevance of these results in the context of current
experiments with ultracold gases.
