Energy harvesting through flow-induced oscillations of a foil