Development of residual stress and damage in thermal barrier coatings