The effects of grain boundaries on the performance of thin film photovoltaic devices