Figure represents a pipe or tube of flow for an ideal fluid, steady, incompressible and non-viscous. At the inlet the pipe has cross section A1, velocity v1 and at a height y1 from reference level. At outlet the crosssection is A2, velocity v2 and at a height y2 from reference level. Top figure shows the flow at time t. Bottom figure shows the flow at a time δt later. As shown in two figure, a mass quantity δm has moved forward in the tube.
Let P1 be the pressure acting at the inlet and pushes the fluid towards outlet. The workdone w1 = P1A1δx1.
Let P2 be the force acting against the fluid flow at outlet. Workdone W2 by P2 is given by W2=-P2A2δx2 (negative sign is due to force acting against the direction of fluid flow).
Workdone by gravity is given by W3 = -δm×g×(y2-y1).
Total external work is Wext = W1+W2+W3 = P1A1δx1-P2A2δx2-δm×g×(y2-y1).
The change in kinetic energy of the fluids that had displaced at inlet and outlet is given by, ΔK = (1/2)×δm×v22-(1/2)×δm×v12;
Due to conservation of energy we have ΔK+ΔU = Wext, where ΔU is change in internal energy.
Here ΔU=0 because there is no change in inernal energy.
by applyinh conservation of energy,
(1/2)×δm×v22-(1/2)×δm×v12 = P1A1δx1-P2A2δx2-δm×g×(y2-y1) = (P1-P2)(δm/ρ)-δm×g×(y2-y1)
By multiplying all the terms with ρ/δm, we get P1+(1/2)ρv12+ρ×g×y1 = P2+(1/2)ρv22+ρ×g×y2
hence we write P+(1/2)ρv2+ρ×g×y = constant
The above equation is Bernoulli's equation