Density-weighted mean (source code)

= Density-weighted mean
{title2=$\widetilde u=\langle\rho u\rangle/\langle\rho\rangle$}

For positive mean <density>, this average weights a <velocity> by local mass rather than volume. It satisfies the exact identity $\langle\rho u\rangle=\langle\rho\rangle\widetilde u$, so it naturally represents <mass flux> in averaged <conservation laws>. The ordinary volume mean generally fails that identity when <density> and <velocity> are correlated. Applied inside a phase, the same construction uses <density> times that phase's indicator as its weight.