Effects of time-varying freestream velocity on energy harvesting using an oscillating foil