Continuity equation (source code)

= Continuity equation
{wiki}

A <continuity equation> expresses local conservation by balancing density changes against flux divergence. For <mass density> $\rho$ transported with fluid velocity $\mathbf u$ and no mass sources, it is $\partial_t\rho+\nabla\cdot(\rho\mathbf u)=0$.

Expanding the divergence gives $D\rho/Dt+\rho\nabla\cdot\mathbf u=0$, where $D/Dt$ is the <material derivative>. A fluid parcel can change density when the surrounding flow compresses or expands it. For constant nonzero density, the equation reduces to the <incompressibility condition> $\nabla\cdot\mathbf u=0$.

In a steady one-dimensional pipe flow, integrating across a section gives constant mass flow rate $\rho uA$, under the usual uniform-section approximation. Velocity need not remain constant when the density or channel area changes; the continuity equation constrains their product.