Energy consistent nonlinear dynamic contact analysis of structures