Numerical applications of free discontinuity problems to folding and fracture