A PDE-based Method for Optimizing Solar Cell Performance