We have simulated a perovskite solar cell by developing a comprehensive mathematical model which incorporates drift-diffusion and heat transfer equations. This model incorporates all the heat transfer mechanisms, including the thermal power generation due to the tail state recombination and thermalization of charge carriers. Our model is validated by calculating the current-voltage characteristics of a PSC of the structure of Glass/PEDOT: PSS/CH3NH3PbI3/PC60BM/Al and finding it in very good agreement with the experimental results. The influence of grain boundary diameter on the operating temperature of the PSC is investigated in detail. It is found that by increasing the diameter of the grain boundaries, the operating temperature of the PSC decreases at higher voltages and the open circuit voltage increases slightly. The thermal power generated by the thermalization is found to play the dominant role in the operating temperature followed by the thermal power generated at the grain boundaries due to the highest tail state recombination in the region. This study is expected to provide a deeper understanding about different factors that influence the operating temperature of perovskite solar cells.