Validity of continuity equation $\frac{\partial \rho }{\partial t}+\nabla \cdot \left(\rho \vec{V}\right)=0$ $\frac{\partial \rho }{\partial t}+\nabla \cdot \left(\rho \vec{V}\right)=0$
When is the continuity equation valid? And how can i find it mathematically?
Is it valid only for newtonial fluids?, compressible fluids? and viscous fluids?
 A: Imagine integrating the equation over a volume. The first term gives the rate of change of the mass inside the volume. By the divergence theorem (see the nice wikipedia article), the second term gives the rate at which mass is flowing out of the volume. Any time mass is conserved in a region, the sum of these two terms has to be equal to zero. The equation will be valid for all kinds of ordinary fluids.
A: One can show that the energy-momentum tensor for a perfect fluid (no shear stresses, viscosity, and heat conduction), as measured by  an observer at rest, is
\begin{equation}
T^{\mu\nu}=(p+\rho)U^{\mu}U^{\nu}+p\eta^{\mu\nu}
\end{equation}
where $\rho$ is the density, $p$ is the pressure and $U^{\mu}=(1,v^i)$ is the four velocity of the fluid. Now, the energy- momentum tensor is conserved, namely
\begin{equation}
\partial_{\mu}T^{\mu\nu}=0
\end{equation}
If we write this equation in the non relativistic limit, namely $\lvert v^i\rvert <<1$, $p<<\rho$, we eventually find
\begin{equation}
\partial_{t}\rho +\vec\nabla\cdot(\rho\vec v)=0
\end{equation}
\begin{equation}
\rho\left[\partial_{t}\vec v + \vec v \cdot (\vec\nabla)\cdot v\right]=-\vec\nabla p
\end{equation}
which are the Euler equations.
Hence, the equation you wrote is valid for a non-relativistic, perfect fluid.
