Local energy estimates for the finite element method on sharply varying grids