Understanding the Role of Ferroelastic Domains on the Pyroelectric and Electrocaloric Effects in Ferroelectric Thin Films