The major loss of energy in long pipes is due to