Oil well viscosity measurement and calculation algorithm