Numerical simulation of mixing and segregation of granular material