write the function to calculate viscosity