Global existence for a second-order thermomechanical model of shape memory alloys