A Discontinuous Ritz Method for a Class of Calculus of Variations Problems