A three-dimensional model for grain boundary resistivity in metal films