A variational approach to the phase field modeling of brittle and ductile fracture. (August 2018)