The numerical simulation of microstructure