  The two dimensional incompressible viscous flow past a flapping foil immersed
in a uniform stream is studied numerically. Numerical simulations were
performed using a Lattice-Boltzmann model for moderate Reynolds numbers. The
computation of the hydrodynamic force on the foil is related to the the wake
structure. In particular, when the foil's centre of mass is fixed in space,
numerical results suggest a relation between drag coefficient behaviour and the
flapping frequency which determines the transition from the von K\'arm\'an
(vKm) to the inverted von K\'arm\'an wake. Beyond the inverted vKm transition
the foil was released. Upstream swimming was observed at high enough flapping
frequencies. Computed hydrodynamic forces suggest the propulsion mechanism for
the swimming foil.
