The Darcy-Weisbach equation enables the head loss due to friction within a given run of pipe to be calculated. It relates the head loss to the diameter of the pipe, the velocity of the flow, the length of the pipe, and a friction factor. The friction factor varies according to the parameters of the pipe, and several relationships are known, depending on the flow regime in the pipe.