Grain and void compression in fractured and porous rocks