Thermoelastic effect: a finite element approach