Continuity equation for non-viscous fluids through a tube In basic textbooks, the equation of continuity for non-viscous fluids through a pipe is usually written as
$$
\rho_{2} A_{2} v_{2}=\rho_{1} A_{1} v_{1} \tag{1}
$$
with $\rho$ and $v$ being the density and velocity of the fluid and $A$ the cross-section of the tube, all referred to two arbitrary points $1$ and $2$ of the tube.
However, the general form of the continuity equation is given by
$$
\frac{\partial \rho}{\partial t}+\nabla \cdot(\rho \mathbf{v})=0 \tag{2}
$$
How do we go from the general equation $(2)$ to the simpler form $(1)$? Under what conditions would $(1)$ be valid, other than that the flow is through a pipe?
 A: If we assume that the density of the fluid in a given point of space is constant (e.g. the flow is steady, density does not change with time) then $\frac{\partial \rho}{\partial t} = 0$. Then we get
$$
\nabla \cdot(\rho \mathbf{v})=0
$$
Gauss-Ostrogradsky's theorem says that if you add up all the divergence in a given volume, it gives you the flow through the bound of the volume:
$$
\int_V \nabla \cdot(\rho \mathbf{v}) \;\text{d}V = \oint_S \rho \mathbf{v} \cdot \text{d}\mathbf{S} =0
$$
When you have a pipe, the flow through its sides is zero and you can write the following for two cross-sections (if you pick the pipe and the cross-sections as your closed surface):
$$
 \int_{A_1} \rho \mathbf{v} \cdot \text{d}\mathbf{S} - \int_{A_2} \rho \mathbf{v} \cdot \text{d}\mathbf{S} =0
$$
$$
 \int_{A_1} \rho \mathbf{v} \cdot \text{d}\mathbf{S} = \int_{A_2} \rho \mathbf{v} \cdot \text{d}\mathbf{S}
$$
If the velocity has always the same direction as the normal to each cross-section, you can write
$$
 \int_{A_1} \rho v \;\text{d}S = \int_{A_2} \rho v \;\text{d}S
$$
If the density and velocity are constant along both cross-sections, you can then write
$$
\rho_{2} A_{2} v_{2}=\rho_{1} A_{1} v_{1}
$$
A: It's worth beginning with making sense of the two equations.
(1) says that the flow through cross section $A_1$ is equal to the flow through cross section $A_2$.
(2) makes sense when integrated over a volume. It says that the change of total mass of fluid in a volume must balance with the flow into that volume (i.e. $-\nabla\cdot(\rho\mathbf{v})$ integrated over the surface of that volume).
Both make a lot of sense, I think you'll agree.
So, given this intuition, we can begin to see why the first one makes sense for fluid in a pipe. For a start, fluid can't flow out the sides, so we don't need to consider the divergence of fluid out the sides of the pipe. The surface integral in (2) is just over the two ends, i.e. $A_1$ and $A_2$.
Furthermore, we assume the fluid density is constant with time, so that term disappears.
The final piece we need is that the fluid velocity is assumed to be perpendicular to the cross section. This means the surface integral is just the area multiplied by the flux, i.e. $\rho A v$ at each end.
