Add utility routine for energy density