The flashing ratchet is a model for certain types of molecular motors as well as a convenient model problem in the more general context of di#usion mediated transport. In this paper we show that it can be derived using a minimum energy dissipation principle for transport in a viscous environment. We then study the long time behavior of the flashing ratchet model. By entropy methods, we prove the existence of periodic solutions which are global attractors for the dynamics, with an exponential rate. Large time qualitative behaviour and especially mass accumulation are then investigated from a numerical point of view. For that purpose, we introduce a numerical method based on the minimum energy dissipation principle, which allows us to reduce the problem to a simple dynamical system.