A three-dimensional finite element model for thermal effect of imperfect electric contacts