Computationally efficient method for optical simulation of solar cells and their applications