Numerical simulation of electrical conductivity in microscopically inhomogeneous materials