Shear viscosity calculation for particle-based flow