The numerical simulation of microstructures in geological materials