Fishes are talented swimmers. Depending on the propulsion mechanisms many fishes can use flapping tails and/or fins to generate thrust, which seems to be connected to the formation of a reverse von Kármán wake. In the present work, the flow past a 2D flapping foil is simulated by solving the incompressible Navier-Stokes equations in the open-source OpenFOAM platform. A systematic study by varying the oscillating frequency, peak-to-peak amplitude and Reynolds number has been performed to analyze the transition of vorticity types in the wake as well as drag-thrust transition. The overset grid method is used herein to allow the pitching foil to move without restrictions. Spatial convergence tests have been carried out with respect to grid resolution and the size of overset mesh domain. Numerical results are compared with available experimental data and discussed. The results show that the adopted methodology can be well applied to simulate large amplitude motions of the flapping foil. The transitions in the types of wake are consistent with the benchmark experimental data, and the drag-thrust transition of the pitching foil does not coincide with von Kármán (vK)-reverse von Kármán (reverse-vK) wake transition and it is highly dependent on the Reynolds number.