The role of nucleation and growth of microcracks in brittle solids under compression: A numerical study